Compare commits

...

4 Commits
main ... letter

130
lbol.tex
View File

@ -18,7 +18,6 @@
\usepackage{wrapfig}
\usepackage{pifont}
\usepackage[nottoc]{tocbibind} % Include bibliography in TOC without numbering
\usepackage{multicol}
\usepackage{wrapfig} % Let's wrap some images
\usepackage{ulem} % Use strikethrough
\usepackage{microtype} % Make things neater. Thanks /u/-LeopardShark-
@ -34,6 +33,8 @@
\usepackage{array} % Add custom widths to tables
\usepackage{nameref} % Use chapter names in references
\usepackage[hidelinks]{hyperref} % Include URLs, but hide the big red box in the pdf.
\usepackage{ninecolors}
\usepackage{ragged2e}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -46,13 +47,16 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Page Set-Up %%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[
paperheight=8.5in,
paperwidth=5.5in,
margin=0.5in,
paperheight=11in,
paperwidth=210mm,
bindingoffset=10mm,
margin=20mm,
heightrounded,
]{geometry}
\addtolength{\topmargin}{0.4in} % Adjust the top margin
\addtolength{\textheight}{-0.5in} % Adjust the bottom margin
\addtolength{\skip\footins}{2pc} % Adjust spacing above footnotes
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Headers %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -87,6 +91,14 @@
\NumTabs{18} % Define 18 tab stops (at 1/4" intervals) [tabto] package
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Newspaper Columns %%%%%%%%%%%%%%%%%%%%%%
\usepackage{multicol}
\setlength{\columnsep}{6mm}
\setlength{\columnseprule}{0.5pt}
\def\columnseprulecolor{\color{azure9}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Macros %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -167,6 +179,8 @@ I may do a second volume of this, or I may simply do a second edition. If I do,
\chapter{Beginnings}
\begin{multicols}{2}
\section{About the Author}
I am neither a mathematician nor a physicist, but I've been fascinated with typography for as long as I can remember.\footnote{I majored in biology and English, so poking around in old books probably had a lot to do with it.} I finally decided to take the plunge and learn \LaTeX{}, but because I have a project-based mind, I needed a project to learn it. I ended up creating a zine about Linux,\footnote{Which you can read about at \kref{https://just13.click/thecodex/}{https://just13.click/thecodex/}} typeset entirely in \LaTeX{}. It's been a fun ongoing project, and I've learned a lot as a result. I finally decided that instead of keeping notes everywhere (mostly in the preambles of the documents I've been working on) I decided to write a little book that recorded what I've learned to use as a reference guide. If I had something like this when I started, things probably would have gone much more smoothly for me. A lot of this material has been previously published in that zine, but there is quite a bit here which is new.
@ -193,8 +207,9 @@ Also, if you have access to the source code so you can see how other people have
These are listed roughly in the order of how often I consult them.
\begin{itemize}[noitemsep]
\RaggedRight % left-align list items
\item \textbf{TeX - LaTeX Stack Exchange}\kref{https://tex.stackexchange.com/}{https://tex.stackexchange.com/}
\item \textbf{Overleaf} — Overleaf is an online \LaTeX{} editor. They have both free and paid options. They have excellent documentation at \kref{https://www.overleaf.com/learn}{https://www.overleaf.com/\\learn} and free templates at \kref{https://www.overleaf.com/latex/templates}{https://www.overleaf.com/latex/templates}
\item \textbf{Overleaf} — Overleaf is an online \LaTeX{} editor. They have both free and paid options. They have excellent documentation at \kref{https://www.overleaf.com/learn}{https://www.overleaf.com/learn} and free templates at \kref{https://www.overleaf.com/latex/templates}{https://www.overleaf.com/lat\\ex/templates}
\item The \textbf{\LaTeX{} Community} has a helpful forum at \kref{https://latex.org/forum/}{https://latex.org/forum/}
\item \textbf{texblog — because \LaTeX{} matters} has a number of useful articles but hasn't been updated in a while. You can read it at \kref{https://texblog.org/}{https://texblog.org/}
\item \textbf{CTAN — Comprehensive \TeX{} Archive Network}\kref{https://ctan.org/}{https://ctan.org/} has lots of good information. This is where I go to find information about packages.
@ -206,8 +221,14 @@ These are listed roughly in the order of how often I consult them.
\item \textbf{\textsc{TUGboat}} — The communications of the \TeX{} Users Group. Again, there is less useful information to a \LaTeX{} novice, but lots of \textit{interesting} information. \kref{https://www.tug.org/TUGboat/}{https://www.tug.org/TUGboat/}
\end{itemize}
\end{multicols}
\chapter{\LaTeX{} Basics}
\begin{multicols}{2}
\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.
@ -280,7 +301,7 @@ The different types of document classes help you build a specific type of docume
caption = {Document Classes in \LaTeX{} },
label = {tbl:docclasses}
]{
% width = {10cm},
width = {\columnwidth},
colspec = { X[1,l] X[4,l] },
hlines = {0.75pt,solid},
vlines = {0.75pt,solid},
@ -355,8 +376,13 @@ If the use of \verb|\iffalse| and \verb|\fi| is not intuitive to you, you can al
Many packages introduce additional environments. For other useful environments that do not require additional packages (but which can easily be expanded upon by other packages), please see the chapter ``\nameref{specenv}'' on page \pageref{specenv} for more information.
\end{multicols}
\chapter{Formatting Words}
\begin{multicols}{2}
\section{Font Variations}
\LaTeX{} has various ways of formatting type:
@ -366,7 +392,7 @@ Many packages introduce additional environments. For other useful environments t
caption = {Font Variations in \LaTeX{} },
label = {tbl:fontvar}
]{
width = {114.3mm},
width = {\columnwidth},
colspec = { X[1,l] X[2,l] X[1,l] },
hlines = {0.75pt,solid},
vline{1,4} = {0.75pt,solid},
@ -425,7 +451,7 @@ You can also change the size of a portion of text locally. These are the default
caption = {Local Size Commands},
label = {tb:localsizecommands}
]{
width = {10cm},
width = {\columnwidth},
colspec = { X[1,c] X[1,c] },
hlines = {0.75pt,solid},
vlines = {0.75pt,solid},
@ -451,9 +477,13 @@ Note that all of these sizes are relative to the base size you set up in your pr
For more information, see the section ``\nameref{codeexp}'' on page \pageref{codeexp}.
\end{multicols}
\chapter{Formatting Paragraphs}
\begin{multicols}{2}
\section{Alignment}
By default, \LaTeX{} fully justifies text. That is, there are equal margins for each line on both the left and the right sides.
@ -531,7 +561,7 @@ There are other ways to insert a vertical small space, using a single command.
label = {tb:vertspacom},
theme = {custom1},
]{
width = {\textwidth},
width = {\columnwidth},
colspec = { X[1,l] X[3,l] },
hlines = {0.75pt,solid},
vline{1,3} = {0.75pt,solid},
@ -570,7 +600,7 @@ Spacing commands can be found in math mode, but most of the ones in the table be
label = {tb:horspacchar},
theme = {custom1},
]{
width = {\textwidth},
width = {\columnwidth},
colspec = { X[2.5,l] X[1,c] X[1,c] },
hlines = {0.5pt,solid},
vline{1,4} = {0.5pt,solid},
@ -616,7 +646,7 @@ Sometimes you need to insert a blank space that is the width of a particular cha
label = {tb:breaks},
theme = {custom1}
]{
width = {\textwidth},
width = {\columnwidth},
colspec = { X[1,l] X[4.5,l] },
hlines = {0.5pt,solid},
vline{1,3} = {0.5pt,solid},
@ -689,9 +719,13 @@ To insert a space that is the same width as your paragraph indentation, you can
\hspace{\parindent}
\end{Verbatim}
\end{multicols}
\chapter{Formatting Pages}
\begin{multicols}{2}
\section{Page Size}
The usual way to define a page size is to pass it as an option to the document class:
@ -707,7 +741,7 @@ The usual way to define a page size is to pass it as an option to the document c
caption = {Default Paper Sizes in \LaTeX{} },
label = {tbl:defpapersizes}
]{
width = {114.3mm},
width = {\columnwidth},
colspec = { X[1.4,l] X[1,c] X[1,c] X[0.6,c] },
hlines = {0.75pt,solid},
vline{1,5} = {0.75pt,solid},
@ -829,9 +863,13 @@ In most document classes, the ``chapter'' pages do not contain page numbers. If
\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}).
\end{itemize}
\end{multicols}
\chapter{Basic List Environments}\label{listenv}
\begin{multicols}{2}
A list is a series of items that are related solely by being a subset of something else. Their relationship may be ordered or unordered. Ordered lists are usually numbered (although other items can be used, such as letters), and unordered lists usually use a symbol, such as a bullet, to denote each items.
Lists in \LaTeX{} can be nested, as the following examples will show.
@ -957,8 +995,13 @@ You can replace the bullets with any math symbol availabe in \LaTeX{} like this:
\end{itemize}
\krule{0mm}{2mm}
\end{multicols}
\chapter{Special Environments}\label{specenv}
\begin{multicols}{2}
\LaTeX{} includes a number of built-in environments which are useful out-of-the-box, but can often be improved upon by adding additional packages. In this chapter, we'll take a look at some of them, and examine how other packages extend their functionality.
\section{Code Blocks}\label{codeexp}
@ -1079,9 +1122,13 @@ produces this example:
\noindent{}I can probably live with that. Probably.
\end{multicols}
\chapter{Tables}
\begin{multicols}{2}
Tables in \LaTeX{} are often confusing to beginners, because there are two environments that are not quite what they seem. The \texttt{tabular} environment is used to create a table, (i.e., it contains \textit{tabular} data) while the \texttt{table} environment is a float that surrounds the table and can contain a caption.
\section{Built-in Table Environments}
@ -1153,7 +1200,7 @@ This is the basic format of a \texttt{longtblr} table that I use on a regular ba
caption = {Sample \texttt{longtblr} Table},
label = {tbl:longtblr}
]{
width = {\textwidth},
width = {\columnwidth},
colspec = { X[1,l] X[1,l] },
hlines = {0.75pt,solid},
vline{1,3} = {0.75pt,solid},
@ -1171,7 +1218,7 @@ Oranges & Grapefruit
caption = {Sample \texttt{longtblr} Table},
label = {tbl:longtblr}
]{
width = {\textwidth},
width = {\columnwidth},
colspec = { X[1,l] X[1,l] },
hlines = {0.75pt,solid},
vline{1,3} = {0.75pt,solid},
@ -1211,7 +1258,7 @@ rowspec = {Q[t], Q[b]}
caption = {\texttt{tabularray} Table with \texttt{rowspec}},
label = {tb:rowspec}
]{
width = {0.6\textwidth},
width = {\columnwidth},
colspec = { X[1,l] X[2,r] },
rowspec = { Q[t,azure9] Q[b,yellow9] },
hlines, vlines
@ -1226,7 +1273,7 @@ This is at the bottom & This is some more incredibly long text that is going to
caption = {\texttt{tabularray} Table with \texttt{rowspec}},
label = {tb:rowspec}
]{
width = {0.6\textwidth},
width = {\columnwidth},
colspec = { X[1,l] X[2,r] },
rowspec = { Q[t] Q[b] },
hlines, vlines
@ -1251,7 +1298,7 @@ If you want to break text in a cell, you can surround the cell contents with cur
caption = {\texttt{tabularray} Table with Multiline Cells},
label = {tb:multiline}
]{
width = {0.6\textwidth},
width = {\columnwidth},
colspec = { X[1,c] X[2,c] },
rows = {5mm, m, rowsep=1.5pt},
hlines, vlines
@ -1266,7 +1313,7 @@ If you want to break text in a cell, you can surround the cell contents with cur
caption = {\texttt{tabularray} Table with Multiline Cells},
label = {tb:multiline}
]{
width = {0.6\textwidth},
width = {\columnwidth},
colspec = { X[1,c] X[2,c] },
rows = {5mm, m, rowsep=1.5pt},
hlines, vlines
@ -1285,7 +1332,7 @@ It is also possible to have cells span multiple rows or columns by using the \Ve
caption = {\texttt{tabularray} Table with Multi Rows and Columns},
label = {tb:multirow}
]{
width = {0.6\textwidth},
width = {\columnwidth},
colspec = { X[1,c] X[2,c] X[1,c] },
rows = {5mm, m, rowsep=1.5pt},
hlines, vlines
@ -1299,7 +1346,7 @@ Fish & Chips & Mushy Peas \\
caption = {\texttt{tabularray} Table with Multi Rows and Columns},
label = {tb:multirow}
]{
width = {0.6\textwidth},
width = {\columnwidth},
colspec = { X[1,c] X[2,c] X[1,c] },
rows = {5mm, m, rowsep=1.5pt},
hlines, vlines
@ -1310,9 +1357,13 @@ Fish & Chips & Mushy Peas \\
The typical way of doing this requires use of the \Verb+\multicolumn+ command (which requires you to load the \texttt{multirow} package), and it requires that omitted cells must be empty. This is not the case with \texttt{tabularray}, however. As you can see from the source code, the words ``Meatballs'' and ``Fish'' have simply been omitted from the resulting table. We are also able to change the horizontal alignment by specifying it after we specify how many rows or columns to span. (I have found that if you do not specify an alignment, you still need to include an empty set of curly brackets or \LaTeX{} will throw out an error.)
\end{multicols}
\chapter{Math in \LaTeX{}}\label{ch:math}
\begin{multicols}{2}
\LaTeX{} has two environments that are useful for typesetting math: (\texttt{align} and \texttt{array}. In addition, there are other packages (in particular \texttt{amsmath} and \texttt{mathtools}) that greatly extend the power of LaTeX to handle mathematical typesetting, but they are beyond the scope of this book.
\section{Math Entry Modes}\label{math-entry-modes}
@ -1348,7 +1399,7 @@ Brackets and parentheses are common in mathematical formulas, so it is natural t
caption = {Brackets and Parentheses in Math Mode},
label = {tb:brackpar}
]{
width = {114.3mm},
width = {\columnwidth},
colspec = { X[2,l] X[2,l] X[1,l] },
hlines = {0.75pt,solid},
vline{1,4} = {0.75pt,solid},
@ -1401,6 +1452,7 @@ You can also control the size of brackets and parentheses explicitly:
caption = {Explicit Size Commands},
label = {tb:expsizcom}
]{
width = {\columnwidth},
colspec = { X[7,l] X[2,c] },
hlines = {0.75pt,solid},
vlines = {0.75pt,solid},
@ -1521,9 +1573,13 @@ The following array shows the difference between ordinary and ``nice'' fractions
\end{array}\]
\end{multicols}
\chapter{Images}\label{ch:images}
\begin{multicols}{2}
You can use images in \LaTeX{}, but it requires the \texttt{graphicx} package, as this is not something that \LaTeX{} can handle on its own. You will need to include this line in your preamble:
\begin{Verbatim}[]
@ -1631,7 +1687,7 @@ A couple of things to note here: First, while the actual image is not very large
caption = {\texttt{figure} Positioning Parameters},
label = {tb:figpospar}
]{
width = {\textwidth},
width = {\columnwidth},
colspec = { X[1,l] X[6,l] },
hlines = {0.75pt,solid},
vline{1,3} = {0.75pt,solid},
@ -1706,7 +1762,7 @@ If the \texttt{wrapfigure} package is not working for you, there is also the muc
caption = {\texttt{wrapfig} Position Parameters},
label = {tb:wrapfigpospar}
]{
width = {\textwidth},
width = {\columnwidth},
colspec = { X[1,c] X[1,c] X[7,l] },
hlines = {0.75pt,solid},
vline{1,3,4} = {0.75pt,solid},
@ -1720,9 +1776,13 @@ o & O & Outside edge of a \texttt{twoside} document
\noindent{}Use the lowercase version of the parameter when you want to place the figure at the same point in your document that it is in your file. Use the uppercase version when you want to let it float.
\end{multicols}
\chapter{References}\label{ch:referencing}
\begin{multicols}{2}
\section{Internal (Cross) References}
To refer to something somewhere else in your document, you first have to label it using the \verb+\label{}+ command:\label{example1}
@ -1771,9 +1831,13 @@ bibtex build/lbol
\paragraph{Note:} If the bibliography tools that are built into \LaTeX{} seem like overkill to you, consider whether or not your document actually \textit{needs} a bibliography. I could have done it for this book, but it made much more sense to me to simply add links in footnotes. If you are writing for a publication, or writing a thesis or dissertation, you will need to follow the style guide provide. But in most other circumstances, the choice will be yours.
\end{multicols}
\chapter{Macros}
\begin{multicols}{2}
\section{New Commands}
If you often use a group of commands together, you can group them into a single command by using the \verb+\newcommand[]{}+ command in the preamble.
@ -1804,8 +1868,13 @@ and to use it, you would enter
This means less typing, but you are always restricted to using the same units.
\end{multicols}
\chapter{Installation}
\begin{multicols}{2}
\section{Installing \LaTeX{}}
Nope. I'm not going to discuss this subject, because this would make this a very long book, and it would also make it a quickly outdated and inaccurate book. Your best approach would be to do a web search for your operating system + ``\texttt{install latex}''. If you want a GUI (and who doesn't?), search for your operating system + ``\texttt{install latex gui}''.
@ -1886,9 +1955,13 @@ $ cp * ~/texmf
$ texhash ~/texmf
\end{verbatim}
\end{multicols}
\chapter{Miscellaneous}
\begin{multicols}{2}
\section{Special Characters in \LaTeX{}}
There are ten characters that have special meaning in \LaTeX{}. To typeset:
@ -1920,7 +1993,7 @@ You can also dip in and out of math mode to get these characters, but the font w
caption = {\LaTeX{} Units and Lengths},
label = {tb:units}
]{
width = {0.8\textwidth},
width = {\columnwidth},
colspec = { X[1,l] X[3,l] },
hlines = {0.75pt,solid},
vline{1,3} = {0.75pt,solid},
@ -1954,7 +2027,7 @@ For additional information, consult the \textit{very} extensive ``Comprehensive
label = {tb:miscsym},
theme = {custom1}
]{
width = {\textwidth},
width = {\columnwidth},
colspec = {
X[1.6,l]
X[0.7,c]
@ -2001,11 +2074,13 @@ Variable sized proportional to & $\varpropto$ & & \Verb +$\varpropto$+ \\
Wedge & $\wedge$ & & \Verb+$\wedge$+ \\
\end{longtblr}
\end{multicols}
\chapter{Troubleshooting}
\begin{multicols}{2}
\section{Minimal Working Examples}
In particular with \LaTeX{}, it can help if you create an MWE (minimal working example) when working with new things, to rule out interference from other bits of code.
@ -2060,10 +2135,13 @@ In general, a good question has three parts:
\bigskip
\end{multicols}
\begin{center}
\Pisymbol{dingbat}{69}\Pisymbol{dingbat}{70}\linebreak
{\large \textsc{Fin}}\linebreak
\Pisymbol{dingbat}{72}\Pisymbol{dingbat}{71}
\end{center}
\end{document}