Moved information about code blocks to chapter 8

This commit is contained in:
Kenneth John Odle 2023-10-26 10:09:03 -04:00
parent 3de137d287
commit 683729dcaf

View File

@ -406,22 +406,7 @@ The default for the the \texttt{beamer} class is 11pt, and the other available o
\section{Displaying Code} \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. For more information, see the section ``\nameref{codeexp}'' on page \pageref{codeexp}.
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}.
\chapter{Formatting Paragraphs} \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} \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} \section{Quotations}
\subsection{\texttt{quote}} \subsection{\texttt{quote}}
@ -1066,8 +1069,6 @@ But yeah, you should definitely resize your images before including them in any
\subsection{Miscellaneous Things} \subsection{Miscellaneous Things}
\begin{itemize}[noitemsep] \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 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 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}$ \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}$