diff --git a/lbol.tex b/lbol.tex index dc80d15..1f7072f 100644 --- a/lbol.tex +++ b/lbol.tex @@ -791,13 +791,13 @@ If you still need even more options, you can try the \texttt{listings} package, \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. 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 book. \section{Math Entry Modes}\label{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] +\begin{Verbatim}[frame=lines, label=\fbox{In-Line Math Example}, framesep=3mm] The Pythagorean Theorem is $x^2 + y^2 = z^2$. \end{Verbatim} @@ -809,7 +809,7 @@ This is particularly useful if you want to include Greek characters in your text 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] +\begin{Verbatim}[frame=lines, label=\fbox{Display Mode Math Example}, framesep=3mm] The Pythagorean Theorem is \[x^2 + y^2 = z^2\] \end{Verbatim} @@ -915,7 +915,8 @@ Break your lines with \verb+\\+ and use \& to show where the equations should al \begin{Verbatim}[frame=lines, numbers=left, xleftmargin=5mm, framesep=3mm, breaklines=true, label=\fbox{align Example}] \begin{align} a_1 & = b_1+c_1\\ -a_2 & = b_2+c_2-d_2+e_2 +a_2 & = b_2+c_2-d_2+e_2\\ +a_2+d_2-e_2 & = b_2+c_2 \end{align} \begin{align*} @@ -956,25 +957,25 @@ You can typeset matrices and other similar objects using an \texttt{array} envir \item You must declare the number and alignment of the columns by using something like this:\vspace{0.5em} \\ \vspace{0.5em} \verb+\begin{array}{crl}+ \\ In this instance, we are declaring one centered column, one right-aligned column, and one left-aligned column. \end{itemize} -In the example below, I've chose animal names to make the column alignment more explicit. +In the example below, I've chosen animal names to make the column alignment more explicit. \begin{Verbatim}[frame=lines, numbers=left, xleftmargin=5mm, framesep=3mm, breaklines=true, label=\fbox{array Example}] -\[ +\[ % Begin math environment Zoo~animals = \left\{ \begin{array}{crl} lion & hippopotamus & gnu \\ elephant & zebra & kangaroo \\ bear & camel & naked~mole~rats \end{array}\right\} -\] +\] % End math environment \end{Verbatim} -\[ +\[ % Begin math environment Zoo~animals = \left\{ \begin{array}{crl} lion & hippopotamus & gnu \\ elephant & zebra & kangaroo \\ bear & camel & naked~mole~rats \end{array}\right\} -\] +\] % End math environment \paragraph{Note:} Because the \texttt{array} environment is designed for math applications, rather than a text application like our example, I had to use a $\sim$ to add the spaces in ``Zoo animals'' and ``naked mole rats''. @@ -1022,7 +1023,7 @@ Internal references (i.e., cross-references) are explained in section \ref{examp \krule{8pt}{8pt} -jI very rarely use cross references and so I am not terribly adept at their many uses. They are a powerful feature of \LaTeX{} though, so if you are interested, I urge you to visit \kref{https://en.wikibooks.org/wiki/LaTeX/Labels_and_Cross-referencing}{https://en.wikibooks.org/wiki/LaTeX/Labels\_and\_Cross-referencing} for more detailed information. +I very rarely use cross references and so I am not terribly adept at their many uses. They are a powerful feature of \LaTeX{} though, so if you are interested, I urge you to visit \kref{https://en.wikibooks.org/wiki/LaTeX/Labels_and_Cross-referencing}{https://en.wikibooks.org/wiki/LaTeX/Labels\_and\_Cross-referencing} for more detailed information. Keep in mind that you will need to compile your document \textbf{twice}. The first time \LaTeX{} will figure out which page each \texttt{label} is on. The second time, it will plug those pages numbers into the \texttt{ref} and \texttt{pageref} commands. @@ -1036,20 +1037,22 @@ The advantage of using \texttt{BibTex} is that it is much more powerful, and if Describing either system is beyond the scope of this booklet. However, Wikibooks has an excellent tutorial at \kref{https://en.wikibooks.org/wiki/LaTeX/Bibliography_Management}{https://en.wikibooks.org/wiki/LaTeX/Biblio\\graphy\_Management}. -Keep in mind that the command you will need to build that bibliography is\footnote{I am adding this here for my own reference more than anything else.} +\bigskip + +\noindent{}Keep in mind that the command you will need to build that bibliography is\footnote{I am adding this here for my own reference more than anything else.} \begin{verbatim} bibtex build/lbol \end{verbatim} -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 booklet, but it made much more sense to me to simply add links in footnotes. +\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. \chapter{Macros} \section{New Commands} -If there is a group of commands that you often use together, you can group them into a single command by using the \verb+\newcommand[]{}+ command in the preamble. +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. The square brackets contains a number that indicates the number of variables you are going to pass to the new command. The curved brackets contain the new command. For example, this code in the preamble: @@ -1057,7 +1060,7 @@ The square brackets contains a number that indicates the number of variables you \newcommand\krule[2]{\vspace{#1}\hrule\vspace{#2}} \end{verbatim} -\noindent{}defines a new rule ``krule'' that places a horizontal line (\verb+\hrule+) with a vertical space (\verb+\vspace+) above and below it. It contains two variables, one for the height of the first vertical space and one for the height of the second vertical space. In practice, this rule would be used like this: +\noindent{}defines a new command ``krule'' that places a horizontal line (\verb+\hrule+) with a vertical space (\verb+\vspace+) above and below it. It contains two variables, one for the height of the first vertical space and one for the height of the second vertical space. In practice, this rule would be used like this: \begin{verbatim} \krule{12pt}{6pt} @@ -1081,7 +1084,7 @@ This means less typing, but you are always restricted to using the same units. \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 quickly 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}''. +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}''. \section{Installing \LaTeX{} Packages on Ubuntu} @@ -1093,7 +1096,7 @@ Every once in a while I run into a package that I want to use with LaTeX that is \textit{Later} became \textit{today} when I wanted to use the \texttt{harmony} package to produce some music symbols but couldn't, because it wasn't installed on my system. It took some doing, but I finally figured it out. Here's what I did: -First, I downloaded the \texttt{harmony} packaged from \href{https://www.ctan.org/pkg/harmony}{\texttt{https://www.ctan.org \\ /pkg/harmony}} and unpacked the archive. That was easy enough. +First, I downloaded the \texttt{harmony} package from \href{https://www.ctan.org/pkg/harmony}{\texttt{https://www.ctan.org \\ /pkg/harmony}} and unpacked the archive. That was easy enough. Next, I had to figure out where to put it. I ran this command: @@ -1107,7 +1110,7 @@ which gave me this location: /usr/local/share/texmf \end{verbatim} -Following the directions I found at \href{https://jvgomez.github.io/pages/manually-install-latex-packages-in-ubuntu.html}{\texttt{https://jvgomez.github.io/page \\ s/manually-install-latex-packages-in-ubuntu.html}} I entered that directory using \texttt{sudo} and created the following directory structure: +Following the directions I found at \href{https://jvgomez.github.io/pages/manually-install-latex-packages-in-ubuntu.html}{\texttt{https://jvgomez.github.io/pages/manu\\ally-install-latex-packages-in-ubuntu.html}} I entered that directory using \texttt{sudo} and created the following directory structure: \begin{verbatim} /usr/local/share/texmf/tex/latex/harmony @@ -1125,7 +1128,7 @@ I then had to update the search path to make my system aware of the new package: $ sudo mktexlsr \end{verbatim} -This should have been the end of it, but the \texttt{harmony} packages requires a certain set of fonts to do its work. After a bit of searching, I found them at \href{https://ctan.org/tex-archive/fonts/musixtex-fonts}{\texttt{https://ctan.org/tex-archive/fonts/musixtex-fonts}}. +This should have been the end of it, but the \texttt{harmony} package requires a certain set of fonts to do its work. After a bit of searching, I found them at \href{https://ctan.org/tex-archive/fonts/musixtex-fonts}{\texttt{https://ctan.org/tex-archive/fonts/musixtex-fonts}}. Fortunately, that package had a pdf document that described how to install the fonts. I started by copying the ``fonts'' folder over the \texttt{texmf} directory: