diff --git a/commands.tex b/commands.tex index 92e8dd7..d93fd6a 100644 --- a/commands.tex +++ b/commands.tex @@ -34,18 +34,6 @@ \rule{\widefigurewidth}{0.4pt} } -% Listings mode -% ============= -% The listings mode can be chosen by writing one of the following to the listings-mode.tex file before compilation: -% \newcommand\listingsmode{default} % to use lstlistings -% \newcommand\listingsmode{minted} % for a script with exercises only -% The following lines include that file or make \listingsmode default to 'default' so that any derivatives of this project will work even without the file. -\IfFileExists{listings-mode.tex}{ - \input{listings-mode.tex} -}{ - \newcommand\listingsmode{default} -} - % Shell command % ============== % Mono-spaced text without syntax highlighting. @@ -148,7 +136,7 @@ midrule, bottomrule, cref, setlength, maketitle, tableofcontents, foreignlanguage, paragraph, subparagraph, mint, mintinline, inputminted, usemintedstyle, definecolor, - citep, enquote% + citep, enquote, lstinputlisting% }, postbreak=\mbox{{$\hookrightarrow$}\space}, emphstyle={\color{ForestGreen}\bfseries}, diff --git a/content/first-steps-with-latex.tex b/content/first-steps-with-latex.tex index 183d00c..c479638 100644 --- a/content/first-steps-with-latex.tex +++ b/content/first-steps-with-latex.tex @@ -31,15 +31,19 @@ Any editor will do (notepad++, Atom, VS Code, etc.). However, for beginners, we do recommend using a program that supports you with \LaTeX-specific features. One of these programs is \TeX{}studio.\footnote{You find the latest version on \url{https://www.texstudio.org/}.} -\section*{Changing the compiler command} -\todo{Refactor after the code inclusion part is redone.} -To prevent errors during the compilation of our document, you have to change the compiler command. -In \TeX{}studio, click on the \emph{Options} button and then on \emph{Configure \TeX{}studio \textellipsis}\todo{Add the correct steps for Mac (these don’t apply)}. -A new window will open up. -Navigate to the \emph{Commands} area, and, next to \sh{pdflatex}, add the flag \sh{-shell-escape}. -In other words: The command for \sh{pdflatex} should look like this: - -\shell{pdflatex -synctex=1 -interaction=nonstopmode -shell-escape \%.tex} +%\section*{Changing the compiler command} +%\todo{Refactor after the code inclusion part is redone.} +%To prevent errors during the compilation of our document, you have to change +%the compiler command. +%In \TeX{}studio, click on the \emph{Options} button and then on +%\emph{Configure \TeX{}studio \textellipsis}\todo{Add the correct steps for Mac +%(these don’t apply)}. +%A new window will open up. +%Navigate to the \emph{Commands} area, and, next to \sh{pdflatex}, add the flag +%\sh{-shell-escape}. +%In other words: The command for \sh{pdflatex} should look like this: +% +%\shell{pdflatex -synctex=1 -interaction=nonstopmode -shell-escape \%.tex} \section*{Compiling for the first time} Open up the file \file{main.tex} in the root directory of the project and compile it by pressing \faForward. diff --git a/content/source-code-listings-minted.tex b/content/source-code-listings-minted.tex index 049fb12..b2a4654 100644 --- a/content/source-code-listings-minted.tex +++ b/content/source-code-listings-minted.tex @@ -15,7 +15,7 @@ or macOS.\footnote{\url{https://docs.python-guide.org/starting/install3/osx/}} After a successful installation, you should be able to execute the aforementioned command in a terminal, confirm by pressing Enter, and see approximately the following result: -\codeblock{bash}{listings/source-code-listings/python-version.txt} +\shell{python $--$version \\ Python 3.8.5} \noindent If the version number is equal to the one stated here, or higher, then everything should be set up correctly. Next, enter the command \sh{pip install Pygments}\footnote{On some operating systems, you might have to use the command \sh{pip3 install Pygments}} in the same terminal window to install the Pygments package for Python. diff --git a/listings/source-code-listings/python-version.txt b/listings/source-code-listings/python-version.txt deleted file mode 100644 index f816d0c..0000000 --- a/listings/source-code-listings/python-version.txt +++ /dev/null @@ -1,2 +0,0 @@ -$ python --version -Python 3.8.5 \ No newline at end of file diff --git a/main.tex b/main.tex index ebf591c..0d472ed 100644 --- a/main.tex +++ b/main.tex @@ -1,4 +1,7 @@ +\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} diff --git a/praeamble.tex b/praeamble.tex index abf1917..a62c53f 100644 --- a/praeamble.tex +++ b/praeamble.tex @@ -38,6 +38,7 @@ % Source code listings \usepackage{listings} +\ifthenelse{\equal{\listingsmode}{minted}}{\usepackage{minted}}{} % Quotes (\enquote) \usepackage[autostyle,autopunct=false]{csquotes} @@ -52,11 +53,3 @@ \usepackage{changes} \definechangesauthor[color=blue, name={Christian}]{C} \definechangesauthor[color=purple, name={Florian}]{F} - -% Custom commands -\input{commands.tex} - -% Optional: Minted for source code listings -\ifthenelse{\equal{\listingsmode}{minted}}{% - \usepackage{minted} -}{} \ No newline at end of file diff --git a/setup.tex b/setup.tex new file mode 100644 index 0000000..aacb8bd --- /dev/null +++ b/setup.tex @@ -0,0 +1,14 @@ +% Listings mode +% ============= +% The listings mode can be chosen by writing one of the following to the +%listings-mode.tex file before compilation: +% \newcommand\listingsmode{default} % to use lstlistings +% \newcommand\listingsmode{minted} % to use minted +% The following lines include that file or make \listingsmode default to +% 'default' so that any derivatives of this project will work even without the +% file. +\IfFileExists{listings-mode.tex}{ + \input{listings-mode.tex} +}{ + \newcommand\listingsmode{default} +} \ No newline at end of file