Changes to section structures

This commit is contained in:
Kenneth John Odle 2023-07-07 11:33:50 -04:00
parent 5238297376
commit b47edd1dae

145
lbol.tex
View File

@ -147,55 +147,14 @@ Also, if you have access to the source code so you can see how other people have
\chapter{\LaTeX{} Basics}
\section{Files vs. Documents}
In this book, I use the word \textit{file} to refer to the \texttt{.tex} file you are entering text and code into, whereas I use the word \textit{document} to refer to the output you get from processing that file, which is usually a \texttt{.pdf} file/document.
\section{Files}
\LaTeX{} uses plain files with a file extension of \texttt{.tex}. That's it! They contain plain text only and no binary codes or hidden formatting extensions. (Try opening any word processing document in a text editor and see what I mean here.) You can use any text editor, although a GUI is available for most operating systems.
\section{Paragraphs and White Space}
To start a new paragraph, simply skip a line. \LaTeX{} compresses white space, so if you are importing text from a text document, any lines that are adjacent to each other will be in the same paragraph. Additionally, multiple spaces will appear as a single space. For example, this code:
\begin{Verbatim}[frame=lines, numbers=left, label=White Space Example, breaklines=true, framesep=3mm]
This is the first paragraph.
This text, although it is on a separate line, is also part of the first paragraph.
We have skipped a line, so this starts a new paragraph.
This line is also in the second paragraph.
Readers will not see
all of these
spaces.
\end{Verbatim}
\noindent{} renders like this: \\
\hrule
\vspace{2mm}
This is the first paragraph.
This text, although it is on a separate line, is also part of the first paragraph.
We have skipped a line, so this starts a new paragraph.
This line is also in the second paragraph.
Readers will not see
all of these
spaces.
\vspace{2mm}
\hrule
\section{Comments}
Comments are created by adding a \texttt{\%} to the line. Anything beyond the percent sign will be ignored when your document is compiled.
To create multi-line comments, surround those lines with \verb|\iffalse| and \verb|fi|:
\begin{Verbatim}[frame=lines, numbers=left, xleftmargin=5mm, framesep=3mm, breaklines=true, label=Multi-line Comment Block]
\iffalse
These lines will not appear in your published text.
That is because they are surrounded by \iffalse and \fi.
If you didn't use that construction, you would need to put a \% in front of each line.
\fi
\end{Verbatim}
\section{Document Structure}
Every \LaTeX{} document has two parts:
@ -255,14 +214,78 @@ Notice that we have the option \texttt{[Books]} which describes how this chapter
For best results, stick to the hierarchical structure shown above, as this is also how each section will be numbered. See the table of contents of this zine as an example.
\subsection{Environments}
\section{Paragraphs and White Space}
To start a new paragraph, simply skip a line. \LaTeX{} compresses white space, so if you are importing text from a text document, any lines that are adjacent to each other will be in the same paragraph. Additionally, multiple spaces will appear as a single space. For example, this code:
\begin{Verbatim}[frame=lines, numbers=left, label=White Space Example, breaklines=true, framesep=3mm]
This is the first paragraph.
This text, although it is on a separate line, is also part of the first paragraph.
We have skipped a line, so this starts a new paragraph.
This line is also in the second paragraph.
Readers will not see
all of these
spaces.
\end{Verbatim}
\noindent{} renders like this: \\
\hrule
\vspace{2mm}
This is the first paragraph.
This text, although it is on a separate line, is also part of the first paragraph.
We have skipped a line, so this starts a new paragraph.
This line is also in the second paragraph.
Readers will not see
all of these
spaces.
\vspace{2mm}
\hrule
\section{Comments}
Comments are created by adding a \texttt{\%} to the line. Anything beyond the percent sign will be ignored when your document is compiled.
To create multi-line comments, surround those lines with \verb|\iffalse| and \verb|fi|:
\begin{Verbatim}[frame=lines, numbers=left, xleftmargin=5mm, framesep=3mm, breaklines=true, label=Multi-line Comment Block]
\iffalse
These lines will not appear in your published text.
That is because they are surrounded by \iffalse and \fi.
If you didn't use that construction, you would need to put a \% in front of each line.
\fi
\end{Verbatim}
\section{Environments}
\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{<environment>}+ and ends with \verb+\end{<environment>}+. In fact, we've already seen one environment: the \texttt{document} environment, which encompasses our entire document. Here are a few other useful ones:
\chapter{Formatting Words}
\section{Font Variations}
\section{Size Variations}
\section{Displaying Code}
\chapter{Formatting Paragraphs}
\section{Alignment}
\section{Vertical Space}
\section{Horizontal Space}
\section{Line Spacing}
\chapter{Formatting Pages
}
\chapter{List Environments}
\section{Enumerate}
@ -271,7 +294,7 @@ For best results, stick to the hierarchical structure shown above, as this is al
For example, this code:
\begin{Verbatim}[frame=lines, numbers=left, label=Enumerate Example, framesep=3mm]
\begin{Verbatim}[frame=lines, numbers=left, xleftmargin=5mm, label=Enumerate Example, framesep=3mm]
\paragraph{The First Punic War}
\begin{enumerate}[noitemsep]
\item Carthage and Rome
@ -317,7 +340,7 @@ Similar to the \texttt{enumerate} environment, the \texttt{itemize} environment
As an example, we'll use the above example, but in a bulleted list:
\begin{Verbatim}[frame=lines, numbers=left, label=Itemize Example, framesep=3mm]
\begin{Verbatim}[frame=lines, numbers=left, xleftmargin=5mm, label=Itemize Example, framesep=3mm]
\paragraph{The First Punic War}
\begin{itemize}[noitemsep]
\item Carthage and Rome
@ -355,11 +378,13 @@ As an example, we'll use the above example, but in a bulleted list:
\item Events Following the War
\end{itemize}
\end{spacing}
\vspace{2mm} \hrule \vspace{2mm}
\vspace{2mm} \hrule \vspace{4mm}
\noindent{} You can also replace the bullets with any math symbol availabe in \LaTeX{} like this:
\section{Customizing List Environments}
\begin{Verbatim}[frame=lines, numbers=left, label=Bullets Example, framesep=3mm]
You can replace the bullets with any math symbol availabe in \LaTeX{} like this:
\begin{Verbatim}[frame=lines, numbers=left, xleftmargin=5mm, label=Bullets Example, framesep=3mm]
\begin{itemize}[noitemsep]
\item[$\Box$] First item
\item[$\aleph$] Second item
@ -375,23 +400,29 @@ As an example, we'll use the above example, but in a bulleted list:
\item[$\triangle$] Third item
\end{itemize}
\chapter{Special Environments}
\chapter{Math in \LaTeX{}}
\LaTeX{} has a couple of different environments that are useful for typesetting math (\texttt{align} and \texttt{array}, but they get a little beyond what I want to cover here.\footnote{Maybe in a later issue? I can, if there is interest.} In addition, there are other packages (in particular \texttt{amsmath} and \texttt{mathtools}) that greatly extend the power of LaTeX to handle mathematical typesettings, but again, they are beyond the scope of this zine.
\LaTeX{} has a couple of different environments that are useful for typesetting math (\texttt{align} and \texttt{array}, but they get a little beyond what I want to cover here. In addition, there are other packages (in particular \texttt{amsmath} and \texttt{mathtools}) that greatly extend the power of LaTeX to handle mathematical typesettings, but again, they are beyond the scope of this zine.
There are two types of \textit{entry modes} for math in LaTeX. The first is in-line mode, which begins and ends with a dollar sign, and renders the math in the same line of text as the rest of the paragraph.
\section{Math Entry Modes}
There are two types of \textit{entry modes} for math in LaTeX. The first is \textbf{in-line mode}, which begins and ends with a dollar sign, and renders the math in the same line of text as the rest of the paragraph. For example,
\begin{Verbatim}[frame=lines, label=In-Line Math Example, framesep=3mm]
The Pythagorean Theorem is $x^2 + y^2 = z^2$.
\end{Verbatim}
\noindent{} which renders as \\
\noindent{}renders as \\
\noindent{} The Pythagorean Theorem is $x^2 + y^2 = z^2$. \\
This is particularly useful if you want to include Greek characters in your text, because the code for the letter is simply the letter itself. For example, \verb+&\alpha$+ renders as $\alpha$. Need capital letters?\footnote{At least for the characters where the Greek and Latin alphabets \textit{don't} share a common character} Just capitalize it: \verb+$\Gamma$+ $\rightarrow \, \Gamma$.
Math in \LaTeX{} can also be shown in display mode, which renders the mathematics on a separate line. The entry mode begins with \verb+\[+ and ends with \verb+\]+. If we change our example up above to this:
Math in \LaTeX{} can also be shown in \textbf{display mode}, which renders the mathematics on a separate line. The entry mode begins with \verb+\[+ and ends with \verb+\]+. If we change our example up above to this:
\begin{Verbatim}[frame=lines, label=Display Mode Math Example, framesep=3mm]
The Pythagorean Theorem is \[x^2 + y^2 = z^2\]
@ -401,6 +432,10 @@ The Pythagorean Theorem is \[x^2 + y^2 = z^2\]
The Pythagorean Theorem is \[x^2 + y^2 = z^2\]
\section{The \texttt{align} Environment}
\section{The \texttt{array} Environment}
\chapter{Images}