%%% ==================================================================== %%% @LaTeX3-article{ LaTeX3-LTX3-002c, %%% filename = "l3d002c.tex", %%% archived = "ctan:/tex-archive/info/ltx3pub/", %%% related-files = "part of l3d002.tex", %%% author = "David Rhead", %%% doc-group = "Project core team", %%% title = "Some ideas for improving {\LaTeX}\\ General", %%% version = "1.1", %%% date = "18-Mar-1993", %%% time = "20:19:36 GMT", %%% status = "public, official", %%% abstract = "Ideas and suggestions from David Rhead for %%% improving various areas in LaTeX", %%% note = "prepared for the workshop at Dedham 91", %%% keywords = "", %%% project-address = "LaTeX3 Project \\ %%% c/o Dr. Chris Rowley \\ %%% The Open University \\ %%% Parsifal College \\ %%% Finchley Road \\ %%% London NW3 7BG, England, UK", %%% project-tel = "+44 171 794 0575", %%% project-FAX = "+44 171 433 6196", %%% project-email = "LTX3-Mgr@SHSU.edu", %%% copyright = "Copyright (C) 1993 LaTeX3 Project %%% All rights reserved. %%% %%% Permission is granted to make and distribute %%% verbatim copies of this publication or of %%% coherent parts from this publication provided %%% this copyright notice and this permission %%% notice are preserved on all copies. %%% %%% Permission is granted to copy and distribute %%% translations of this publication or of %%% individual items from this publication into %%% another language provided that the translation %%% is approved by the original copyright holders. %%% %%% No other permissions to copy or distribute this %%% publication in any form are granted and in %%% particular no permission to copy parts of it %%% in such a way as to materially change its %%% meaning.", %%% generalinfo = "To subscribe to the LaTeX3 discussion list: %%% %%% Send mail to listserv@vm.urz.uni-heidelberg.de %%% with the following line as the body of the %%% message (substituting your own name): %%% %%% subscribe LaTeX-L First-name Surname %%% %%% To find out about volunteer work: %%% %%% look at the document vol-task.tex which can %%% be obtained electronically, see below. %%% %%% To retrieve project publications electronically: %%% %%% Project publications are available for %%% retrieval by anonymous ftp from ctan hosts: %%% ftp.tex.ac.uk %%% ftp.dante.de %%% ftp.shsu.edu %%% in the directory /tex-archive/info/ltx3pub. %%% %%% The file ltx3pub.bib in that directory gives %%% full bibliographical information including %%% abstracts in BibTeX format. A brief history %%% of the project and a description of its aims %%% is contained in l3d001.tex. %%% %%% If you only have access to email, and not ftp %%% You may use the ftpmail service. %%% Send a message just containg the word %%% help %%% to ftpmail@ftp.shsu.edu %%% for more information about this service. %%% %%% For offers of financial contributions or %%% contributions of computing equipment or %%% software, contact the project at the above %%% address, or the TeX Users Group. %%% %%% For offers of technical assistance, contact the %%% project at the above address. %%% %%% For technical enquiries and suggestions, send %%% e-mail to the latex-l list or contact the %%% project at the above address.", %%% checksum = "51871 347 2131 16546", %%% docstring = "The checksum field above contains a CRC-16 %%% checksum as the first value, followed by the %%% equivalent of the standard UNIX wc (word %%% count) utility output of lines, words, and %%% characters. This is produced by Robert %%% Solovay's checksum utility.", %%% } %%% ==================================================================== \chapter{Support for accurate page-selection from {\tt dvi} files} \label{counts} \section{Objectives} Although I assume that it is open to anyone writing style-files to do whatever they like with the 10 \verb+\count+ registers \cite[p.\ 119]{knuth-90}, I think that it would be worth trying to set a good precedent in the \LaTeX\ 3.0 \lq\lq standard styles''. I therefore suggest that there should be a scheme for using the \verb+\count+ registers in such a way that pages can always be specified unambiguously in those {\tt report}-like and {\tt book}-like documents that have: \begin{itemize} \item roman-numbered \lq\lq front matter'' followed by arabic-numbered body text, and/or \item pages numbered \lq\lq within chapters''. \end{itemize} In practice, I have the impression that documents which have pages numbered \lq\lq within chapters'' are in a minority. It may therefore be worth having a scheme that can be used selectively, i.e, such that, if a style-file writer knows that it will be important to distinguish between certain units of a document but not between others, the \verb+\count+s for the former can have the non-zero values given by the scheme, while those for the latter can be zero. This would make for consistency (i.e., if a \verb+\count+ is non-zero, then it would be used in the same way in one standard style-file as in another) without unnecessary clutter (e.g., if all \verb+\count+ registers but \verb+\count0+ can be set zero without ambiguity, the user would get monitoring of the form {\tt [1] [2] [3] [4] ...\ } rather than of the form {\tt [1.1.1] [2.1.1] [3.1.1] [4.1.1] ...\ }). \section{A scheme} \label{a-scheme} The following scheme would probably achieve the objectives suggested above. \begin{center} \begin{footnotesize} \begin{tabular}{lllll} \hline\hline Major division & Minor divisions&\verb+\count0+&\verb+\count1+&\verb+\count2+\\ \hline\hline Front matter & --- & page-number & {\tt -1} & {\tt 0} \\ \hline Main text & chapters & page-number & chapter-number & {\tt 0} \\ & & & {\tt 1, 2, ... }& \\ \hline Back matter: & appendices &page-number&appendix number& {\tt 1}\\ appendices & & & {\tt 1, 2, ... }& \\ \hline Back matter: & glossary, &page-number&other-unit & {\tt 2}\\ other units & bibliography, & &number \\ & index, etc. & & {\tt 1, 2, ... } \\ \hline\hline \end{tabular} \end{footnotesize} \end{center} \subsection*{Examples} \begin{enumerate} \item A pamphlet that is numbered in arabic throughout would only use \verb+\count0+. \item A traditional book could have \verb+\count1+ set to {\tt -1} in the front matter and set to {\tt 0} thereafter. \item A manual that is to be numbered in the style of DEC's VAX/VMS manuals would use the full scheme, i.e. \begin{itemize} \item \verb+\count2+ set to {\tt 1} within the appendices and set to {\tt 2} after the appendices \item \verb+\count1+ set to {\tt -1} in the front matter, set to \lq\lq chapter number'' within the body text, set to \lq\lq appendix number'' or \lq\lq other-unit number'' in the \lq\lq back matter''. \item \verb+\count0+ reset at the start of each chapter and each unit of \lq\lq back matter''. \end{itemize} \item It would be open to someone producing a style-file for a \lq\lq traditional book'' to increment \verb+\count1+ and \verb+\count2+ in the way suggested for \lq\lq a manual'' above, even though \verb+\count0+ would {\em not} be reset at the start of each chapter. Although (after the \lq\lq front matter'') neither \verb+\count1+ nor \verb+\count2+ would affect the printed page-numbers, their settings would, for example, enable someone \begin{itemize} \item using DVItoVDU \cite{trevorrow-86} to give a command that means \lq\lq go to the start of chapter 2'' \item using {\tt dviselect} \cite{torek} to specify \lq\lq pick out all the pages in chapter 2''. \end{itemize} \end{enumerate} Thus there would be consistency across most common classes of document regarding the use of non-zero settings for the \verb+\count+ registers, but the number of registers used in a particular style-file could, if desired, be limited to those needed to avoid ambiguous page-specifications at the {\tt dvi}-file processing stage. \subsection*{Notes} \noindent \begin{enumerate} \item Although the \verb+\count+ registers give 10 possible \lq\lq dimensions'' of page-identification, Knuth defines yet another \lq\lq dimension'' with the \lq\lq roman-numbered pages have a negative \verb+\count0+'' convention in the \lq\lq plain'' macros \cite[p.\ 252,362]{knuth-90}. I guess that the \lq\lq plain'' macros are intended for typesetting a certain class of document (draft papers?), and that the convention is adequate for this class. However, \LaTeX\ is intended to be used for a wide variety of classes of documents, so I think it is better to \lq\lq start from first principles'' and find a scheme that can cope well with the classes of documents for which \LaTeX\ is likely to be used. The scheme suggested in the above table does not aim for compatibility with \lq\lq plain'' since: \begin{itemize} \item in terms of \lq\lq logical structure'' there doesn't seem any reason to treat \verb+\count0+ differently in the \lq\lq front matter'' rather than (for example) in \lq\lq chapter 2'' or in the \lq\lq back matter''. \item if the end-user learns that \lq\lq \verb+\count1+ and \verb+\count2+ specify the division you are in'', this will be the only concept they need. They can select the 4th page in the \lq\lq front matter'' and page 4 of chapter 5 in a consistent way, e.g., if {\tt dvitops} \cite{clark} is used, \begin{verbatim} dvitops -f 4.-1 root \end{verbatim} and \begin{verbatim} dvitops -f 4.5 root \end{verbatim} respectively. If \LaTeX\ 3.0 had the additional concept that \lq\lq roman-numbered pages have \verb+\count0+ negative'', this would be an unnecessary, redundant, concept for the end-user to learn. \end{itemize} \item In terms of \lq\lq logical structure'', there is a case for treating the \lq\lq front matter'' in precisely the same way as the \lq\lq back matter''. This would imply the modifications shown below: \begin{center} \label{modification} \begin{footnotesize} \begin{tabular}{lllll} \hline\hline Major division & Minor divisions&\verb+\count0+&\verb+\count1+&\verb+\count2+\\ \hline\hline Front matter & table-of-contents,& page-number&{\tt 1} & {\tt -1} \\ & list-of-figures, & &{\tt 2} \\ & acknowledgements, & &{\tt 3} \\ & preface, etc. & &{\tt 4, ...}\\ \hline \dots \\ \hline\hline \end{tabular} \end{footnotesize} \end{center} My impression is that, in practice, the scheme shown on page \pageref{a-scheme} would be adequate since there is generally less \lq\lq front matter'' than \lq\lq back matter''. End-users would probably prefer to issue a command such as \begin{verbatim} dvitops -f 4.-1 root \end{verbatim} (as implied by the scheme shown on page \pageref{a-scheme}) to select the 4th page of their \lq\lq front matter'' rather than \begin{verbatim} dvitops -f 4.*.-1 root \end{verbatim} (as implied by the modified scheme shown on page \pageref{modification}). \item If desired, the scheme shown on page \pageref{a-scheme} could be modified to remove the need for \verb+\count2+ to be non-zero after the appendices. For example, the convention might be: \begin{center}\begin{footnotesize}\begin{tabular}{lllll} \hline\hline Major division & Minor divisions&\verb+\count0+&\verb+\count1+&\verb+\count2+\\ \hline\hline \dots \\ \hline Back matter: & glossary & page-number&{\tt -2} & {\tt 0} \\ other units & bibliography & & \\ & index, etc. & & \\ \hline\hline \end{tabular}\end{footnotesize}\end{center} Although this modified scheme would not eliminate ambiguity when people are selecting pages from documents that are numbered like DEC's VAX/VMS manuals (in which each \lq\lq other unit'' of \lq\lq back matter'' has page-numbers starting from 1), but it might be argued that such manuals are fairly rare. \end{enumerate} \section{Some e-mail comments} \begin{footnotesize}\begin{verbatim} From: bbeeton Date: Thu, 27 Jun 91 11:13:09 CET re making page numbers distinct, at the american math society, we faced this problem long ago (though not in latex). the circumstance was multi-column pages where each column had to be output separately on account of memory limitations (this was tex80), and "pasted up" by the output driver. the convention we devised (and still use with some publications) is \count0 = \pageno (for compatibility with plain) \count1 = column within page (for consistency, if 1-column pages were mixed with 2-column pages -- an everyday occurrence -- two "logical" pages were put in the dvi file for each "physical" page) \count2 = sequential counter, 1, ..., col x number of pages although it doesn't necessarily bear any clear relation to the printed page number, the sequential counter does guarantee a unique value that can be homed in on by a device driver (although not all device drivers may give you access to all ten counters, a difficulty that should be decreasing), and is very nicely reported by tex in the transcript file. if used in conjunction with some more descriptive scheme, it gives a useful value that can help one identify pages properly even to a driver that gives no access at all to the tex counters but always considers the first page of a dvi file to be page "1" (another driver lapse that should mercifully soon be a thing of the past). \end{verbatim}\end{footnotesize} \begin{center} --- \end{center} \begin{footnotesize}\begin{verbatim} From: eijkhout@EDU.UIUC.CSRD Date: Thu, 27 Jun 91 08:45:10 -0500 David Rhead's problem is a legitimate one. Here's how I have solved it (for the moment) in my own format: - use count0 for counting succesful shipouts by the output routine; - use count1 for keeping track of the number at the top/bottom of the page. That way the user can let the page number jump any way s/he likes, and still no dvice driver will ever complain about pages not found, which could still happen if count0 is merely the page number. I guess this could be augmented by a facility to print both counters at the page bottom, but I found it easy enough to read the correspondence from the log file (the joys of X windows: there is always some corner left on the screen to display some piece of information). Victor Eijkhout \end{verbatim}\end{footnotesize}