Added section about using «input» and «include»

This commit is contained in:
Kenneth John Odle 2024-06-29 11:23:12 -04:00
parent 634e583461
commit 6ebb04b26d

View File

@ -265,7 +265,9 @@ Considering that my entire job exists to help keep the drug supply safe (well, t
\section{Tomorrow}
\chapter{Dependency Hell}
\chapter{Dependency Hell}\label{dephell}
\section{Multiple Paths to \textit{Almost} the Same Destination}
I use Okular as a pdf viewer. Even though Ubuntu has a default pdf viewer, it doesn't have a lot of features and is unreliable in some ways. Okular has always been a better choice for me.
@ -306,6 +308,7 @@ Unfortunately that told me that this dependency was already installed. But it's
That updates the dependencies and also means that Okular will run. A quick check of \texttt{Help $\rightarrow$ About Okular} confirmed that I am on version 24.05.1 and that new documents are opening in tabs when I double click on them in the file manager.
\chapter{Coda}
\section{What I Learned About \LaTeX{} While Creating This Issue}
@ -342,9 +345,20 @@ will produce these examples:
Notice that the built-in command includes a little bit of space between the icons, which is nice.
\subsection{Using \texttt{input} to Keep Your \LaTeX{} GUI Happy}
You'll notice that chapter \ref{dephell} has a couple of code samples that include code that you enter into the terminal. As such, they include a dollar sign (\$) to indicate the prompt.
While it's easy enough to include those in a \texttt{verbatim} environment, I'm using a GUI to create this (Texmaker,\footnote{See \kref{https://www.xm1math.net/texmaker/}{https://www.xm1math.net/texmaker/} for more information.} in fact) and anything in math mode—that is, anything that follows a dollar sign—is highlighted in green until it gets to another dollar sign. If it doesn't, then everything after that dollar sign is green, which kind of defeats the purpose of code highlighting.
The easy way around this is to write up those code samples in an independent \texttt{.tex} file, and then use the \texttt{input} command to add them at the appropriate point in my story. That keeps the source code in my GUI nice and clean looking, and means that the text highlighting actually means something.
Also, there is a similar command (\texttt{include}) that works in a similar way, but adds a pagebreak before and after the included text. This is pretty handy if you are working on a longer document. For more information, see \kref{https://tex.stackexchange.com/questions/246/when-should-i-use-input-vs-include}{https://tex.stackexchange.com/questions/246/when-should-i-use-\\input-vs-include}.
\section{What I Learned About Other Things While Creating This Issue}
\newpage % Use only to keep the afterword together if we end up with orphans
\section{Afterword}
\begin{multicols}{2}