LaTeX postprocessing guidelines/PPtips
This page exists to make available the collective wisdom of LaTeX PPers.
Footnotes
Per-page markers
A lot of DP-vintage books used footnote markers that reset every page. The perpage package can facilitate this:
\usepackage{perpage}[2002/12/20] \MakePerPage{footnote}
Printer's marks
DP-vintage books that use printer's marks rather than numerals for footnotes often use the classical sequence of marks defined in Bringhurst. This can be implemented as follows:
\makeatletter \renewcommand{\thefootnote}{\Bringhurst\c@footnote} \def\Bringhurst#1{\ifcase#1\or*\or\dag\or\ddag\or\S\or$\|$\or\P \or**\or\dag\dag\or\ddag\ddag\or\S\S\or$\|\|$\or\P\P\else?\fi} \makeatother
provided you never have more than 12 footnotes per page (and are resetting the markers every page).
Nonstandard markers
A couple of books have been through DP where the footnote markers were superscript numerals enclosed in full-size parentheses(¹). One way to deal with this is simply
(\footnote{...})
but because the parentheses are then hard-coded it's difficult to switch to another footnoting style. A more flexible approach is to incorporate the parentheses in the footnote marker:
\makeatletter \def\@makefnmark{\hbox{\upshape(\@textsuperscript{\normalfont\@thefnmark})}} \makeatother
Multiple series of footnotes
If you decide to use footnotes for important TNs in the body of the text, then you need to have a second footnote series. If the book uses numerals as footnote markers than the new series should use printer's marks, or vice versa. There are a couple of packages that support multiple series of footnotes, but if you use the memoir class, setting up a second footnote series is as easy as
\newfootnoteseries{T} % for transcriber's notes \plainfootstyle{T}
which creates a set of commands ending in "T" parallelling the normal footnote commands
Forcing footnotes to the bottom
Some document classes will turn on \raggedbottom
to avoid lots of underfull vbox messages caused by pages that TeX thinks are too short. A side effect is that footnotes are not always pushed to the bottom of the page, and can appear some distance from the bottom on a short page. If you prefer the footnotes to always appear at the very bottom of the page, add some vertical fill to the footnote rule:
\renewcommand*{\footnoterule}{\kern-3pt\vfill \hrule width 0.4\columnwidth \kern 2.6pt}
Publishers' devices
Here are some publishers' devices that have already been converted into vector form in posted projects, and may be freely borrowed.
American Book Company
c1907, used in #31344
Cambridge University Press
c1920, used in #29782
Edward J. Clode
c1916, used in #29914
Gauthier-Villars
c1905, used in #29781
Macmillan and Co.
?1890s through ?1910s, used in #26262 and #26839
B.G. Teubner
c1909, used in #31911
Sample `Generic' Preamble
# This is a more-or-less generic post-processing preamble. Lines # beginning with a _single_ # are annotations, and most be removed # before attempting to compile this code in a `live' source file. # (The two ### lines after \end{document} are required in the # uploaded source file.) # Text enclosed in <ANGLE-BRACKETS> signifies document-specific # information, such as the author or PPer's name. # The package list will clearly vary from project to project. The # list below is reasonably typical. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% %% %% Packages and substitutions: %% %% %% %% book: Required. %% %% inputenc: Standard DP encoding. Required. %% %% %% %% fix-cm: For larger title page fonts. Optional. %% %% ifthen: Logical conditionals. Required. %% %% %% %% amsmath: AMS mathematics enhancements. Required. %% %% amssymb: Additional mathematical symbols. Required. %% %% %% %% alltt: Fixed-width font environment. Required. %% %% array: Enhanced tabular features. Required. %% %% %% %% footmisc: Extended footnote capabilities. Required. %% %% perpage: Start footnote numbering on each page. Required. %% %% %% %% indentfirst: Indent first word of each sectional unit. Optional. %% %% textcase: Apply \MakeUppercase (et al.) only to text, not math. %% %% Required. %% %% %% %% calc: Length calculations. Required. %% %% soul: Spaced text. Optional. %% %% %% %% fancyhdr: Enhanced running headers and footers. Required. %% %% %% %% graphicx: Standard interface for graphics inclusion. Required. %% %% wrapfig: Illustrations surrounded by text. Required. %% %% %% %% geometry: Enhanced page layout package. Required. %% %% hyperref: Hypertext embellishments for pdf output. Required. %% %% %% %% %% %% Producer's Comments: %% %% %% %% Changes are noted in this file in three ways. %% %% 1. \DPnote{} for in-line `placeholder' notes. %% %% 2. \DPtypo{}{} for typographical corrections, showing original %% %% and replacement text side-by-side. %% %% 3. [** PP: Note]s for lengthier or stylistic comments. %% %% %% %% %% %% Compilation Flags: %% %% %% %% The following behavior may be controlled by boolean flags. %% %% %% %% ForPrinting (false by default): %% %% Compile a screen-optimized PDF file. Set to false for print- %% %% optimized file (pages cropped, one-sided, blue hyperlinks). %% %% %% %% %% %% Things to Check: %% %% %% %% %% %% Spellcheck: .................................. OK %% %% Smoothreading pool: ......................... yes %% %% %% %% lacheck: ..................................... OK %% %% Numerous false positives from commented code %% %% %% # Set the number of pages from the log file after the final compile. %% PDF pages: 105 (if ForPrinting set to false) %% %% PDF page size: US Letter %% %% PDF bookmarks: created, point to ToC entries %% %% PDF document info: filled in %% # Modify these descriptions as necessary. %% Images: 4 pdf diagrams %% %% %% %% Summary of log file: %% %% * One overfull hbox (0.7pt too wide). %% %% * Three underfull vboxes (but good illo placement overall). %% %% %% %% %% %% Compile History: %% %% %% %% December, 2009: <YOUR DP ID, NAME OR CONTACT INFO> %% %% texlive2007, GNU/Linux %% %% %% %% Command block: %% %% %% # List, in order, the commands needed to build your project from scratch. # See the pglatex PPer's manual for details. %% pdflatex x3 #(Run pdflatex three times) %% %% %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # Declaration required for technical reasons \listfiles # Package version dates, if available, must be appended \documentclass[12pt,leqno]{book}[2005/09/16] %%%%%%%%%%%%%%%%%%%%%%%%%%%%% PACKAGES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # Before uploading, check that these match the list in the producer's # comment block at the top of the file. \usepackage[latin1]{inputenc}[2006/05/05] \usepackage{ifthen}[2001/05/26] %% Logical conditionals \usepackage{amsmath}[2000/07/18] %% Displayed equations \usepackage{amssymb}[2002/01/22] %% and additional symbols \usepackage{alltt}[1997/06/16] %% boilerplate, credits, license \usepackage{array}[2005/08/23] %% extended array/tabular features %% extended footnote capabilities \usepackage[symbol]{footmisc}[2005/03/17] \usepackage{perpage}[2006/07/15] \usepackage{graphicx}[1999/02/16]%% For diagrams \usepackage{wrapfig}[2003/01/31] %% and wrapping text around them \usepackage{indentfirst}[1995/11/23] \usepackage{textcase}[2004/10/07] \usepackage{calc}[2005/08/06] # If a package might not be available to a subsequent user, or if # the feature isn't essential, the package can be used provisionally. # Be sure to check that your source file compiles correctly in all # configurations. # Set up large fonts and vertical space for the title page \newlength{\MySkip} \IfFileExists{fix-cm.sty}{% %% For larger title page fonts \usepackage{fix-cm}[2006/03/24]% \newcommand{\MyHuge}{\fontsize{38}{48}\selectfont}% \setlength{\MySkip}{0.375in}% }{% else \newcommand{\MyHuge}{\Huge}% \setlength{\MySkip}{0.25in} } \IfFileExists{soul.sty}{% %% For spaced publisher's line \usepackage{soul}[2003/11/17] }{% else \newcommand{\so}[1]{#1}% } % for running heads \usepackage{fancyhdr} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%% Interlude: Set up PRINTING (default) or SCREEN VIEWING %%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % ForPrinting=true (default) false % Asymmetric margins Symmetric margins % Black hyperlinks Blue hyperlinks % Start Preface, ToC, etc. recto No blank verso pages % % Chapter-like ``Sections'' start both recto and verso in the scanned % book. This behavior has been retained. \newboolean{ForPrinting} %% UNCOMMENT the next line for a PRINT-OPTIMIZED VERSION of the text %% %\setboolean{ForPrinting}{true} %% Initialize values to ForPrinting=false \newcommand{\Margins}{hmarginratio=1:1} % Symmetric margins \newcommand{\HLinkColor}{blue} % Hyperlink color \newcommand{\PDFPageLayout}{SinglePage} \newcommand{\TransNote}{Transcriber's Note} \newcommand{\TransNoteCommon}{% # Change these as needed, of course. ;) This book was produced from images provided by the Cornell University Library: Historical Mathematics Monographs collection. \bigskip Minor typographical corrections and presentational changes have been made without comment. The calculations preceding equation~\Eqno{(15)} on \Pageref{page}{12} (page~12 of the original) have been re-formatted. \bigskip } \newcommand{\TransNoteText}{% \TransNoteCommon This PDF file is optimized for screen viewing, but may easily be recompiled for printing. Please see the preamble of the \LaTeX\ source file for instructions. } %% Re-set if ForPrinting=true \ifthenelse{\boolean{ForPrinting}}{% \renewcommand{\Margins}{hmarginratio=2:3} % Asymmetric margins \renewcommand{\HLinkColor}{black} % Hyperlink color \renewcommand{\PDFPageLayout}{TwoPageRight} \renewcommand{\TransNote}{Transcriber's Note} \renewcommand{\TransNoteText}{% \TransNoteCommon This PDF file is optimized for printing, but may easily be recompiled for screen viewing. Please see the preamble of the \LaTeX\ source file for instructions. } }{% If ForPrinting=false, don't skip to recto \renewcommand{\cleardoublepage}{\clearpage} } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%% End of PRINTING/SCREEN VIEWING code; back to packages %%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # Adjusting the text block size is surprisingly delicate and # project-specific. The geometry package manages parameters # easily, as does the memoir class. \usepackage[body={5.25in,8.4in},\Margins]{geometry}[2002/07/08] # It's a good idea to typeset the ebook number somewhere in the # project body; this placeholder will be replaced by the actual # ebook number at PG. Keep "00000" verbatim. \providecommand{\ebook}{00000} % Overridden during white-washing \usepackage[pdftex, hyperref, hyperfootnotes=false, # Again, fill these in appropriately, e.g., <TITLE> = Elliptic Functions pdftitle={The Project Gutenberg eBook \#\ebook: <TITLE>}, pdfauthor={<AUTHOR>}, pdfkeywords={<PM NAME>, <PP NAME>, Project Gutenberg Online Distributed Proofreading Team, <IMAGE SOURCE>}, pdfstartview=Fit, % default value pdfstartpage=1, % default value pdfpagemode=UseNone, % default value bookmarks=true, % default value linktocpage=false, % default value pdfpagelayout=\PDFPageLayout, pdfdisplaydoctitle, pdfpagelabels=true, bookmarksopen=true, bookmarksopenlevel=1, colorlinks=true, linkcolor=\HLinkColor]{hyperref}[2007/02/07] % Re-crop screen-formatted version, accommodating wide displays \ifthenelse{\boolean{ForPrinting}} {} # Set the visible page size here; numbers are pt measured right and # up from the bottom left corner of the page. {\hypersetup{pdfpagescrop= 85 80 527 765}} %%%% Fixed-width environment to format PG boilerplate %%%% # Adjust pt sizes so your project's title fits the text block \newenvironment{PGtext}{% \begin{alltt} \fontsize{9.2}{10.5}\ttfamily\selectfont}% {\end{alltt}} %% No hrule in page header \renewcommand{\headrulewidth}{0pt} % Top-level footnote numbers restart on each page \MakePerPage{footnote} % Running heads \newcommand{\SetRunningHeads}[1]{% \fancyhead{} \setlength{\headheight}{15pt} \thispagestyle{empty} # Change as needed. \fancyhead[CE]{\textit{<TITLE>.}} \fancyhead[CO]{\textit{\MakeTextUppercase{#1}}} \ifthenelse{\boolean{ForPrinting}} {\fancyhead[RO,LE]{\thepage}} {\fancyhead[R]{\thepage}} } %\Chapter[PDF name]{Number.}{Heading title} \newcommand{\Chapter}[3][]{% \cleardoublepage \phantomsection \renewcommand{\mychapno}{#2} \label{chapter:#2} # Actions to fill in: # Print chapter heading # Add line to table of contents # Set up running heads } # Similar actions as \Chapter, as needed \newcommand{\Section}[1] {} # If the book uses unconventional operator names, such as arc sec, # they can be added manually. \DeclareMathOperator{\am}{am} # Convenience macro to avoid having the set the graphics path explicitly \newcommand{\Graphic}[2][] {\ifthenelse{\equal{#1}{}} {\includegraphics{./images/#2.pdf}} {\includegraphics[width=#1]{./images/#2.pdf}}% } # Sometimes the first word of a chapter is small-capped. A semantic # macro makes it easy to enable or disable this behavior. \newcommand{\First}[1]{\textsc{#1}} % For corrections. \newcommand{\DPtypo}[2]{#2} \newcommand{\DPnote}[1]{} % \PadTo[#1]{#2}{#3} sets #3 in a box of width #2, aligned at #1 (default [c]) % Examples: \PadTo{feet per sec.}{\Ditto}, \PadTo{The value is}{2.} \newlength{\TmpLen} \newcommand{\PadTo}[3][c]{% \settowidth{\TmpLen}{$#2$}% \makebox[\TmpLen][#1]{$#3$}% } # Thoughtbreak; adjust definition as needed. \newcommand{\tb}{\rule{1in}{0.5pt}} \newcommand{\Z}{\phantom{0}} # Handle degree symbols and centered dots as Latin-1 characters \DeclareInputText{176}{\ifmmode{{}^\circ}\else\textdegree\fi} \DeclareInputText{183}{\ifmmode\cdot\else\textperiodcentered\fi} % ToC formatting \AtBeginDocument{\renewcommand{\contentsname}% {\centering\scshape\Large CONTENTS}} # Making internal references into hyperlinks isn't difficult: Manually # add anchors (or work them into the formatters' routine!), then set # up link commands accepting easily-read text as arguments. % Cross-referencing: anchors \newcommand{\Pagelabel}[1] {\phantomsection\label{page:#1}} \newcommand{\Figlabel}[1] {\phantomsection\label{fig:#1}} \newcommand{\Tag}[1]{% \phantomsection \label{eqn:#1} \tag*{\normalsize\ensuremath{#1}} } % and links \newcommand{\Pageref}[2]{\hyperref[page:#2]{#1~\pageref{page:#2}}} % \Eqref{equation}{(<number>)} \newcommand{\Eqno}[1]{\normalsize\ensuremath{#1}} \newcommand{\Eqref}[2]{\hyperref[eqn:#2]{#1~\Eqno{#2}}} % DPalign, DPgather \makeatletter \providecommand\shortintertext\intertext \newcount\DP@lign@no \newtoks\DP@lignb@dy \newif\ifDP@cr \newif\ifbr@ce \def\f@@zl@bar{\null} \def\addto@DPbody#1{\global\DP@lignb@dy\@xp{\the\DP@lignb@dy#1}} \def\parseb@dy#1{\ifx\f@@zl@bar#1\f@@zl@bar \addto@DPbody{{}}\let\@next\parseb@dy \else\ifx\end#1 \let\@next\process@DPb@dy \ifDP@cr\else\addto@DPbody{\DPh@@kr&\DP@rint}\@xp\addto@DPbody\@xp{\@xp{\the\DP@lign@no}&}\fi \addto@DPbody{\end} \else\ifx\intertext#1 \def\@next{\eat@command0}% \else\ifx\shortintertext#1 \def\@next{\eat@command1}% \else\ifDP@cr\addto@DPbody{&\DP@lint}\@xp\addto@DPbody\@xp{\@xp{\the\DP@lign@no}&\DPh@@kl} \DP@crfalse\fi \ifx\begin#1\def\begin@stack{b} \let\@next\eat@environment \else\ifx\lintertext#1 \let\@next\linter@text \else\ifx\rintertext#1 \let\@next\rinter@text \else\ifx\\#1 \addto@DPbody{\DPh@@kr&\DP@rint}\@xp\addto@DPbody\@xp{\@xp{\the\DP@lign@no}&\\}\DP@crtrue \global\advance\DP@lign@no\@ne \let\@next\parse@cr \else\check@braces#1!Q!Q!Q!\ifbr@ce\addto@DPbody{{#1}}\else \addto@DPbody{#1}\fi \let\@next\parseb@dy \fi\fi\fi\fi\fi\fi\fi\fi\@next} \def\process@DPb@dy{\let\lintertext\@gobble\let\rintertext\@gobble \@xp\start@align\@xp\tw@\@xp\st@rredtrue\@xp\m@ne\the\DP@lignb@dy} \def\linter@text#1{\@xp\DPlint\@xp{\the\DP@lign@no}{#1}\parseb@dy} \def\rinter@text#1{\@xp\DPrint\@xp{\the\DP@lign@no}{#1}\parseb@dy} \def\DPlint#1#2{\@xp\def\csname DP@lint:#1\endcsname{\text{#2}}} \def\DPrint#1#2{\@xp\def\csname DP@rint:#1\endcsname{\text{#2}}} \def\DP@lint#1{\ifbalancedlrint\@xp\ifx\csname DP@lint:#1\endcsname\relax\phantom {\csname DP@rint:#1\endcsname}\else\csname DP@lint:#1\endcsname\fi \else\csname DP@lint:#1\endcsname\fi} \def\DP@rint#1{\ifbalancedlrint\@xp\ifx\csname DP@rint:#1\endcsname\relax\phantom {\csname DP@lint:#1\endcsname}\else\csname DP@rint:#1\endcsname\fi \else\csname DP@rint:#1\endcsname\fi} \def\eat@command#1#2{\ifcase#1\addto@DPbody{\intertext{#2}}\or \addto@DPbody{\shortintertext{#2}}\fi\DP@crtrue \global\advance\DP@lign@no\@ne\parseb@dy} \def\parse@cr{\new@ifnextchar*{\parse@crst}{\parse@crst{}}} \def\parse@crst#1{\addto@DPbody{#1}\new@ifnextchar[{\parse@crb}{\parseb@dy}} \def\parse@crb[#1]{\addto@DPbody{[#1]}\parseb@dy} \def\check@braces#1#2!Q!Q!Q!{\def\dp@lignt@stm@cro{#2}\ifx \empty\dp@lignt@stm@cro\br@cefalse\else\br@cetrue\fi} \def\eat@environment#1{\addto@DPbody{\begin{#1}}\begingroup \def\@currenvir{#1}\let\@next\digest@env\@next} \def\digest@env#1\end#2{% \edef\begin@stack{\push@begins#1\begin\end \@xp\@gobble\begin@stack}% \ifx\@empty\begin@stack \@checkend{#2} \endgroup\let\@next\parseb@dy\fi \addto@DPbody{#1\end{#2}} \@next} \def\lintertext{lint}\def\rintertext{rint} \newif\ifbalancedlrint \let\DPh@@kl\empty\let\DPh@@kr\empty \def\DPg@therl{&\omit\hfil$\displaystyle} \def\DPg@therr{$\hfil} \newenvironment{DPalign*}[1][a]{% \if m#1\balancedlrintfalse\else\balancedlrinttrue\fi \global\DP@lign@no\z@\DP@crfalse \DP@lignb@dy{&\DP@lint0&}\parseb@dy }{% \endalign } \newenvironment{DPgather*}[1][a]{% \if m#1\balancedlrintfalse\else\balancedlrinttrue\fi \global\DP@lign@no\z@\DP@crfalse \let\DPh@@kl\DPg@therl \let\DPh@@kr\DPg@therr \DP@lignb@dy{&\DP@lint0&\DPh@@kl}\parseb@dy }{% \endalign } \makeatother %%%%%%%%%%%%%%%%%%%%%%%% START OF DOCUMENT %%%%%%%%%%%%%%%%%%%%%%%%%% \begin{document} \pagestyle{empty} \pagenumbering{Alph} \phantomsection \pdfbookmark[-1]{Front Matter}{Front Matter} %%%% PG BOILERPLATE %%%% \Pagelabel{PGBoilerplate} \phantomsection \pdfbookmark[0]{PG Boilerplate}{Project Gutenberg Boilerplate} \begin{center} \begin{minipage}{\textwidth} \small \begin{PGtext} *** Header boilerplate *** \end{PGtext} \end{minipage} \end{center} \clearpage %%%% Credits and transcriber's note %%%% \begin{center} \begin{minipage}{\textwidth} \begin{PGtext} *** Credits *** \end{PGtext} \end{minipage} \end{center} \vfill \begin{minipage}{0.85\textwidth} \small \phantomsection \pdfbookmark[0]{Transcriber's Note}{Transcriber's Note} \subsection*{\centering\normalfont\scshape% \normalsize\MakeLowercase{\TransNote}}% \raggedright \TransNoteText \end{minipage} %%%%%%%%%%%%%%%%%%%%%%%%%%% FRONT MATTER %%%%%%%%%%%%%%%%%%%%%%%%%% \frontmatter \pagenumbering{roman} \pagestyle{empty} # Paste the bulk of the concatenated text here. :) %%%%%%%%%%%%%%%%%%%%%%%%% GUTENBERG LICENSE %%%%%%%%%%%%%%%%%%%%%%%%%% \cleardoublepage \backmatter \phantomsection \pdfbookmark[-1]{Back Matter}{Back Matter} \phantomsection \pdfbookmark[0]{PG License}{Project Gutenberg License} \fancyhead[C]{\textsc{LICENSING}} \begin{PGtext} *** License *** \end{PGtext} \end{document} # See http://www.pgdp.net/wiki/LaTeX_postprocessing_guidelines/Lprep # for details of configuring lprep; sample code is shown ### @ControlwordReplace = ( ['\\Example', 'Example'] ); @MathEnvironments = ( ['\\begin{DPalign*}','\\end{DPalign*}','<DPALIGN>'], ['\\begin{DPgather*}','\\end{DPgather*}','<DPGATHER>'] ); @ControlwordArguments = ( ['\\hyperref', 0, 0, '', ''], ['\\Chapter', 0, 0, '', '', 1, 1, 'Chapter ', '. ', 1, 1, '', ''], ['\\Chapref', 1, 1, '', '', 1, 1, ' ', ''], ['\\Eqref', 0, 0, '', '', 1, 1, '', '', 1, 0, '', '', 1, 1, ' ', ''], ['\\Pageref', 1, 1, '', ' ', 1, 1, '', ''], ['\\DPtypo', 1, 0, '', '', 1, 1, '', ''], ['\\DPnote', 1, 0, '', ''], ['\\First', 1, 1, '', ''] ); ### # After you build the project, paste a copy of the log file here. # Congratulations!