Added information about inline code examples

This commit is contained in:
Kenneth John Odle 2023-07-10 18:41:56 -04:00
parent e909a27e91
commit 09932d5f3f

View File

@ -305,9 +305,9 @@ If you didn't use that construction, you would need to put a \% in front of each
\noindent{} This is where \LaTeX{} shows its power, as environments are used to to take care of typesetting tasks. Every environment begins with \verb+\begin{<environ+ \verb+ment>}+ and ends with \verb+\end{<environment>}+. In fact, we've already seen one environment: the \texttt{document} environment, which encompasses our entire document.
Many packages introduce additional environments. Here are a few useful ones that do not require additional packages:
\texttt{enumerate} and \texttt{itemize} are used for creating lists. See the chapter ``\nameref{listenv}'' on page \pageref{listenv} for more information.
\texttt{enumerate} and \texttt{itemize} are used for creating lists. See the chapter ``\nameref{listenv}'' on \pageref{listenv} for more information.
Many packages introduce additional environments. For other useful environments that do not require additional packages, please see the chapter ``\nameref{specenv}'' on page \pageref{specenv} for more information.
\chapter{Formatting Words}
@ -367,6 +367,23 @@ 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}.
\chapter{Formatting Paragraphs}
@ -570,7 +587,17 @@ You can replace the bullets with any math symbol availabe in \LaTeX{} like this:
\end{itemize}
\chapter{Special Environments}
\chapter{Special Environments}\label{specenv}
\section{Code Blocks}\label{codeexp}
\section{Quotations}
\subsection{quote}
\subsection{quotation}
\subsection{Customizing Quotations with the \texttt{quoting} Package}
\chapter{Math in \LaTeX{}}
@ -644,6 +671,7 @@ and to use it, you would enter
This means less typing, but you are always restricted to using the same units.
\chapter{Miscellaneous}
\section{What I Learned About \LaTeX{} While Creating This Issue}