diff --git a/Makefile b/Makefile index 236b6d3..68f1161 100644 --- a/Makefile +++ b/Makefile @@ -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 * **/* **/**/* diff --git a/content/first-steps-with-latex.tex b/first-steps-with-latex.tex similarity index 98% rename from content/first-steps-with-latex.tex rename to first-steps-with-latex.tex index d57ac33..8640078 100644 --- a/content/first-steps-with-latex.tex +++ b/first-steps-with-latex.tex @@ -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} diff --git a/main-exercises.tex b/main-exercises.tex index 01ed2b3..fc534c0 100644 --- a/main-exercises.tex +++ b/main-exercises.tex @@ -14,7 +14,7 @@ \renewcommand{\thesubsection}{\arabic{subsection}} % Title page -\input{content/titlepage.tex} +\input{titlepage.tex} % or simply % \maketitle \thispagestyle{empty} @@ -24,6 +24,8 @@ \tableofcontents \newpage +\input{first-steps-with-latex.tex} + % Align exercise numbers with chapters \setcounter{section}{3} diff --git a/main-script.tex b/main-script.tex index 04605c1..1b1c404 100644 --- a/main-script.tex +++ b/main-script.tex @@ -10,7 +10,7 @@ \frenchspacing % Title page -\input{content/titlepage.tex} +\input{titlepage.tex} % or simply % \maketitle \thispagestyle{empty} @@ -20,7 +20,6 @@ \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} diff --git a/main-solutions.tex b/main-solutions.tex index 584f2d7..eeb90a4 100644 --- a/main-solutions.tex +++ b/main-solutions.tex @@ -14,7 +14,7 @@ \renewcommand{\thesubsection}{\arabic{subsection}} % Title page -\input{content/titlepage.tex} +\input{titlepage.tex} % or simply % \maketitle \thispagestyle{empty} @@ -24,6 +24,8 @@ \tableofcontents \newpage +\input{first-steps-with-latex.tex} + % Align exercise numbers with chapters \setcounter{section}{3} diff --git a/content/titlepage.tex b/titlepage.tex similarity index 100% rename from content/titlepage.tex rename to titlepage.tex