Compare commits

..

4 Commits

Author SHA1 Message Date
9a99c0aee9 Start fixing the Makefile 2023-01-13 18:21:53 +01:00
5731eb3c45 Add exercise versions 2023-01-13 17:18:30 +01:00
3c699d5dd0 Remove exercise command 2023-01-13 16:35:09 +01:00
e4e731f044 Split script 2023-01-13 16:03:41 +01:00
21 changed files with 249 additions and 155 deletions

2
.gitignore vendored
View File

@ -79,7 +79,7 @@ _minted*
*.swp
*.swo
main.pdf
main-*.pdf
listings-mode.tex
exercise-mode.tex
public

View File

@ -10,7 +10,7 @@ clean:
@echo Cleaning up temporary files.
@rm -rf public/*
@rm -rf temp/*
@rm -f {main,script-only}.{aux,loc,log,out,pdf,soc,toc}
@rm -f main-{script,exercises,solutions}.{aux,loc,log,out,pdf,soc,toc}
# Compile listings (only needed when listings have changed)
listings: listings/**/*
@ -21,10 +21,9 @@ tasks: exercises/**/*
./compile_tasks
# Compile a preview PDF containing all contents
preview: main.tex
echo "\newcommand\exercisemode{any}" > exercise-mode.tex
preview: main-script.tex
echo "\newcommand\listingsmode{minted}" > listings-mode.tex
pdflatex -shell-escape main.tex
pdflatex -shell-escape main-script.tex
@echo
@echo
@echo Run \'make publication\' to generate PDF and ZIP file for publication.
@ -42,51 +41,61 @@ publication-dir:
mkdir -p temp/
# Compile a printable PDF without exercises
publication-pdf-without-exercises: clean publication-dir main.tex
echo "\newcommand\exercisemode{none}" > exercise-mode.tex
publication-pdf-without-exercises: clean publication-dir main-script.tex
echo "\newcommand\listingsmode{minted}" > listings-mode.tex
pdflatex -shell-escape -jobname=script-only main.tex
pdflatex -shell-escape -jobname=script-only main.tex
pdflatex -shell-escape -jobname=script-only main.tex
mv script-only.pdf public/
pdflatex -shell-escape main-script.tex
pdflatex -shell-escape main-script.tex
pdflatex -shell-escape main-script.tex
mv main-script.pdf public/
# Compile a printable PDF with exercises and without solutions
publication-pdf-with-exercises: clean publication-dir main.tex
echo "\newcommand\exercisemode{exercises}" > exercise-mode.tex
publication-pdf-with-exercises: clean publication-dir main-exercises.tex
echo "\newcommand\listingsmode{minted}" > listings-mode.tex
pdflatex -shell-escape -jobname=script-with-exercises main.tex
pdflatex -shell-escape -jobname=script-with-exercises main.tex
pdflatex -shell-escape -jobname=script-with-exercises main.tex
mv script-with-exercises.pdf public/
pdflatex -shell-escape main-exercises.tex
pdflatex -shell-escape main-exercises.tex
pdflatex -shell-escape main-exercises.tex
mv main-exercises.pdf public/
# Compile a printable PDF with exercises and solutions
publication-pdf-with-solutions: clean publication-dir main.tex
echo "\newcommand\exercisemode{solutions}" > exercise-mode.tex
# Compile a printable PDF with solutions
publication-pdf-with-solutions: clean publication-dir main-solutions.tex
echo "\newcommand\listingsmode{minted}" > listings-mode.tex
pdflatex -shell-escape -jobname=script-with-solutions main.tex
pdflatex -shell-escape -jobname=script-with-solutions main.tex
pdflatex -shell-escape -jobname=script-with-solutions main.tex
mv script-with-solutions.pdf public/
pdflatex -shell-escape main-solutions.tex
pdflatex -shell-escape main-solutions.tex
pdflatex -shell-escape main-solutions.tex
mv main-solutions.pdf public/
# Build a ZIP file without tasks
publication-zip-without-exercises: clean publication-dir
rm -rf temp/*
cp --parents main-script.tex praeamble.tex commands.tex setup.tex content/* graphics/* listings/**/*.{tex,pdf,bib,java,txt} titlepage.tex imprint.tex temp/
cd temp && zip ../public/project-without-exercises * **/* **/**/*
# Build a ZIP file with tasks and without solutions
publication-zip-with-exercises: clean publication-dir main.tex
rm -rf temp/*
cp --parents main.tex praeamble.tex commands.tex setup.tex content/* graphics/* listings/**/*.{tex,pdf,bib,java,txt} temp/
publication-zip-with-exercises: clean publication-dir
rm -rf temp/* exercises/**/_*
cp --parents main-exercises.tex praeamble.tex commands.tex setup.tex graphics/* listings/**/*.{tex,pdf,bib,java,txt} titlepage.tex imprint.tex first-steps-with-latex.tex temp/
cp --parents exercises/**/* temp/
rm -f temp/exercises/**/*.done.{tex,bib}
rm -f temp/exercises/**/*.done.{tex,bib,synctex.gz}
rm -f temp/exercises/**/*.rend.tex
rm -f temp/exercises/**/*.aux
find temp/ -name '*.raw.*' -exec bash -c 'sed "s/\.raw\./\./g" <<<{} | xargs mv {}' \;
find temp/ -name '*.tex' -exec sed -i -e 's/\.raw\./\./g' {} \;
# TODO: Replacement of .raw not working.
sed -e 's/\.raw//g' temp/main-exercises.tex > temp/main-exercises.tex
cd temp && zip ../public/project-with-exercises * **/* **/**/*
# Build a ZIP file with tasks and solutions
publication-zip-with-solutions: clean publication-dir main.tex
rm -rf temp/*
cp --parents main.tex praeamble.tex commands.tex setup.tex content/* graphics/* listings/**/*.{tex,pdf,bib,java,txt} temp/
publication-zip-with-solutions: clean publication-dir
rm -rf temp/* exercises/**/_*
cp --parents main-solutions.tex praeamble.tex commands.tex setup.tex graphics/* listings/**/*.{tex,pdf,bib,java,txt} titlepage.tex imprint.tex first-steps-with-latex.tex temp/
cp --parents exercises/**/* temp/
rm -f temp/exercises/**/*.raw.{tex,bib}
rm -f temp/exercises/**/*.raw.{tex,bib,synctex.gz}
rm -f temp/exercises/**/*.aux
find temp/ -name '*.done.*' -exec bash -c 'sed "s/\.done\./\./g" <<<{} | xargs mv {}' \;
find temp/ -name '*.tex' -exec sed -i -e 's/(raw|done)//g' {} \;
# TODO: Replacement of .done not working.
sed -e 's/\.done//g' temp/main-solutions.tex > temp/main-solutions.tex
cd temp && zip ../public/project-with-solutions * **/* **/**/*

View File

@ -241,69 +241,3 @@
\end{figure}
}
% Exercise mode
% =============
% The exercise mode can be chosen by writing one of the following to the exercise-mode.tex file before compilation:
% \newcommand\exercisemode{none} % for a blank script without exercises
% \newcommand\exercisemode{exercises} % for a script with exercises only
% \newcommand\exercisemode{solutions} % for a script with solutions only
% \newcommand\exercisemode{any} % for a script containing all available material
% The following lines include that file or make \exercisemode default to 'any' so that any derivatives of this project will work even without the file.
\IfFileExists{exercise-mode.tex}{
\input{exercise-mode.tex}
}{
\newcommand\exercisemode{any}
}
% Exercises
% =========
% Includes the task.tex file within the given subfolder of exercises and adds a heading.
\newcommand\exercise[1]{
\ifthenelse{\equal{\exercisemode}{none}}{
% Exercises disabled.
}{
\newpage
\definecolor{latexblue}{rgb}{0.9,0.925,0.95}
\pagecolor{latexblue}
%\definecolor{latexblue}{rgb}{0.73,0.84,0.92}
\section*{Exercise \thechapter}
\addcontentsline{toc}{section}{Exercise}%
\input{exercises/#1/task.tex}
\newpage
\nopagecolor
}
}
% Exercise Material
% =================
% Takes a project-relative path, and inserts matching exercise material and/or solutions, depending on the exercise mode.
\newcommand\exercisematerial[1]{
% Mode 'exercises': raw material only
\ifthenelse{\equal{\exercisemode}{exercises}}{
\IfFileExists{#1.raw.tex}{
\input{#1.raw.tex}
}{}
}{}
% Mode 'solutions': completed material only
\ifthenelse{\equal{\exercisemode}{solutions}}{
\IfFileExists{#1.done.tex}{
\input{#1.done.tex}
}{}
}{}
% Mode 'any': all existing material. If both raw and completed material exist, headings are added for each.
\ifthenelse{\equal{\exercisemode}{any}}{
\IfFileExists{#1.raw.tex}{
\IfFileExists{#1.done.tex}{
\subsubsection*{Preview of the raw material}
}{}
\input{#1.raw.tex}
}{}
\IfFileExists{#1.done.tex}{
\IfFileExists{#1.raw.tex}{
\subsubsection*{Preview of the solution}
}{}
\input{#1.done.tex}
}{}
}{}
}

View File

@ -1,3 +1,5 @@
\section{Structure your document and text}
\begin{enumerate}
\item In the directory \file{exercises/basic-document-structure}, you can find a file named \file{document-structure.tex}. Wrap the text of the file in a \code{latex}{document} environment and add the following preamble. Afterwards, compile the document.
\codeblock{latex}{./exercises/basic-document-structure/preamble.code.tex}
@ -13,5 +15,3 @@
a table of contents for your document.
\item Afterwards, comment out the preamble, the document environment, and the table of contents.
\end{enumerate}
\exercisematerial{exercises/basic-document-structure/document-structure}

View File

@ -1,20 +1,10 @@
\section*{Exercise \thechapter .1}
\section{Footnotes and references}
\subsection{Inserting footnotes}
Make the text \enquote{March 2021} of the file
\file{exercises/footnotes/footnotes.tex} appear as a footnote instead of in
parentheses. Additionally, insert a clickable URL to the Java Development Kit
as footnote.
\texttt{https://www.oracle.com/java/technologies/javase-downloads.html}
\exercisematerial{exercises/footnotes/footnotes}
\section*{Exercise \thechapter .2}
In file \file{exercises/references/references.tex}, replace \enquote{in the
figure} and \enquote{the following source code listing} with suited references.
Use the command \code{latex}{\textbackslash cref}. Do not forget to first
introduce labels for the elements that you want to reference. To do so, first
of all, wrap the source code listing in a \code{latex}{listing} environment.
Also, insert a caption for the source code listing.
Make sure to use suitable prefixes before the labels.
\exercisematerial{exercises/references/references}
\texttt{https://www.oracle.com/java/technologies/javase-downloads.html}

View File

@ -1,9 +1,8 @@
\section{Inserting graphics}
In the \file{exercises/graphics} directory you can find an image file
\file{latex-logo.png}. Insert the image into the
\file{exercises/graphics/graphics.tex} file. Make sure that the image is placed
exactly where you have specified it. On top of that, the picture shall be
centered, and a caption shall be added. Adapt the image width to the text width
(\code{latex}{\textbackslash textwidth}).
\exercisematerial{exercises/graphics/graphics}

View File

@ -1,7 +1,7 @@
\section{Adding enumerations}
Format the recipe you can find in \file{exercises/lists/lists.tex} as an
unordered list (\code{latex}{itemize}) with sub-lists \emph{Ingredients}
and \emph{Instructions}.
Within these, there shall be an unordered list of ingredients and an ordered list of
instructions, respectively.
\exercisematerial{exercises/lists/lists}

View File

@ -1,3 +1,5 @@
\section{Creating and inserting references}
\begin{enumerate}
\item Create a new Bib\TeX{} file called \file{literature.bib} in the \file{exercises/literature} folder.
\item Use Google Scholar or \url{dblp.org} to retrieve Bib\TeX{} entries for the following \LaTeX{}
@ -15,5 +17,3 @@
\item \textbf{Note}: If compiling fails, it may help to remove all auxiliary
files \\(\mono{main.aux/bbl/blg/loc/out/pdf/soc/toc}) before compiling again.
\end{enumerate}
\exercisematerial{exercises/literature/literature}

View File

@ -1,4 +1,8 @@
\section{Typesetting mathematics}
Use \LaTeX{} math mode to typeset the following formulas.
Pay attention to the size of brackets.
\exercisematerial{exercises/maths/math-formulas}
\todo{Strange indent}
\vspace{1cm}

View File

@ -1,4 +1,4 @@
\section{A structured project}
Within the directory \file{exercises/project-structure} you can find the file
\file{main.tex}.
\exercisematerial{exercises/project-structure/tasks}

View File

@ -0,0 +1,10 @@
% same chapter as footnotes
\subsection{Inserting references}
In file \file{exercises/references/references.tex}, replace \enquote{in the
figure} and \enquote{the following source code listing} with suited references.
Use the command \code{latex}{\textbackslash cref}. Do not forget to first
introduce labels for the elements that you want to reference. To do so, first
of all, wrap the source code listing in a \code{latex}{listing} environment.
Also, insert a caption for the source code listing.
Make sure to use suitable prefixes before the labels.

View File

@ -1,3 +1,5 @@
\section{Listings}
In the folder \file{exercises/source-code-listings}, you will find a file called \file{Source.java}.
We will now include it into our document and adjust its display to fit our needs.
If you have questions, consult the \pkg{minted} or \pkg{listings} package documentation.
@ -27,8 +29,6 @@ If you have questions, consult the \pkg{minted} or \pkg{listings} package docume
\item Don't show special characters for spaces in strings.
\end{enumerate}
\exercisematerial{exercises/source-code-listings/source-code-listings}
% Reset experiments from exercise material if minted is used
\ifthenelse{\equal{\listingsmode}{minted}}{%
\usemintedstyle{default}

View File

@ -1,4 +1,6 @@
% breakanywhere doesn't seem to work.
\section{Insert special characters}
\todo{Adjust to new page layout.}
For this task, we are using the file \file{exercises/special-characters.tex}.
To be able to see your results here within the script,
compile the \file{main.tex} file.
@ -12,6 +14,3 @@ This applies for the subsequent tasks, as well.
\item Add quotation marks around the words \emph{Studi-Ticket} and
\emph{Studi-Karte} using the \code{latex}{\textbackslash enquote} command.
\end{enumerate}
\exercisematerial{exercises/special-characters/special-characters}

View File

@ -1,10 +1,8 @@
\section{Typesetting tables}
The following list shows some key data about a few courses of the \acro{WIAI} faculty.
However, the overview is not as clear as it could be.
To improve it, convert the list into a table with columns for \emph{name}, \emph{abbreviation} and \emph{term}.
Insert an additional \emph{centered column} that numbers the courses.
Add a caption to the table.
You find the table in \file{exercises/tables/tables.tex}.
\exercisematerial{exercises/tables/tables}

View File

@ -1,3 +1,5 @@
\section{Emphasising text}
\begin{enumerate}
\item In \file{exercies/text-markup/markup.tex}, emphasize the words
``recursion'' and ``recursive.''
@ -5,5 +7,3 @@
\item Of course, you can also experiment with the other commands that you learned for text markup. However, you might want to remove them afterwards to keep your document nice and tidy.
\end{enumerate}
\exercisematerial{exercises/text-markup/markup}

View File

@ -2,6 +2,8 @@
\definecolor{latexblue}{rgb}{0.9,0.925,0.95}
\pagecolor{latexblue}
\todo{Refactor text for new exercise script.}
\chapter*{First steps with \LaTeX}
\addcontentsline{toc}{section}{First steps with \LaTeX}

View File

@ -1,7 +1,3 @@
\thispagestyle{empty}
\includepdf{graphics/cover.pdf}
\newpage
\thispagestyle{empty}
@ -14,4 +10,4 @@
& It is licensed under Creative Commons \enquote{Attribution-ShareAlike 4.0 International} (CC BY-SA 4.0): \\
\href{http://creativecommons.org/licenses/by-sa/4.0/}{\includegraphics[height=.5cm]{graphics/cc-by-sa}} & \url{http://creativecommons.org/licenses/by-sa/4.0/} \\ \\
& Upon request, allowances exceeding the limitations of this license may be granted.
\end{tabular}
\end{tabular}

79
main-exercises.tex Normal file
View File

@ -0,0 +1,79 @@
\input{setup.tex} % Setup
\input{praeamble.tex} % Preamble
\input{commands.tex} % Custom commands
\title{Script for the Fachschaft \acro{WIAI} \LaTeX{} Workshop}
\author{Evelyn Fradtschuk \and Florian Knoch \and Christian Kremitzl \and Bernhard Luedtke}
\begin{document}
\selectlanguage{english}
\frenchspacing
% Custom headline prefix
\renewcommand{\thesection}{E\arabic{section}}
\renewcommand{\thesubsection}{\arabic{subsection}}
% Title page
\input{titlepage.tex}
% or simply
% \maketitle
\thispagestyle{empty}
\newpage
\setcounter{page}{1} % Don't count title page.
\setcounter{tocdepth}{2}
\tableofcontents
\newpage
\input{first-steps-with-latex.tex}
% Align exercise numbers with chapters
\setcounter{section}{3}
\input{exercises/basic-document-structure/task}
\input{exercises/basic-document-structure/document-structure.raw}
\newpage
\input{exercises/project-structure/task}
\input{exercises/project-structure/tasks.raw}
\newpage
\input{exercises/special-characters/task}
\input{exercises/special-characters/special-characters.raw}
\newpage
\input{exercises/text-markup/task}
\input{exercises/text-markup/markup.raw}
\newpage
\input{exercises/lists/task}
\input{exercises/lists/lists.raw}
\newpage
\input{exercises/maths/task}
\input{exercises/maths/math-formulas.raw}
\newpage
\input{exercises/graphics/task}
\input{exercises/graphics/graphics.raw}
\newpage
\input{exercises/tables/task}
\input{exercises/tables/tables.raw}
\newpage
\input{exercises/source-code-listings/task}
\input{exercises/source-code-listings/source-code-listings.raw}
\newpage
\input{exercises/footnotes/task}
\input{exercises/footnotes/footnotes.raw}
\newpage
\input{exercises/references/task}
\input{exercises/references/references.raw}
\newpage
\input{exercises/literature/task}
\input{exercises/literature/literature.raw}
\end{document}

View File

@ -10,7 +10,7 @@
\frenchspacing
% Title page
\input{content/titlepage.tex}
\input{titlepage.tex}
% or simply
% \maketitle
\thispagestyle{empty}
@ -20,31 +20,19 @@
\tableofcontents
\newpage
\input{content/first-steps-with-latex.tex}
\input{content/why-use-latex.tex}
\input{content/basic-functionality.tex}
\input{content/basic-document-structure.tex}
\exercise{basic-document-structure}
\input{content/project-structure.tex}
\exercise{project-structure}
\input{content/special-characters.tex}
\exercise{special-characters}
\input{content/text-markup.tex}
\exercise{text-markup}
\input{content/lists.tex}
\exercise{lists}
\input{content/maths.tex}
\exercise{maths}
\input{content/graphics.tex}
\exercise{graphics}
\input{content/tables.tex}
\exercise{tables}
\input{content/source-code-listings.tex}
\exercise{source-code-listings}
\input{content/footnotes.tex}
\exercise{footnotes}
\input{content/literature.tex}
\exercise{literature}
\input{content/prospects.tex}
\end{document}

79
main-solutions.tex Normal file
View File

@ -0,0 +1,79 @@
\input{setup.tex} % Setup
\input{praeamble.tex} % Preamble
\input{commands.tex} % Custom commands
\title{Script for the Fachschaft \acro{WIAI} \LaTeX{} Workshop}
\author{Evelyn Fradtschuk \and Florian Knoch \and Christian Kremitzl \and Bernhard Luedtke}
\begin{document}
\selectlanguage{english}
\frenchspacing
% Custom headline prefix
\renewcommand{\thesection}{E\arabic{section}}
\renewcommand{\thesubsection}{\arabic{subsection}}
% Title page
\input{titlepage.tex}
% or simply
% \maketitle
\thispagestyle{empty}
\newpage
\setcounter{page}{1} % Don't count title page.
\setcounter{tocdepth}{2}
\tableofcontents
\newpage
\input{first-steps-with-latex.tex}
% Align exercise numbers with chapters
\setcounter{section}{3}
\input{exercises/basic-document-structure/task}
\input{exercises/basic-document-structure/document-structure.done}
\newpage
\input{exercises/project-structure/task}
\input{exercises/project-structure/tasks.done}
\newpage
\input{exercises/special-characters/task}
\input{exercises/special-characters/special-characters.done}
\newpage
\input{exercises/text-markup/task}
\input{exercises/text-markup/markup.done}
\newpage
\input{exercises/lists/task}
\input{exercises/lists/lists.done}
\newpage
\input{exercises/maths/task}
\input{exercises/maths/math-formulas.done}
\newpage
\input{exercises/graphics/task}
\input{exercises/graphics/graphics.done}
\newpage
\input{exercises/tables/task}
\input{exercises/tables/tables.done}
\newpage
\input{exercises/source-code-listings/task}
\input{exercises/source-code-listings/source-code-listings.done}
\newpage
\input{exercises/footnotes/task}
\input{exercises/footnotes/footnotes.done}
\newpage
\input{exercises/references/task}
\input{exercises/references/references.done}
\newpage
\input{exercises/literature/task}
\input{exercises/literature/literature.done}
\end{document}

7
titlepage.tex Normal file
View File

@ -0,0 +1,7 @@
\thispagestyle{empty}
\includepdf{graphics/cover.pdf}
\todo{Adjust cover for different versions.}
\input{imprint}