Copied over codex #3
This commit is contained in:
parent
f0ba986431
commit
15faa2d664
595
lbol.tex
Normal file
595
lbol.tex
Normal file
@ -0,0 +1,595 @@
|
||||
\documentclass[twoside]{report}
|
||||
\usepackage[utf8]{inputenc}
|
||||
\usepackage{amsmath}
|
||||
\usepackage{amssymb}
|
||||
\usepackage{makeidx}
|
||||
%\makeindex
|
||||
\usepackage{graphicx}
|
||||
\usepackage{kpfonts}
|
||||
\usepackage{float}
|
||||
\raggedbottom
|
||||
|
||||
% Where are our images?
|
||||
\graphicspath{{images/}}
|
||||
|
||||
% Let's set this as a half-letter sized sheet
|
||||
% https://tex.stackexchange.com/questions/338789/how-to-set-paper-size-to-half-letter-5-5-x-8-5-in-in-amsbook
|
||||
\usepackage{geometry}
|
||||
\geometry{
|
||||
paperheight=8.5in,
|
||||
paperwidth=5.5in,
|
||||
% heightrounded,
|
||||
margin=0.5in
|
||||
}
|
||||
|
||||
% Adjust the top and bottom margins
|
||||
% http://kb.mit.edu/confluence/pages/viewpage.action?pageId=3907057
|
||||
\addtolength{\topmargin}{0.4in}
|
||||
\addtolength{\textheight}{-0.5in}
|
||||
|
||||
% Set the header style
|
||||
% https://www.overleaf.com/learn/latex/Headers_and_footers
|
||||
\usepackage{fancyhdr}
|
||||
\pagestyle{fancy}
|
||||
\fancyhf{}
|
||||
\fancyhead[LE,RO]{\thepage}
|
||||
\fancyhead[RE,LO]{\textit{the little book of \LaTeX{}}}
|
||||
% \cfoot{Page \thepage}
|
||||
%\renewcommand{\footrulewidth}{0.5pt}
|
||||
|
||||
% Include sections and subsections in the TOC
|
||||
% https://latex-tutorial.com/tutorials/table-of-contents/
|
||||
% \setcounter{tocdepth}{2}
|
||||
|
||||
% We will probably want some two- or three-column sections
|
||||
\usepackage{multicol}
|
||||
|
||||
% Stop resetting the footnote count after each chapter
|
||||
\counterwithout{footnote}{chapter}
|
||||
|
||||
% Let's wrap some images
|
||||
% https://en.wikibooks.org/wiki/LaTeX/Floats,_Figures_and_Captions
|
||||
\usepackage{wrapfig}
|
||||
|
||||
% Use tab stops when we need to (especially in footnotes)
|
||||
\usepackage{tabto}
|
||||
% Define 18 tab stops (at 1/4" intervals)
|
||||
\NumTabs{18}
|
||||
|
||||
% Use strikethrough
|
||||
\usepackage{ulem}
|
||||
|
||||
% Style a blockquote
|
||||
% 2021.11.22 -- Not really sure I need this anymore.
|
||||
% See https://tex.stackexchange.com/questions/325695/how-to-style-blockquote
|
||||
% \usepackage{etoolbox}
|
||||
% \usepackage{setspace} % for \onehalfspacing and \singlespacing macros
|
||||
% See also https://www.overleaf.com/learn/latex/Typesetting_quotations
|
||||
|
||||
% Make things neater. Thanks /u/-LeopardShark-
|
||||
\usepackage{microtype}
|
||||
|
||||
% Put a horizontal rule in an align environment
|
||||
% This is just for the page numbers/scanning picture in issue #2
|
||||
% Keep this in case it becomes useful later
|
||||
% \usepackage{booktabs}
|
||||
|
||||
% Use line numbers with code samples
|
||||
% \begin{Verbatim}...\end{Verbatim} <-- Note the capitalization!
|
||||
\usepackage{fancyvrb}
|
||||
% Break lines inside this environment:
|
||||
\usepackage{fvextra}
|
||||
|
||||
% Control spacing in lists
|
||||
\usepackage{enumitem}
|
||||
|
||||
\raggedbottom
|
||||
|
||||
% Pictures!
|
||||
\usepackage{tikz}
|
||||
|
||||
% Cancel units in math mode!
|
||||
\usepackage{cancel}
|
||||
|
||||
% Better control over line-spacing
|
||||
\usepackage{setspace}
|
||||
|
||||
% Use nice fractions
|
||||
\usepackage{nicefrac}
|
||||
|
||||
% Keep the footnotes at the bottom of the page
|
||||
\usepackage[bottom]{footmisc}
|
||||
|
||||
% Just for issue #003:
|
||||
\usepackage{mathtools}
|
||||
\usepackage{wasysym}
|
||||
\usepackage{harmony}
|
||||
\usepackage{musixtex}
|
||||
\usepackage[generate,ps2eps]{abc}
|
||||
\usepackage{mathptmx} %Necessary for abc package to work?
|
||||
|
||||
% Do we want to include URLs?
|
||||
% Yes, but we also want to hide the big red box it puts around them in the pdf. Thanks /u/0b0101011001001011
|
||||
\usepackage[hidelinks]{hyperref}
|
||||
|
||||
%%%% Document Information %%%%%
|
||||
\author{{\small Kenneth John Odle}}
|
||||
\title{
|
||||
{\Huge the little book of \LaTeX{}} \\
|
||||
\vspace{3em}
|
||||
{\normalsize A Partial Guide \\
|
||||
\bigskip
|
||||
Typeset in \LaTeX{} (of course!)}
|
||||
}
|
||||
\date{{\small 2023}}
|
||||
|
||||
\begin{document}
|
||||
\maketitle
|
||||
|
||||
\section*{}
|
||||
All contents \copyright2023 Kenneth John Odle
|
||||
|
||||
FYI, this is made in \LaTeX \,using the report document class. It then gets exported to a letterhalf (5.5 in x 8.5 in) pdf, which then gets made into a booklet using PDF Booklet (\href{https://pdfbooklet.sourceforge.io/wordpress/}{\texttt{https://pdfbooklet.sourceforge.io/wordpress/}}).
|
||||
|
||||
|
||||
|
||||
\tableofcontents
|
||||
|
||||
|
||||
|
||||
\chapter{Beginnings}
|
||||
|
||||
I realized that even though I've mentioned that the reason I created this zine was to learn how to use LaTeX, and even though I've mentioned the things I've learned about LaTeX while writing it, I've never really provided a basic guide for others who might be interested in learning \LaTeX{}. So here goes…
|
||||
|
||||
\paragraph{A Caveat} First, I am far from an expert in these matters. What follows is pretty much a listing of what I've gleaned from hours spent searching the internet and trying things out myself.
|
||||
|
||||
Second, some things will look differently and behave differently for you depending on variables such as the document class (see below) you are using and which other packages you have loaded. My rules for learning things like this are always:
|
||||
|
||||
\begin{enumerate}[noitemsep]
|
||||
\item Don't compare yourself to others. Your mileage can—and will—vary, because people learn things at different rates and in different orders.
|
||||
\item Practice doesn't make perfect, but it does make things less shitty.
|
||||
\item A willingness to experiment is your best guide.
|
||||
\end{enumerate}
|
||||
|
||||
Also, if you have access to the source code so you can see how other people have done things, so much the better. (You can view the source code for this zine at \href{https://git.kjodle.net/kjodle/the-codex}{\texttt{https://git.kjodle.net/kjodle/the-codex}}.) 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.
|
||||
|
||||
\chapter{Basics}
|
||||
|
||||
\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{Document Structure}
|
||||
|
||||
Every \LaTeX{} document has two parts:
|
||||
|
||||
\begin{enumerate}[noitemsep]
|
||||
\item A \textbf{preamble} in which you declare the class and add any packages you may need, as well as set other variables such as the title and author.
|
||||
\item A \textbf{document} environment which contains the actual text of the document.
|
||||
\end{enumerate}
|
||||
|
||||
If you are familiar with \texttt{html}, these correspond roughly to the \texttt{<head>} and \texttt{<body>} elements.
|
||||
|
||||
\subsection{The Preamble}
|
||||
|
||||
Within the preamble, you can declare the document's \textit{class}, which is a description of the type of document you are creating. The most common classes are \texttt{article}, \texttt{report}, \texttt{book}, \texttt{memoir}, and \texttt{beamer} (for presentations). A typical class declaration looks like:
|
||||
|
||||
\begin{Verbatim}
|
||||
\documentclass[twoside]{report}
|
||||
\end{Verbatim}
|
||||
|
||||
The class is described between curly brackets, but you can also include several \textit{options} in square brackets. The above document class is a two-sided report. ``Two-sided'' means that it may have different margins, headers, and footers on right and left handed pages. Other options, such as paper size and font size, are available.
|
||||
|
||||
\subsection{The \texttt{document} Environment}
|
||||
|
||||
Anything not in the preamble goes in the \texttt{document} environment, which looks like this:
|
||||
|
||||
\begin{Verbatim}[commandchars=\+\(\)]
|
||||
\begin{document}
|
||||
+textit(…your stuff…)
|
||||
\end{document}
|
||||
\end{Verbatim}
|
||||
|
||||
\subsection{Document Sections}
|
||||
|
||||
Each \LaTeX{} document can be divided into a hierarchical structure consisting of the following sections:
|
||||
|
||||
\begin{verbatim}
|
||||
Part
|
||||
Chapter
|
||||
Section
|
||||
Subsection
|
||||
Subsubsection
|
||||
Paragraph
|
||||
Subparagraph
|
||||
\end{verbatim}
|
||||
|
||||
\noindent{} To add one, use:
|
||||
|
||||
\begin{verbatim}
|
||||
\chapter[Books]{Books I Have Read}
|
||||
\end{verbatim}
|
||||
|
||||
Notice that we have the option \texttt{[Books]} which describes how this chapter will appear in the table of contents. To prevent a section from being numbered or appearing in the table of contents, replace this entire option with an asterisk:
|
||||
|
||||
\begin{verbatim}
|
||||
\chapter*{Books I Have Read}
|
||||
\end{verbatim}
|
||||
|
||||
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.\footnote{I am a stickler about hierarchical structures because they represent logical, organized thinking about a subject. Not all subjects lend themselves to a perfectly hierarchical information structure, but we should always strive to be less disorganized (i.e., less shitty).}
|
||||
|
||||
\subsection{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:
|
||||
|
||||
\subsubsection{Enumerate}
|
||||
|
||||
\texttt{enumerate} is used to create numbered lists. They can be nested to create an outline. To prevent \LaTeX{} from adding a lot of space between the item numbers, add the \texttt{enumitem} package pass the \texttt{[noitemsep]} to the environment.
|
||||
|
||||
For example, this code:
|
||||
|
||||
\begin{Verbatim}[frame=lines, numbers=left, label=Enumerate Example, framesep=3mm]
|
||||
\paragraph{The First Punic War}
|
||||
\begin{enumerate}[noitemsep]
|
||||
\item Carthage and Rome
|
||||
\begin{enumerate}
|
||||
\item Beginning of Foreign Conquests
|
||||
\item The Origin of Carthage
|
||||
\item Government of Carthage
|
||||
\end{enumerate}
|
||||
\item Operations in the First Punic War
|
||||
\begin{enumerate}
|
||||
\item Outbreak of the War in Sicily
|
||||
\item Capture of Messana and Agrigentum
|
||||
\end{enumerate}
|
||||
\item Events Following the War
|
||||
\end{enumerate}
|
||||
\end{Verbatim}
|
||||
|
||||
\noindent{} produces this output:
|
||||
|
||||
\vspace{2mm} \hrule \vspace{2mm}
|
||||
\paragraph{The First Punic War}
|
||||
\begin{spacing}{0.7}
|
||||
\begin{enumerate}[noitemsep]
|
||||
\item Carthage and Rome
|
||||
\begin{enumerate}
|
||||
\item Beginning of Foreign Conquests
|
||||
\item The Origin of Carthage
|
||||
\item Government of Carthage
|
||||
\end{enumerate}
|
||||
\item Operations in the First Punic War
|
||||
\begin{enumerate}
|
||||
\item Outbreak of the War in Sicily
|
||||
\item Capture of Messana and Agrigentum
|
||||
\end{enumerate}
|
||||
\item Events Following the War
|
||||
\end{enumerate}
|
||||
\end{spacing}
|
||||
\vspace{2mm} \hrule
|
||||
|
||||
\subsubsection{Itemize}
|
||||
|
||||
Similar to the \texttt{enumerate} environment, the \texttt{itemize} environment creates bulleted lists, which can also be indented.
|
||||
|
||||
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]
|
||||
\paragraph{The First Punic War}
|
||||
\begin{itemize}[noitemsep]
|
||||
\item Carthage and Rome
|
||||
\begin{itemize}
|
||||
\item Beginning of Foreign Conquests
|
||||
\item The Origin of Carthage
|
||||
\item Government of Carthage
|
||||
\end{itemize}
|
||||
\item Operations in the First Punic War
|
||||
\begin{itemize}
|
||||
\item Outbreak of the War in Sicily
|
||||
\item Capture of Messana and Agrigentum
|
||||
\end{itemize}
|
||||
\item Events Following the War
|
||||
\end{itemize}
|
||||
\end{Verbatim}
|
||||
|
||||
\noindent{} produces this output:
|
||||
|
||||
\vspace{2mm} \hrule \vspace{2mm}
|
||||
\paragraph{The First Punic War}
|
||||
\begin{spacing}{0.7}
|
||||
\begin{itemize}[noitemsep]
|
||||
\item Carthage and Rome
|
||||
\begin{itemize}
|
||||
\item Beginning of Foreign Conquests
|
||||
\item The Origin of Carthage
|
||||
\item Government of Carthage
|
||||
\end{itemize}
|
||||
\item Operations in the First Punic War
|
||||
\begin{itemize}
|
||||
\item Outbreak of the War in Sicily
|
||||
\item Capture of Messana and Agrigentum
|
||||
\end{itemize}
|
||||
\item Events Following the War
|
||||
\end{itemize}
|
||||
\end{spacing}
|
||||
\vspace{2mm} \hrule \vspace{2mm}
|
||||
|
||||
\noindent{} You can also replace the bullets with any math symbol availabe in \LaTeX{} like this:
|
||||
|
||||
\begin{Verbatim}[frame=lines, numbers=left, label=Bullets Example, framesep=3mm]
|
||||
\begin{itemize}[noitemsep]
|
||||
\item[$\Box$] First item
|
||||
\item[$\aleph$] Second item
|
||||
\item[$\triangle$] Third item
|
||||
\end{itemize}
|
||||
\end{Verbatim}
|
||||
|
||||
\noindent{} which produces this output:
|
||||
|
||||
\begin{itemize}[noitemsep]
|
||||
\item[$\Box$] First item
|
||||
\item[$\aleph$] Second item
|
||||
\item[$\triangle$] Third item
|
||||
\end{itemize}
|
||||
|
||||
\subsection{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.
|
||||
|
||||
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.
|
||||
|
||||
\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{} 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:
|
||||
|
||||
\begin{Verbatim}[frame=lines, label=Display Mode Math Example, framesep=3mm]
|
||||
The Pythagorean Theorem is \[x^2 + y^2 = z^2\]
|
||||
\end{Verbatim}
|
||||
|
||||
\noindent{} we get this: \\
|
||||
|
||||
The Pythagorean Theorem is \[x^2 + y^2 = z^2\]
|
||||
|
||||
|
||||
|
||||
|
||||
\paragraph{Installing \LaTeX{}} I realize that I haven't talked about how to install LaTeX, but that really depends on what system you are running. Trying to include every possible operating system could easily turn this from a zine into a book.\footnote{And a quickly outdated and inaccurate book, at that.} The best approach is to search for your operating system + ``install latex''.
|
||||
|
||||
|
||||
|
||||
|
||||
\chapter{Coda}
|
||||
|
||||
\section{What I Learned About \LaTeX{} While Creating This Issue}
|
||||
|
||||
\subsection{Image Sizes}
|
||||
|
||||
A few people have noted on Reddit that the images I include are far larger than I need them to be. This is true. I had a lot of things like this in issue \#2:
|
||||
|
||||
\begin{verbatim}
|
||||
\includegraphics[scale=0.5]{paper_cutter}
|
||||
\end{verbatim}
|
||||
|
||||
\noindent{}And it seems that the worst offender was this line:
|
||||
|
||||
\begin{verbatim}
|
||||
\includegraphics[scale=0.13]{c128}
|
||||
\end{verbatim}
|
||||
|
||||
This is a problem because that \texttt{paper\_cutter.jpg} image is 136kb in size and that \texttt{c128.jpg} image is 2.3 mb in size. Because these get included in \LaTeX{}, which then handles the scaling, the resulting pdf file is rather bloated, which is the exact opposite of what you want when you are distributing something via the internet.
|
||||
|
||||
Because I am scaling the paper cutter image by 0.5, the resulting file size should be about a fourth of that, or 34 kb. And because I'm scaling the c128 image by 0.13, the corresponding file size should be about 0.0169 of that, or roughly 40 kb in size. That's a huge difference.\footnote{Roughly, the size of your file should be approximately reduced by the square of your scaling factor. But these are jpg files, which are lossy, so it's never exactly that amount.}
|
||||
|
||||
The problem is that I always envisioned this zine as being a physical object, not a digital one. I only uploaded it to my git repository because this is a learning project for me, and I wanted to keep track of any changes I made.
|
||||
|
||||
But yeah, you should definitely resize your images before including them in any document you intend to distribute digitally. (Thank you, GIMP.) You'll notice that the image of the VT100 terminal on page 5 clocks in at a very sensible 79 kb. That's more like it.
|
||||
|
||||
\subsection{Installing \LaTeX{} Packages on Ubuntu}
|
||||
|
||||
\subsubsection{Method 1}
|
||||
|
||||
Every once in a while I run into a package that I want to use with LaTeX that is not installed on my system. Alas, there is no easy way to do this, at least that I found. \textit{Later}, I always thought. I'll figure that out later.
|
||||
|
||||
\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.
|
||||
|
||||
Next, I had to figure out where to put it. I ran this command:
|
||||
|
||||
\begin{verbatim}
|
||||
$ kpsewhich -var-value TEXMFLOCAL
|
||||
\end{verbatim}
|
||||
|
||||
which gave me this location:
|
||||
|
||||
\begin{verbatim}
|
||||
/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:
|
||||
|
||||
\begin{verbatim}
|
||||
/usr/local/share/texmf/tex/latex/harmony
|
||||
\end{verbatim}
|
||||
|
||||
I then copied my files over from the unpacked \texttt{harmony} files:
|
||||
|
||||
\begin{verbatim}
|
||||
$ sudo cp * /usr/local/share/texmf/tex/latex/harmony
|
||||
\end{verbatim}
|
||||
|
||||
I then had to update the search path to make my system aware of the new package:
|
||||
|
||||
\begin{verbatim}
|
||||
$ 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}}.
|
||||
|
||||
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:
|
||||
|
||||
\begin{verbatim}
|
||||
$ cp fonts /usr/local/share/texmf
|
||||
\end{verbatim}
|
||||
|
||||
And then I updated the search path and then the font-map files with these commands:
|
||||
|
||||
\begin{verbatim}
|
||||
$ sudo mktexlsr
|
||||
$ sudo udpmap-user --enable MixedMap musix.map
|
||||
\end{verbatim}
|
||||
|
||||
Like I've said elsewhere, I'm running a recently updated Ubuntu 22.04 system, and this worked for me. It may work for you, it may not. I can't even guarantee that it will work for me next time. (I suspect having a generic folder name like ``fonts'' may cause me issues down the road if I ever want to install some other LaTeX fonts.) But if I got it to work once, I'm pretty sure I can get it to work again. We shall see.
|
||||
|
||||
\subsubsection{Method 2}
|
||||
|
||||
A perhaps easier (and certainly more \textit{portable}) way of installing LaTeX packages is to add them to a local directory along the lines of:
|
||||
|
||||
\begin{verbatim}
|
||||
/home/user/texmf
|
||||
\end{verbatim}
|
||||
|
||||
This is how I installed the \textit{musixtex} package, and it far simpler than what I have described in method 1.
|
||||
|
||||
First, I downloaded the package and unpacked it. Then I copied its contents into my \texttt{texmf} directory, and finally updated the filename database:
|
||||
|
||||
\begin{verbatim}
|
||||
$ cp * ~/texmf
|
||||
$ texhash ~/texmf
|
||||
\end{verbatim}
|
||||
|
||||
Mischief managed!
|
||||
|
||||
\subsection{Miscellaneous Things}
|
||||
|
||||
\begin{enumerate}[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.
|
||||
\end{enumerate}
|
||||
|
||||
\section{What I learned About \LaTeX{} While Creating Something Else}
|
||||
|
||||
For reasons I don't understand I went down an internet rabbit hole reading about the book \textit{Flatland}, by Edwin A. Abbott. This is a book I had purchased years ago in my youth (thank you, Dover Thrift Editions!) but had never gotten around to reading. I found a copy in \LaTeX{} at \href{https://github.com/Ivesvdf/flatland}{\texttt{https://github.com/Ivesvdf/flatland}}. It was old---twelve years old, in fact---and it was set up as a single-sided A4 document. If you've been following this journey this far, you know that I'm pretty fond of booklets, and that I'm in North America, so everything has to be lettersize paper.\footnote{As an American citizen, I am bound by the U.S. Constitution to both completely disavow the metric system and be utterly confused by it, and to decry it as terribly confusing despite the fact that is based on dividing and multiplying by the number 10. This is part of our constitutional duty to vehemently oppose anything which makes sense and also makes life better, such as universal health care. I don't know, something about eagles and gravy and guns.}
|
||||
|
||||
So I downloaded it, and decided to play around with it to see how much I could make it look like an actual book. My original purpose for starting this zine was to learn how to typeset things in \LaTeX{}, but it can be limiting since I've already figured out the format. Since I learn best from projects, another project was in order. This one fell into my lap at the perfect time.
|
||||
|
||||
\subsection{Removing Page Numbers from ``Part'' Pages}
|
||||
|
||||
In the \texttt{report} document class, chapters can be grouped into ``parts'' using
|
||||
|
||||
\begin{verbatim}
|
||||
part[]{}
|
||||
\end{verbatim}
|
||||
|
||||
\noindent wherever you want a new part. The argument between the square brackets is optional and determines what goes in the table of contents. The argument in the curly brackets is required and is what is sent to the page. (If the first argument is omitted, this is also what goes in the table of contents.) Surprisingly, these pages still have page numbers, which I just find odd. You can remove them by adding the \texttt{nonumonpart} package.
|
||||
|
||||
\subsection{Adding Additional Text to ``Part'' Pages}
|
||||
|
||||
It's fairly easy to \textit{remove} page numbers from the ``Part'' pages, but it not nearly as easy as it is to \textit{add} text to them. And it should be! In actual books, these pages often contain some sort of epigraph.
|
||||
|
||||
As it turns out, you can make the text an optional argument to the \verb|\part| command by adding this to the preamble:\footnote{As described by \href{https://tex.stackexchange.com/users/1090/david-carlisle}{David Carlisle} at \href{https://tex.stackexchange.com/questions/336361/how-to-write-text-after-part}{\texttt{https://tex.stackexchange.com/questions/336361/how-to-write-text-after-part}}.}
|
||||
|
||||
\begin{verbatim}
|
||||
\makeatletter
|
||||
\let\old@endpart\@endpart
|
||||
\renewcommand\@endpart[1][]{%
|
||||
\begin{quote}#1\end{quote}%
|
||||
\old@endpart}
|
||||
\makeatother
|
||||
\end{verbatim}
|
||||
|
||||
\texttt{makeatletter} changes the \texttt{@} to the ``letter'' category code so that the current document has access to package internal macros. \texttt{makeatother} changes it back to a letter so you can use it in your document.\footnote{This gets into the internal workings of LaTeX and so is far beyond the scope of this zine. However, there is some good information at \href{https://tex.stackexchange.com/questions/8351/what-do-makeatletter-and-makeatother-do}{\texttt{https://tex.stackexchange.com/questions/8351/what-do-makeatletter-and-makeatother-do}} and at \href{https://www.tug.org/pipermail/tugindia/2002-January/000178.html}{\texttt{https://www.tug.org/pipermail/tugindi \\ a/2002-January/000178.html}} if you are interested. A complete list of category codes can be found at \href{https://en.wikibooks.org/wiki/TeX/catcode}{\texttt{https://en.wikibooks.org/wiki/TeX/catcode}}}
|
||||
|
||||
\verb|\let\old@endpart\@endpart| says ``take the old value for \texttt{endpart} (which is part of the \texttt{part} function) and give it this new value that I'm about to describe''.
|
||||
|
||||
The rest of it (that is, the \texttt{renewcommand} part) redefines the \texttt{endpart} to now include a \verb|\quote| environment, which is quite appropriate for an epigraph.
|
||||
|
||||
\subsection{Adjusting the Line Spacing}
|
||||
\LaTeX{} was designed to write documents; as such, its ability to fine-tune certain document parameters, such as line-spacing, is fairly limited out of the box.\footnote{As it should be! Remember, the Unix Principle is to do one thing and do it well, not to be a Swiss army knife.} But if you need something, chances are that someone else has needed it before you and created a package that will do just that. In this case, the package you need is the \texttt{setspace} package.
|
||||
|
||||
Add that to your preamble, and you can adjust the line spacing of your document by adding either \texttt{singlespacing}, \texttt{onehalfspacing}, or the \texttt{doublespacing} command to your preamble.
|
||||
|
||||
That gives you the versatility that you had with a typewriter. To set more precise line spacing, you can use the \texttt{setstretch} command in your preamble:
|
||||
|
||||
\begin{verbatim}
|
||||
\setstretch{1.1}
|
||||
\end{verbatim}
|
||||
|
||||
\noindent which sets a line spacing equivalent to 1.1 lines. If you want to change the line spacing for just a portion of your document, use the \texttt{spacing} environment:
|
||||
|
||||
\begin{verbatim}
|
||||
\begin{spacing}{2.5}
|
||||
Your widely spaced text goes here.
|
||||
\end{spacing}
|
||||
\end{verbatim}
|
||||
|
||||
This is a small, simple package, but one that I am sure I'll have a lot of use for down the road.
|
||||
|
||||
\subsection{Include Page Numbers on ``Chapter'' Pages}
|
||||
|
||||
I set up my version of \textit{Flatland} to have the page numbers in the header and to completely suppress the footers. But I wanted those headers to appear on the chapter pages (you'll notice in this zine that they don't appear), because this is how the book was originally typeset back in the nineteenth century. As it turns out, the \texttt{titlesec} package makes this very easy:
|
||||
|
||||
\begin{verbatim}
|
||||
\usepackage[]{titlesec}
|
||||
\assignpagestyle{\chapter}{fancy}
|
||||
\end{verbatim}
|
||||
|
||||
For what it's worth, if you want to \textit{omit} the headers and footers on a given page, just add
|
||||
|
||||
\begin{verbatim}
|
||||
\thispagestyle{empty}
|
||||
\end{verbatim}
|
||||
|
||||
somewhere \textit{after} the start of the page.
|
||||
|
||||
\subsection{A Few Little Things}
|
||||
\begin{itemize}[noitemsep]
|
||||
\item Want \textsc{Small Caps}? Wrap them in \verb|textsc{ }|.
|
||||
\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}$
|
||||
\end{itemize}
|
||||
|
||||
\paragraph{I almost forgot to add:} If you are interested in seeing this project, you can view it at and download it from \href{https://git.kjodle.net/kjodle/Flatland}{\texttt{https://git.kjodle.net/kjodle/Flatland}}.
|
||||
|
||||
\end{document}
|
Loading…
Reference in New Issue
Block a user