LaTeX default preamble

From DPWiki
Jump to navigation Jump to search

This is a public scratch pad for hashing out a standard DP LaTeX preamble for the compile button.

Feel free to brainstorm, to provide macros without implementations (but do explain what the command should do, and give sample usage), and/or to tweak/comment existing code.


 \documentclass[12pt,letterpaper]{book}% leqno?
 \usepackage[latin1]{inputenc}
 \usepackage{amssymb}
 \usepackage{amsmath}
 %\usepackage{mathrsfs}% For \msthscr
 \usepackage{indentfirst}
 \usepackage{ifthen}  % For macro defs
 \usepackage{array}   % enhanced alignment preambles
 \usepackage{multirow}% for tables?
 \usepackage{soul}
 \usepackage{textcomp}% For \Ditto
 % Factor out a few style parameters
 \newcommand{\Heading}{\centering\normalfont\scshape}% Font for unit headings
 \newcommand{\BeforeSkip}{\smallskip}
 \newcommand{\AfterSkip}{\medskip}
 % Usage: Wrap entire proofer text (regardless of font), as in
 % \Chapter{Chapter I. In the Beginning}
 % \Section{§1. The Very First Thing}
 \newcommand{\Chapter}[1]{\section*{\large\Heading #1}}
 \newcommand{\Section}[1]{\subsection*{\normalsize\Heading #1}}
 \newcommand{\Subsection}[1]{\subsection*{\small\Heading #1}}
 \let\Paragraph\paragraph
 % Usage: \Tag{(10)}, \Tag{(A')_3}
 \newcommand{\Tag}[1]{\tag*{\normalsize\ensuremath{#1}}}
 % Theorem et al. environments.
 % Usage: \begin{Theorem} ... \end{Theorem}, or
 % \begin{Theorem}[Theorem~IV.1] ... \end{Theorem}, or
 \newenvironment{Theorem}[1][]
 {\BeforeSkip\par\noindent%
   \ifthenelse{\equal{#1}{}}{{\scshape Theorem}:}{{\scshape #1}:}%
   \quad\itshape}
 {\normalfont\AfterSkip}
 \newenvironment{Corollary}[1][]
 {\BeforeSkip\par\noindent%
   \ifthenelse{\equal{#1}{}}{{\scshape Corollary}:}{{\scshape #1}:}%
   \quad\itshape}
 {\normalfont\AfterSkip}
 \newenvironment{Proof}
 {\BeforeSkip\par\noindent\textbf{Proof:}\quad}
 {\AfterSkip}
 \newenvironment{Remark}% smaller text surrounded by vertical space.
 {\BeforeSkip\par\normalfont\upshape\small}
 {\normalfont\normalsize\AfterSkip}
 % For corrections. Usage: \DPtypo{txet}{text}, \DPnote{[** Text of note]}
 % PPer needs to add a boolean FixTypos flag and amplify definition
 \newcommand{\DPtypo}[2]{#1}
 \newcommand{\DPnote}[1]{}
 % To facilitate table alignment; sets #3 in a box of width #2, aligned at #1 (default [c])
 % Examples: \PadTo{feet per sec.}{\Ditto}, \PadTo[l]{The value is}{2.}
 \newlength{\TmpLen}
 \newcommand{\PadTo}[3][c]{%
   \settowidth{\TmpLen}{$#2$}%
   \makebox[\TmpLen][#1]{$#3$}%
 }

 \pagestyle{empty}
 % Ditto mark; requires textcomp
 \newcommand{\Ditto}{\raisebox{1ex}{\textquotestraightdblbase}}
 \DeclareInputText{176}{\ifmmode{{}^\circ}\else\textdegree\fi}
 \DeclareInputText{183}{\ifmmode\cdot\else\textperiodcentered\fi} 
 % Misc textual abbreviations
 \newcommand{\Ie}{\textit{i.e.}}
 \newcommand{\Eg}{\textit{e.g.}}
 \newcommand{\Nb}{\textit{N.B.}}
 \newcommand{\Qed}{Q.E.D\@.}
 \newcommand{\BC}[1]{% Use "\BC\ " or "\BC," mid-sentence, "\BC." at the end of a sentence.
   \ifthenelse{\equal{#1}{.}}
   {{\footnotesize B.C\@.} }% ** Final space needed only to avoid wiki misinterpretation
   {{\footnotesize B.C.}#1}%
 }
 \newcommand{\AD}[1]{%
   \ifthenelse{\equal{#1}{.}}
   {{\footnotesize A.D\@.} }% ** See note above
   {{\footnotesize A.D.}#1}%
 }