Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modernize Tufte-LaTeX #176

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
## Intermediate documents:
*.dvi
*-converted-to.*
*.xdv
# these rules might exclude image files for figures etc.
# *.ps
# *.eps
Expand Down
12 changes: 12 additions & 0 deletions History.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
== 3.6.0 - 2023/03/20

* Clean up code formatting/style.
* Use iftex package to determine which TeX engine is running.
* Fix handling of fonts and letterspacing under LuaLaTeX and XeLaTeX
(necessary to get the class to work with LuaLaTeX).
* Substitute biblatex and biber for natbib/bibtex for making bibliographies;
this breaks the optional vertical offset argument of the re-defined `\cite`
command, as biblatex also uses multiple optional arguments to `\cite`.
* Add a Makefile for easy testing and installation of the classes.
* Use ETbb as the default typeface if `etbb` package is installed.

== 3.5.2 - 2015/06/21

* A variety of bug fixes and small improvements.
Expand Down
27 changes: 27 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
LMKFLAGS = -outdir=samples -bibtex
CLASSDIR = $$(kpsewhich -var-value TEXMFHOME)/tex/latex/tufte-latex
DOCDIR = $$(kpsewhich -var-value TEXMFHOME)/doc/latex/tufte-latex

test-lua:
latexmk $(LMKFLAGS) -lualatex -jobname=%A-lualatex *.tex

test-xe:
latexmk $(LMKFLAGS) -xelatex -jobname=%A-xelatex *.tex

test-pdf:
latexmk $(LMKFLAGS) -pdflatex -jobname=%A-pdflatex *.tex

test: test-lua test-xe test-pdf

install: test
mkdir -p $(CLASSDIR)
cp tufte-book.cls tufte-common.def tufte-handout.cls $(CLASSDIR)
mkdir -p $(DOCDIR)
cp History.txt \
README.md \
sample-*.tex \
sample-*.bib \
$(DOCDIR)
cp samples/sample-handout-lualatex.pdf $(DOCDIR)/sample-handout.pdf
cp samples/sample-book-lualatex.pdf $(DOCDIR)/sample-book.pdf
texhash
10 changes: 7 additions & 3 deletions Manifest.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
History.txt
Manifest.txt
README.txt
README.md
graphics/nasa_vision_sm.png
graphics/satir_graph.png
graphics/helix.asy
Expand All @@ -16,11 +16,15 @@ graphics/vdqi-contents.pdf
graphics/vdqi-title.pdf
graphics/ve-contents.pdf
graphics/ve-title.pdf
sample-book.pdf
sample-book.tex
sample-handout.bib
sample-handout.pdf
sample-handout.tex
samples/sample-book-lualatex.pdf
samples/sample-book-pdflatex.pdf
samples/sample-book-xelatex.pdf
samples/sample-handout-lualatex.pdf
samples/sample-handout-pdflatex.pdf
samples/sample-handout-xelatex.pdf
tufte-book.cls
tufte-common.def
tufte-handout.cls
Expand Down
74 changes: 55 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,64 @@
Hi,
# The Tufte-LaTeX Classes

Welcome to the beginnings of Tufte LaTeX package to help you
Welcome to the beginnings of Tufte-LaTeX package to help you
produce Tufte-style handouts, reports, and notes.

## Installation

If you're using TeX Live on Linux or macOS, you should be able to run
`make install` after cloning the repo. Otherwise, you can copy
`tufte-common.def`, `tufte-book.cls`, and `tufte-handout.cls` to the
appropriate subdirectory of your `TEXMFHOME` directory (probably something
like `$TEXMFHOME/tex/latex/tufte-latex`) and then run `texhash`.

To use the Tufte-LaTeX classes in just one specific LaTeX document, you
can copy `tufte-common.def`, `tufte-book.cls`, and `tufte-handout.cls`
into the working directory of that document.

## Quick Start

Try typesetting `sample-handout.tex` with the following sequence
of commands,
You can compile both the sample book and handout with all three TeX
engines (LuaLaTeX, XeLaTeX, and pdfLaTeX) by running `make test`, or you
can compile the book and handout with just one engine by running
`make test-lua`, `make test-xe`, or `make test-pdf`.

If you want to compile just the book or the handout, it's easiest to use
`latexmk` (substituting `xelatex` or `pdflatex` for `lualatex`, if desired):

```shell
$ latexmk -outdir=samples -bibtex -lualatex -jobname=%A-lualatex sample-book.tex
```

pdflatex sample-handout
bibtex sample-handout
pdflatex sample-handout
pdflatex sample-handout
or

The result should look like `sample-handout.pdf`.
```shell
$ latexmk -outdir=samples -bibtex -lualatex -jobname=%A-lualatex sample-handout.tex
```

You could also do things manually. For the sample handout, run:

```shell
$ lualatex sample-handout
$ biber sample-handout
$ lualatex sample-handout
$ lualatex sample-handout
```

The result should look like the sample handout PDFs in [`samples/`](samples/).

The sample book can be compiled with the following:

pdflatex sample-book
bibtex sample-book
texindy --language english sample-book.idx
# or makeindex sample-book.idx
pdflatex sample-book
pdflatex sample-book
pdflatex sample-book
```shell
$ lualatex sample-book
$ biber sample-book
$ makeindex sample-book.idx
$ lualatex sample-book
$ lualatex sample-book
$ lualatex sample-book
```

As when using `latexmk`, you can substitute `xelatex` or, less preferably,
`pdflatex` for `lualatex` above.

## Troubleshooting

Expand All @@ -42,7 +77,7 @@ The following packages are required:
* fontenc
* geometry
* hyperref
* natbib and bibentry
* biblatex and biber
* optparams
* paralist
* placeins
Expand All @@ -58,9 +93,10 @@ The following packages are required:
The following packages are optional and will be automatically used if installed:

* beramono
* etbb
* fontspec
* helvet
* ifpdf
* ifxetex
* iftex
* letterspace (in the microtype package)
* mathpazo
* soul
Expand Down
Binary file removed sample-book.pdf
Binary file not shown.
70 changes: 42 additions & 28 deletions sample-book.tex
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@
\newcommand{\docfilehook}[2]{\texttt{#1}\index{file hooks!#2}\index{#1@\texttt{#1}}}
\newcommand{\doccounter}[1]{\texttt{#1}\index{#1 counter@\texttt{#1} counter}}

% Bib resource file for Biblatex
\addbibresource{sample-handout.bib}

% Generates the index
\usepackage{makeidx}
\makeindex
Expand Down Expand Up @@ -555,18 +558,21 @@ \section{Sidenotes}\label{sec:sidenotes}
\section{References}
References are placed alongside their citations as sidenotes,
as well. This can be accomplished using the normal \doccmddef{cite}
command.\sidenote{The first paragraph of this document includes a citation.}

The complete list of references may also be printed automatically by using
the \doccmddef{bibliography} command. (See the end of this document for an
example.) If you do not want to print a bibliography at the end of your
document, use the \doccmddef{nobibliography} command in its place.

To enter multiple citations at one location,\cite[-3\baselineskip]{Tufte2006,Tufte1990} you can
provide a list of keys separated by commas and the same optional vertical
offset argument: \Verb|\cite{Tufte2006,Tufte1990}|.
command or the \doccmddef{autocite} command, which functions
similarly.\sidenote{If you use the \texttt{\textbackslash cite} command within
a sidenote, it will render as an in-line parenthetical citation, as demonstrated
here \autocite{Tufte2001}.}

You will need to specify a bibliography resource file in the preamble of your
document using \doccmddef{addbibresource}. The complete list of references may
also be printed automatically by using the \doccmddef{printbibliography} command.
See the end of this document for an example, and the Bib\LaTeX{} documentation
for more information.

To enter multiple citations at one location,\autocite{Tufte2006,Tufte1990} you can
provide a list of keys separated by commas: \Verb|\cite{Tufte2006,Tufte1990}|.
\begin{docspec}
\doccmd{cite}[\docopt{offset}]\{\docarg{bibkey1,bibkey2,\ldots}\}
\doccmd{cite\{\docarg{bibkey1,bibkey2,\ldots}\}}
\end{docspec}

\section{Figures and Tables}\label{sec:figures-and-tables}
Expand Down Expand Up @@ -785,9 +791,16 @@ \section{Full-width text blocks}
\section{Typography}\label{sec:typography}

\subsection{Typefaces}\label{sec:typefaces}\index{typefaces}
If the Palatino, \textsf{Helvetica}, and \texttt{Bera Mono} typefaces are installed, this style
will use them automatically. Otherwise, we'll fall back on the Computer Modern
typefaces.
If you're using \tXeLaTeX\ or Lua\LaTeX, the class will use ETbb as the main
typeface if the \docpkg{etbb} package is installed and \TeX\ Gyre Pagella
otherwise; \textsf{\TeX\ Gyre Heros}, and \texttt{\TeX\ Gyre
Cursor} are the default for sans-serif and monospace text, respectively.
(The \TeX\ Gyre faces are usually included with \TeX\ Live
distributions.) In these cases, the class automatically loads the
\texttt{fontspec} package, so you can easily select your own system
fonts. Under pdf\LaTeX, the class defaults to the Palatino, \textsf{Helvetica},
and \texttt{Bera Mono} typefaces if they're installed. Otherwise,
we'll fall back on the Computer Modern typefaces.

\subsection{Letterspacing}\label{sec:letterspacing}
This document class includes two new commands and some improvements on
Expand Down Expand Up @@ -847,16 +860,18 @@ \section{Document Class Options}\label{sec:options}
also cause the graphics to be replaced by outlines.

The \docclsoptdef{nofonts} option prevents the \TL classes from
automatically loading the Palatino and Helvetica typefaces. You should use
this option if you wish to load your own fonts. If you're using \tXeLaTeX, this
option is implied (i.e., the Palatino and Helvetica fonts aren't loaded if you
use \tXeLaTeX).
automatically loading the Palatino and Helvetica typefaces if you're using
pdf\LaTeX. You should use this option if you wish to load your own fonts
in pdf\LaTeX. If you're using \tXeLaTeX\ or Lua\LaTeX, the default fonts
will be loaded anyway but you can easily reset them using \docpkg{fontspec}.

The \docclsoptdef{nols} option inhibits the letterspacing code. The \TL\
classes try to load the appropriate letterspacing package (either pdf\TeX's
\docpkg{letterspace} package or the \docpkg{soul} package). If you're using
\tXeLaTeX\ with \docpkg{fontenc}, however, you should configure your own
letterspacing.
classes try to load the appropriate letterspacing package (either
\docpkg{letterspace} or the \docpkg{soul} under pdf\TeX, or \docpkg{fontspec}
under \tXeLaTeX\ or Lua\LaTeX).

The \docclsoptdef{nobib} option inhibits loading of the \docpkg{biblatex}
package and modification of the \doccmd{cite} command.

The \docclsoptdef{notitlepage} option causes \doccmd{maketitle} to generate a title
block instead of a title page. The \doccls{book} class defaults to a title
Expand Down Expand Up @@ -1126,8 +1141,7 @@ \section{Package Dependencies}\label{sec:dependencies}
\begin{multicols}{2}
\begin{itemize}
\item xifthen
\item ifpdf*
\item ifxetex*
\item iftex*
\item hyperref
\item geometry
\item ragged2e
Expand All @@ -1137,7 +1151,7 @@ \section{Package Dependencies}\label{sec:dependencies}
\item soul*
\item letterspace*
\item setspace
\item natbib \emph{and} bibentry
\item biblatex \emph{and} biber
\item optparams
\item placeins
\item mathpazo*
Expand All @@ -1149,6 +1163,8 @@ \section{Package Dependencies}\label{sec:dependencies}
\item textcomp
\item titlesec
\item titletoc
\item fontspec*
\item etbb*
\end{itemize}
\end{multicols}

Expand All @@ -1166,9 +1182,7 @@ \section{Package Dependencies}\label{sec:dependencies}

\backmatter

\bibliography{sample-handout}
\bibliographystyle{plainnat}

\printbibliography

\printindex

Expand Down
Binary file removed sample-handout.pdf
Binary file not shown.
Loading