TEX-PRETTY 1 "19 June 1995" "Version 0.00" [section 6 of 9]

.-3[DESCRIPTION]         .-2[OPTIONS]         .-1[FORMATTING ACTIONS]
Top
.+1[LIMITATIONS]     .+2[SEE ALSO]         .+3[AUTHOR]


STYLE FILES

In the current implementation of tex-pretty, all of the standard AmSTeX, AmSLaTeX, ETeX, LAmSTeX, LaTeX, and SliTeX control words, environments, and comment syntax that require special formatting are hard-coded into the program. However, users can define new control sequences and environments with TeX \def, \edef, \gdef, and \xdef commands, and with LaTeX \newcommand, \newenvironment, \newtheorem, ... commands.

In order to allow the user to control the formatting of these new features, tex-pretty supports a simple style file mechanism. At startup, it processes a style file in the user's home directory, and another in the current directory. Neither of these need exist. During command-line argument processing, additional style files can be provided with the -s option. These style files support user-specific, directory-specific, and file-specific prettyprinting control.

The default name of the first two style files is system dependent: .texprettyrc (UNIX), texpty.ini (IBM PC DOS), and texpretty.ini (DEC VMS and OpenVMS).

The line length limit in style files is system-dependent, but guaranteed to be at least 1024 characters.

tex-pretty's formatting actions group control sequences into the following style classes:

chapter
sectional division

LAmSTeX: \docstyle \subtopic \topic

LaTeX: \appendix \backmatter \chapter \documentclass \documentstyle \frontmatter \mainmatter \paragraph \part \section \subparagraph \subsection \subsubsection

plain TeX: \beginchapter \beginsection \endchapter

chapter-line
sectional division with argument all text to end of line

TeXinfo: @chapter @section @subsection @subsubsection @unnumbered @unnumberedsec @unnumberedsubsec @unnumberedsubsubsec
cite
literature citation

LAmSTeX and LaTeX: \cite

LaTeX: \nocite

TeXinfo: @cite

command-argument
control sequence with its braced argument on same line

TeXinfo: @code @emph @kbd @key @ref @samp @TeX @var @w @xref
command-line
control sequence with argument all text to end of line

TeXinfo: @auindex @cindex @defcodeindex @defindex @findex @kindex @pindex @printindex @shorttitlepage @tindex @vindex
comment
comment to end of line (any TeX)

all but TeXinfo: %

TeXinfo: @c @comment

default

all but TeXinfo: unrecognized backslash control sequences

TeXinfo: @ETC @b @bullet @copyright @dfn @dmn @dots @enddots @equiv @expansion @file @headword @i @math @minus @occur @par @point @print @pxref @r @refill @regularbooksize @result @sc @strong @t @thischapter @thischaptername @thisfile @thispage @thistitle @titlefont @today @value

displaymath
displayed mathematics

any TeX: $$

LaTeX: \begin{displaymath} \end{displaymath} \[ \]

environment
text group with specialized formatting

AmSTeX: \CD \endCD \Refs \endRefs \Sb \endSb \Sp \endSp \Vmatrix \endVmatrix \abstract \endabstract \affil \endaffil \align \endalign \alignat \endalignat \aligned \endaligned \alignedat \endalignedat \block \endblock \bmatrix \endbmatrix \cases \endcases \cfrac \endcfrac \comment \endcomment \curraddr \endcurraddr \dedicatory \enddedicatory \definition \enddefinition \demo \enddemo \document \enddocument \email \endemail \example \endexample \gather \endgather \gathered \endgathered \graf \endgraf \head \endhead \keywords \endkeywords \matrix \endmatrix \multline \endmultline \pmatrix \endpmatrix \proclaim \endproclaim \remark \endremark \smallmatrix \endsmallmatrix \specialhead \endspecialhead \split \endsplit \subhead \endsubhead \subjclass \endsubjclass \subsubhead \endsubsubhead \toc \endtoc \topmatter \endtopmatter \translator \endtranslator \vmatrix \endvmatrix \xalignat \endxalignat \xxalignat \endxxalignat

LAmSTeX: \Figure \endFigure \Figurepair \endFigurepair \Figuretriple \endFiguretriple \HL \endHL \Table \endTable \bdmatrix \endbdmatrix \claim \endclaim \heading \endheading \island \endisland \makebib \endmakebib \partition \endpartition

LaTeX (with exceptions given in other classes): \begin{envname} \end{envname}

plain TeX: \begingroup \endgroup \bgroup \egroup

TeXinfo: @cartouche @display @end @flushleft @flushright @format @group @ifinfo @iftex @quotation @smallexample @smalllisp @titlepage

footnote
comment and newline before

ETeX: \numberedfootnote

LAmSTeX: \plainfootnote \plainproclaim

LaTeX: \footnote \footnotetext \label \pageref \ref

plain TeX: \vfootnote

TeXinfo: @footnote

index
index and glossary

ETeX: \idx \idxmarked \idxname \idxsubmarked \sidx \sidxmarked \sidxname \sidxsubmarked

LaTeX: \glossary \index

list
list of items

AmSTeX: \roster \endroster

ETeX: \numberedlist \endnumberedlist \orderedlist \endorderedlist \unorderedlist \endunorderedlist

LAmSTeX: \bib \endbib \bullist \endbullist \describe \enddescribe \list \endlist \margins \endmargins

LaTeX: \begin{description} \end{description} \begin{enumerate} \end{enumerate} \begin{itemize} \end{itemize} \begin{list} \end{list} \begin{thebibliography} \end{thebibliography} \begin{trivlist} \end{trivlist}

TeXinfo: @enumerate @ftable @itemize @table @vtable

list-item
item in a list

AmSTeX: \runinitem

LaTeX: \bibitem \item

plain TeX: \itemitem

TeXinfo: @item @itemx

math
inline mathematics

any TeX: $

LaTeX: \begin{math} \end{math} \( \)

newline-after
newline after control sequence

LaTeX: \ \* \kill

plain TeX: \cr \crcr \endline

TeXinfo: @*

newline-before
newline before control sequence

AmSLaTeX: \DeclareMathOperator \DeclareMathSymbol \DeclareSymbolFont \numberwithin \swapnumbers \newtheoremstyle \theoremstyle

AmSTeX: \adjustfootnotemark \book \bookinfo \bookinquotes \botcaption \by \bysame \captionwidth \define \ed \eds \finalinfo \inbook \issue \jour \lang \moreref \newsymbol \no \noquotes \page \pages \paper \paperinfo \paperinquotes \parshape \preaffil \preauthor \predate \predefine \prepaper \pretitle \publ \publaddr \redefine \shoveleft \shoveright \toappear \topcaption \transl \undefine \vol \widestnumber \yr

ETeX: \defineindex \definecontentsfile \center \columnfill \doublecolumns \edefappend \flushleft \flushright \for \iffileexists \innerdef \innerinnerdef \innernewbox \innernewcount \innernewdimen \innernewfam \innernewhelp \innernewif \innernewinsert \innernewmuskip \innernewread \innernewskip \innernewtoks \innernewwrite \listing \makecolumns \quadcolumns \readindexfile \readtocfile \testfileexistence \tocchapterentry \tocsectionentry \triplecolumns \writenumberedtocentry \writetocentry

LAmSTeX: \Cgaps \Entry \Entryxref \LETTER \Morexref \Noexpand \Nonexpanding \Offset \Page \PageSpan \Pagespan \PostCDSpace \PreCDSpace \Reset \Rgaps \Topage \Xref \cgaps \cleartable \counter \everytable \ex \exs \flushpar \fnote \foottext \hL \hdashed \hl \hls \htablelines \iabbrev \idefine \litbackslash \litdelimiter \mainfile \makepiece \manyby \measuretable \modifyfootnote \nameHL \namehl \newHL \newclaim \newfontstyle \newhl \newisland \newnumstyle \newpost \newpre \newstyle \newword \note \pageorder \postCDspace \postdocstyle \preCDspace \predocstyle \pullin \pullinmore \purge \readaux \rgaps \runningchapter \runningsection \shortenclaim \showstored \sss \storetable \tablewidth \tbldocstyle \tdefine \toclevel \tredefine \tss \unpurge \usetable \vleft \vright \vs \vsolid \vtablelines

LAmSTeX and LaTeX: \author \date \thanks \title

LaTeX: \address \caption \closing \glossaryentry \include \includeonly \indexentry \makeglossary \makeindex \marginpar \markboth \markright \multiput \newblock \newboolean \newcommand \newcounter \newenvironment \newlength \newsavebox \newtheorem \opening \printindex \providecommand \put \renewcommand \renewenvironment \signature \typein \typeout \usepackage \vspace

plain TeX: \centerline \chardef \closein \closeout \countdef \def \dimendef \edef \else \endinput \eqalign \eqalignno \errmessage \fi \futurelet \futurenonspacelet \gdef \global \halign \hang \hoffset \hyphenation \ialign \if \ifcase \ifcat \ifdim \ifeof \iffalse \ifhbox \ifhmode \ifinner \ifmmode \ifnum \ifodd \iftrue \ifundefined \ifvbox \ifvmode \ifvoid \ifx \immediate \input \leftline \leqalignno \let \line \listing \loop \magnifiction \mark \mathchardef \message \narrower \newbox \newcount \newdimen \newfam \newhelp \newif \newinsert \newmuskip \newread \newskip \newtoks \newwrite \noalign \openin \openout \parindent \read \repeat \rightline \show \showbox \showboxbreadth \showdepth \showhyphens \showlists \showthe \skipdef \special \tabalign \textindent \toksdef \tracingall \tracingcommands \tracinglostchars \tracingmacros \tracingonline \tracingoutput \tracingpages \tracingparagraphs \tracingrestores \tracingstats \vadjust \valign \voffset \vskip \write \xdef

TeXinfo: @appendix @appendixsec @appendixsection @appendixsubsec @appendixsubsubsec @asis @inforef @setfilename @vskip

standalone
control sequence isolated on its own line

AmSLaTeX: \allowdisplaybreaks \displaybreak

AmSTeX: \BlackBoxes \CenteredTagsOnSplits \ChangeBuffer \LimitsOnInts \LimitsOnNames \LimitsOnSums \Monograph \MultLineGap \NoBlackBoxes \NoPageNumbers \NoRunningHeads \ResetBuffer \Runinitem \TagsAsMath \TagsAsText \TagsOnLeft \TagsOnRight \TopOrBottomTagsOnSplits \UseAMSsymbols \UseBibTeX \captionwidth \endinsert \foldedpar \galleys \hcorrection \ininbook \loadbold \loadeufb \loadeufm \loadeurb \loadeurm \loadeusb \loadeusm \loadmsam \loadmsbm \midinsert \multlinegap \operatorname \pageheight \pageinsert \pagewidth \printoptions \showallocations \spreadlines \spreadmatrixlines \syntax \topinsert \vcorrection

LAmSTeX: \Figureproofing \FlushedFigs \Initialize \NS \NoFlushedFigs \RefWarnings \alldq \boxedtables \columnbreak \continuelist \figureproofing \indexfile \indexproofing \inlevel \keepitem \makelistFigures \makelistTables \makelistfigures \makelisttables \maketoc \newcolumn \noFigureproofing \nocolumnbreak \nofigureproofing \noshowsecondpass \opentables \outlevel \shortlastcolumn \showcolwidths \showsecondpass \sides \ssizeCDlabels \tocfile \tsizeCDlabels

LAmSTeX and LaTeX: \bibliography \bibliographystyle

LaTeX: \bigpagebreak \cleardoublepage \clearpage \definecolor \enlargethispage \flushbottom \fussy \hline \indexspace \linebreak \listfiles \listoffigures \listoftables \maketitle \medpagebreak \newline \newpage \nofiles \nolinebreak \nopagebreak \nopagenumbers \normalbottom \normalmarginpar \onecolumn \onlynotes \onlyslides \pagebreak \pagecolor \pagenumbering \pagestyle \raggedleft \reversemarginpar \sloppy \smallpagebreak \suppressfloats \tableofcontents \thispagestyle \twocolumn

plain TeX: \allowbreak \annotations \batchmode \bigbreak \bigskip \body \break \bye \centering \dosupereject \eject \endletter \errorstopmode \filbreak \frenchspacing \goodbreak \indent \leavevmode \makelabel \medbreak \medskip \noindent \nonfrenchspacing \nonstopmode \par \raggedbottom \raggedcenter \raggedright \removelastskip \scrollmode \smallbreak \smallskip \ttraggedright \vfil \vfilneg \vfill

TeXinfo: @afourpaper @bye @contents @cropmarks @finalout @lowersections @noindent @page @raisesections @shortcontents @smallbook @summarycontents

tabular
tabular text

LaTeX: \begin{tabular} \end{tabular} \begin{tabular*} \end{tabular*}
verb
inline verbatim

ETeX: \verbatim (may contain line breaks, and doubled delimiters representing a single character)

LAmSTeX: \Lit \lit (\Lit can contain line breaks, but its syntax is that of \lit)

LaTeX: \verb \verb*

any TeX: \path

verbatim
multiline verbatim environment

LaTeX: \begin{verbatim} \end{verbatim} \begin{verbatim*} \end{verbatim*}

TeXinfo: @defcv @deffn @defivar @defmac @defmethod @defop @defopt @defspec @deftp @deftypefn @deftypefun @deftypefunx @deftypevar @deftypevr @defun @defunx @defvar @defvr @example @ignore @lisp @menu @tex

The style class default can be used to force a command or environment to revert to the default formatting rules: no special indentation for commands, and normal indentation for environments. You can use this to override earlier style file settings, and most of the built-in ones.

Style class names, like TeX control sequences and LaTeX environments, are case sensitive. All of the ones recognized by tex-pretty must be spelled with lowercase letters.

The style file is expected to contain lines of the form:

style-class : envname1 envname2 ... \command1 \command2 ...
Blank lines, leading and trailing whitespace, and text from the TeX comment character (%) to end of line, are ignored. Whitespace separates items, and can be omitted around the colon. There is no significance to the order of items on a line, or lines in the file, except that later settings can override earlier ones. The same style class name may occur on multiple lines.

For example, suppose you have defined new sectional division commands named \Kapitel and \Teil, a new tabular environment named \SuperTabular, and two new display math environments named EasyMath and HardMath. Your style file might then look something like this:

% additional tex-pretty style specifications
% [02-Jun-1995]
chapter :       \Kapitel \Teil
tabular :       SuperTabular
displaymath :   EasyMath HardMath

LaTeXinfo is, sadly, less widely used than TeXinfo; it supports most of the standard LaTeX commands, plus a few others: some additional sectioning and indexing commands, two comment-start macros (\c and \comment), a hypertext link macro (\node) and a menu environment in which line breaks are significant. Here is a suitable tex-pretty style file for LaTeXinfo files (there are additional LaTeXinfo control sequences not listed here, but they do not require any particular special formatting):

% LaTeXinfo style file for tex-pretty
% [08-Jun-1995]
chapter        : \unnumbered \unnumberedsec \unnumberedsubsec
chapter        : \unnumberedsubsubsec
comment        : \c \comment \node
index          : \cindex \cpindexbold \cpsubindex \findex
index          : \kindex \pindex \tindex \vindex
newline-after  : \* \br
newline-before : \copyright \newindex \setfilename \synindex
verbatim       : ifinfo ignore menu
The \node macro can be handled by the comment class because all of its arguments follow on the same line, up to the end of the line. Menu environments are usually laid out neatly, because their formatting is preserved exactly in the ASCII output used for online info documentation; prettyprinting them in verbatim mode ensures that the layout will be retained. The \* macro will actually not be recognized in the current version of tex-pretty, because macro names definable in style files may contain only letters after the leading backslash. In this case, no harm will arise, since the default formatting of control sequences containing special characters is adequate.

There is no built-in support in tex-pretty for LaTeXinfo, because it has not achieved widespread use; however, the style file above should be sufficient for tex-pretty to prettyprint LaTeXinfo files correctly.

The last style class attached to command or environment name is the one that is used, so specifications in a command-line style file can override those in the current directory style file, and those in turn override settings from the home directory style file.

The -d and -t command-line options affect the prettyprinting of all commands in the math and tabular classes.

Don't use the -m math mode translation option if you specify the math class in a style file; if you do, those commands and environments will be renamed. When math mode translation is selected, it may also be advisable to specify the -q option, and avoid -s options, to eliminate all style file input.

For the purposes of matching TeX control words, tex-pretty assumes that they begin with a backslash followed by one or more letters or at-sign; the latter is commonly used inside macro packages to create command names that are supposed to be hidden from the end user. There is no provision in style files for modifying this assumption.

Occasionally, it may be desirable to have a control sequence and its arguments handled together as an indivisible unit. To support this, control sequences in style files may be followed by zero or more of the following patterns, in whatever order is required:

*
Match an optional literal asterisk; LaTeX uses this for variant forms.
[]
Match an optional argument in balanced brackets (LaTeX).
""
Match an optional argument in quotes (AmSTeX and LAmSTeX).
()
Match a required argument in balanced parentheses (LaTeX).
{}
Match a required argument in balanced braces (any TeX).
\
Match an alphabetic control sequence (LAmSTeX).
These patterns are ignored for index, verb, and verbatim style classes, because they have their own specialized formatting requirements.

Here is a sample style file that illustrates the use of argument patterns:

default        : \makebox()[]{} % LaTeX
list-item      : \item""        % AmSTeX and LAmSTeX
standalone     : \Reset\        % LAmSTeX: e.g. \Reset \list
When argument patterns are processed, whitespace before and between arguments in the input stream is discarded as long as an argument match is found. Arguments themselves are copied verbatim, even if they include line breaks or comments. The only requirement is that braced, bracketed, or parenthesized arguments have balanced delimiters.

Control sequence name matching against style file specifications does not include any argument patterns, so if the same control sequence name is specified more than once in a style file, as in

list-item      : \myitem"" \myitem() \myitem[] \myitem{}
only the last one will be effective, in this case, a required braced argument. This should not normally be a serious limitation, because TeX control sequence definitions that include argument delimiter characters also have this behavior. However, it is possible with special programming to use one-character lookahead to distinguish between argument types, and LaTeX does this internally for optional bracketed arguments, and asterisked variants.

.-3[DESCRIPTION]         .-2[OPTIONS]         .-1[FORMATTING ACTIONS]
Top
.+1[LIMITATIONS]     .+2[SEE ALSO]         .+3[AUTHOR]