From fccedb63b009e44ec246c9361fa1f82cc87f92a9 Mon Sep 17 00:00:00 2001 From: efradtschuk Date: Mon, 10 Jan 2022 01:27:52 +0100 Subject: [PATCH 1/4] exclude change-compiler section from chapter 0 --- content/first-steps-with-latex.tex | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) 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. From 6ebf564ee2d08104ec5e0e4eaffacc2bf9cc7291 Mon Sep 17 00:00:00 2001 From: efradtschuk Date: Mon, 10 Jan 2022 01:40:04 +0100 Subject: [PATCH 2/4] replace minted with shell command --- content/source-code-listings-minted.tex | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/content/source-code-listings-minted.tex b/content/source-code-listings-minted.tex index 4e5b0f9..2fe4548 100644 --- a/content/source-code-listings-minted.tex +++ b/content/source-code-listings-minted.tex @@ -16,10 +16,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: -\begin{minted}[]{bash} -$ python --version -Python 3.8.5 -\end{minted} +\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. From c9f0bee90550bc4826955ca0b990c2f107bcd498 Mon Sep 17 00:00:00 2001 From: efradtschuk Date: Mon, 10 Jan 2022 09:26:45 +0100 Subject: [PATCH 3/4] include minted in preamble only when minted is defined as listingsmode --- commands.tex | 12 ++++++------ setup.tex | 14 ++++++++++++++ 2 files changed, 20 insertions(+), 6 deletions(-) create mode 100644 setup.tex diff --git a/commands.tex b/commands.tex index 92e8dd7..4fd16ee 100644 --- a/commands.tex +++ b/commands.tex @@ -40,11 +40,11 @@ % \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} -} +%\IfFileExists{listings-mode.tex}{ +% \input{listings-mode.tex} +%}{ +% \newcommand\listingsmode{default} +%} % Shell command % ============== @@ -148,7 +148,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/setup.tex b/setup.tex new file mode 100644 index 0000000..91bfda6 --- /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} % 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} +} \ No newline at end of file From 5a9cc630bbdebc6dc6e689b9ba7a44dff810051a Mon Sep 17 00:00:00 2001 From: efradtschuk Date: Mon, 10 Jan 2022 09:27:09 +0100 Subject: [PATCH 4/4] include minted in preamble only when minted is defined as listingsmode --- main.tex | 1 + praeamble.tex | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/main.tex b/main.tex index 9c259eb..a1afbca 100644 --- a/main.tex +++ b/main.tex @@ -1,3 +1,4 @@ +\input{setup.tex} % Setup \input{praeamble.tex} % Preamble \input{commands.tex} % Custom commands \title{Script for the Fachschaft \acro{WIAI} \LaTeX{} Workshop} diff --git a/praeamble.tex b/praeamble.tex index 4696f25..43de2c3 100644 --- a/praeamble.tex +++ b/praeamble.tex @@ -37,8 +37,8 @@ \usepackage{changes} % Sourcecode listings -\usepackage{minted} \usepackage{listings} +\ifthenelse{\equal{\listingsmode}{minted}}{\usepackage{minted}}{} % Quotes (\enquote) \usepackage[autostyle,autopunct=false]{csquotes}