From 683729dcafcb69d592386573dbedcfa70b07fb21 Mon Sep 17 00:00:00 2001 From: Kenneth Odle Date: Thu, 26 Oct 2023 10:09:03 -0400 Subject: [PATCH] Moved information about code blocks to chapter 8 --- lbol.tex | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/lbol.tex b/lbol.tex index 0d5fb00..9a5264f 100644 --- a/lbol.tex +++ b/lbol.tex @@ -406,22 +406,7 @@ The default for the the \texttt{beamer} class is 11pt, and the other available o \section{Displaying Code} -You have a few different options when trying to display code. For code which is not executable, you can always format it as typewriter text by wrapping it in \verb+\texttt{code}+. This will, generally, display it in a sans-serif font. - -The problem with this approach is that \LaTeX{} will attempt to execute any commands that you have included in that wrapper. An alternative to this is to use the \verb+\verb+ command. \verb+\verb+ does not need to use curly brackets (i.e., { and }) to contain its argument. Rather, it can contain its argument in between any two symbols which are \textit{not} contained it its argument. Two common options are the pipe symbol (\texttt{|}) and the plus sign (\texttt{+}). For example, to write \verb+verb+ in our document, we could include either \verb+\verb|\verb|+ in our file or \verb|\verb+\verb+|. We could just as easily write this as \verb2\verb4\verb42. In this case, the character ``4'' is used as a delimiter to indicate what should be output directly to the document. - -As usefule as \verb+\verb+ is, it has one drawback: it does not wrap. That is, if whatever you place between the delimiters is longer than the line length, it will simply go off the page. Here's an example: \verb+verb|This text is longer than the line length and will simply go off the page|+. - -The only way around that is to break that text into two part like this: - -\begin{verbatim} -\verb|This text is longer| \\ \verb|than the line length and w -ill simply go off the page| -\end{verbatim} - -It works, but it's clunky. If you change anything around those two \texttt{verb} commands, you'll need to adjust what is contained within each of them. - -For longer code examples, you will need to use the built-in environment \texttt{verbatim}. To gain more control over those environments, you will need to use the package \texttt{fancyvrb}. For more information, see the section ``\nameref{codeexp}'' on page \pageref{codeexp}. +For more information, see the section ``\nameref{codeexp}'' on page \pageref{codeexp}. \chapter{Formatting Paragraphs} @@ -705,6 +690,24 @@ You can replace the bullets with any math symbol availabe in \LaTeX{} like this: \section{Code Blocks}\label{codeexp} +You have a few different options when trying to display code. For code which is not executable, you can always format it as typewriter text by wrapping it in \verb+\texttt{code}+. This will, generally, display it in a sans-serif font. + +The problem with this approach is that \LaTeX{} will attempt to execute any commands that you have included in that wrapper. An alternative to this is to use the \verb+\verb+ command. \verb+\verb+ does not need to use curly brackets (i.e., { and }) to contain its argument. Rather, it can contain its argument in between any two symbols which are \textit{not} contained it its argument. Two common options are the pipe symbol (\texttt{|}) and the plus sign (\texttt{+}). For example, to write \verb+verb+ in our document, we could include either \verb+\verb|\verb|+ in our file or \verb|\verb+\verb+|. We could just as easily write this as \verb2\verb4\verb42. In this case, the character ``4'' is used as a delimiter to indicate what should be output directly to the document. + +As usefule as \verb+\verb+ is, it has one drawback: it does not wrap. That is, if whatever you place between the delimiters is longer than the line length, it will simply go off the page. Here's an example: \verb+verb|This text is longer than the line length and will simply go off the page|+. + +The only way around that is to break that text into two part like this: + +\begin{verbatim} +\verb|This text is longer| \\ \verb|than the line length and w +ill simply go off the page| +\end{verbatim} + +It works, but it's clunky. If you change anything around those two \texttt{verb} commands, you'll need to adjust what is contained within each of them. + +For longer code examples, you will need to use the built-in environment \texttt{verbatim}. To gain more control over those environments, you will need to use the package \texttt{fancyvrb}. Need even more control than the \texttt{fancyvrb} package gives you? Try the \texttt{fvextra} package. (I used it because it very nicely breaks lines inside this environment.) + + \section{Quotations} \subsection{\texttt{quote}} @@ -1066,8 +1069,6 @@ But yeah, you should definitely resize your images before including them in any \subsection{Miscellaneous Things} \begin{itemize}[noitemsep] - \item Need a little bit more control over things in a \texttt{verbatim} environment? Just add the \texttt{fancyvrb} package. - \item Need even more control than the \texttt{fancyvrb} package gives you? Try the \texttt{fvextra} package. (I used it because it very nicely breaks lines inside this environment.) \item Notice that your footnotes are floating above the footer on some pages? Try adding \verb+\usepackage[bottom]{footmisc}+ to your preamble. \item Need to control the gap between the header and the rest of the text? Pass the \verb|headsep| argument to the \texttt{geometry} package and set it equal to the amount of space you need (i.e., \texttt{headsep=12pt}). \item If you want to add a degree symbol to inline text, the simplest way I've found (so far) is to just pop in and out of math mode with this: \verb|$^{\circ}$| which gives you this: $^{\circ}$