%================================================= % Format this document with LaTeX and with % latexinfo-format-buffer. The output of both % makes up this report. %================================================= % -*-latex-*- % Document name: /u/beebe/tex/talks/ltxmode/bug.ltx % Creator: Nelson H. F. Beebe [beebe@rios.math.utah.edu] % Creation Date: Sat Oct 5 06:55:54 1991 \documentstyle[latexinfo]{article} \begin{iftex} \c We need to allow hyphenation at - characters in \c \tt fonts. \global\hyphenchar\nintt = `\- \global\hyphenchar\tentt = `\- \global\hyphenchar\elvtt = `\- \global\hyphenchar\twltt = `\- \end{iftex} \title{ \LaTeX{}info Bugs, Misfeatures, and Comments } \author{ Nelson H. F. Beebe\\ Center for Scientific Computing\\ Department of Mathematics\\ South Physics Building\\ University of Utah\\ Salt Lake City, UT 84112\\ USA\\ Tel: (801) 581-5254\\ FAX: (801) 581-4148\\ E-mail: {\tt beebe@math.utah.edu} } \date{07 October 1991} \begin{document} \maketitle \tableofcontents \setfilename{bug.info} \section{Introduction} I have just completed the conversion of part of a TUGboat article on my \LaTeX{} editing support in \file{latex.el} to \LaTeX{}info format to serve as printed and on-line documentation of this major new editing mode.\refill These two are very complex documents. The TUGboat article is 27 pages long, with a 5 1/2 page index, very extensive cross-referencing, and heavy use of font changes to make semantic distinctions in the text. The printed \LaTeX{}info document is 62 pages long, with 6 indexes spanning 16 pages.\refill Except for minor changes in wording because of \LaTeX{}info limitations, the body text of the \LaTeX{}info version is intended to be an exact word-for-word equivalent of part of the TUGboat article.\refill The conversion from \LaTeX{} format to \LaTeX{}info format turned out to be more difficult than I expected, and this report summarizes my experiences. It is itself formatted as a \LaTeX{}info file, to illustrate some formatting problems with \LaTeX{}info version 1.3.5 in the \code{info} file output by \code{latexinfo-format-buffer}.\refill \section{Bug in comment handling} \code{\back c} does not act like a true \TeX{} comment; it should flush characters from itself to end-of-line, then \emph{all leading whitespace on the next line, up to, but not including, the next newline}.\refill This impact of this can be seen in an \code{\back itemize} environment with indented text and index entries.\refill The \LaTeX{}info input \begin{verbatim} \begin{itemize} \item This item has leading whitespace in the input file.\refill If the dot ends an ellipsis,\c \cindex{ellipsis} the three dots are replaced by \samp{\back ldots\{\}}.\c \pindex{\back ldots\{\}}\refill Blah blah blah blah blah blah blah blah blah blah blah. Blah blah blah blah blah blah blah blah blah blah blah. Blah blah blah blah blah blah blah blah blah blah blah. Blah blah blah blah blah blah blah blah blah blah blah. Blah blah blah blah blah blah blah blah blah blah blah.\refill \item This item has \emph{no} leading whitespace in the input file.\refill If the dot ends an ellipsis,\c \cindex{ellipsis} the three dots are replaced by \samp{\back ldots\{\}}.\c \pindex{\back ldots\{\}}\refill Blah blah blah blah blah blah blah blah blah blah blah. Blah blah blah blah blah blah blah blah blah blah blah. Blah blah blah blah blah blah blah blah blah blah blah. Blah blah blah blah blah blah blah blah blah blah blah. Blah blah blah blah blah blah blah blah blah blah blah.\refill \end{itemize} \end{verbatim} \noindent produces the \code{info} output \begin{verbatim}  * This item has leading whitespace in the input file. If the dot ends an ellipsis, the three dots are replaced by `\ldots{}'. Blah blah blah blah blah blah blah blah blah blah blah. Blah blah blah blah blah blah blah blah blah blah blah. Blah blah blah blah blah blah blah blah blah blah blah. Blah blah blah blah blah blah blah blah blah blah blah. Blah blah blah blah blah blah blah blah blah blah blah.  * This item has *no* leading whitespace in the input file. If the dot ends an ellipsis, the three dots are replaced by `\ldots{}'. Blah blah blah blah blah blah blah blah blah blah blah. Blah blah blah blah blah blah blah blah blah blah blah. Blah blah blah blah blah blah blah blah blah blah blah. Blah blah blah blah blah blah blah blah blah blah blah. Blah blah blah blah blah blah blah blah blah blah blah. \end{verbatim} \begin{itemize} \item This item has leading whitespace in the input file.\refill If the dot ends an ellipsis,\c \cindex{ellipsis} the three dots are replaced by \samp{\back ldots\{\}}.\c \pindex{\back ldots\{\}}\refill Blah blah blah blah blah blah blah blah blah blah blah. Blah blah blah blah blah blah blah blah blah blah blah. Blah blah blah blah blah blah blah blah blah blah blah. Blah blah blah blah blah blah blah blah blah blah blah. Blah blah blah blah blah blah blah blah blah blah blah.\refill \item This item has \emph{no} leading whitespace in the input file.\refill If the dot ends an ellipsis,\c \cindex{ellipsis} the three dots are replaced by \samp{\back ldots\{\}}.\c \pindex{\back ldots\{\}}\refill Blah blah blah blah blah blah blah blah blah blah blah. Blah blah blah blah blah blah blah blah blah blah blah. Blah blah blah blah blah blah blah blah blah blah blah. Blah blah blah blah blah blah blah blah blah blah blah. Blah blah blah blah blah blah blah blah blah blah blah.\refill \end{itemize} \section{Bug in \protect\code{itemize} handling} If \code{\back begin\{itemize\}} and \code{\back end\{itemize\}} are preceded by whitespace on the line (as is legal in \LaTeX{}, and conventional when \code{\back begin} \dots \code{\back end} indentation according to nesting is used), \code{latexinfo-format-buffer} terminates with an error message: \emph{Extraneous text at beginning of command line}.\refill Here is an example of input that precipitates this:\refill \begin{verbatim} \begin{itemize} \item One \item Two \item Three \end{itemize} \end{verbatim} Presumably this bug exists for other list environments like \code{description}, \code{enumerate}, and \code{thebibliography}.\refill \section{Another bug in \protect\code{itemize} handling} If \code{\back item} entries after the first are not separated by blank lines, they run together.\refill The input \begin{verbatim} Erroneous output:\refill \begin{itemize} \item One one one one one one one one one one one one one one one one one one one one one one one one one one one one one one one.\refill \item Two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two.\refill \item Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre.\refill \end{itemize} Correct output:\refill \begin{itemize} \item One one one one one one one one one one one one one one one one one one one one one one one one one one one one one one one.\refill \item Two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two.\refill \item Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre.\refill \end{itemize} \end{verbatim} \noindent produces this \code{info} output: \begin{verbatim} Erroneous output:  * One one one one one one one one one one one one one one one one one one one one one one one one one one one one one one one. * Two two two two two two two two two two two two two two twotwo two two two two two two two two two two two two two two two. * Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre TreTre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre. Correct output: * One one one one one one one one one one one one one one one one one one one one one one one one one one one one one one one. * Two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two. * Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre. \end{verbatim} Erroneous output:\refill \begin{itemize} \item One one one one one one one one one one one one one one one one one one one one one one one one one one one one one one one.\refill \item Two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two.\refill \item Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre.\refill \end{itemize} Correct output:\refill \begin{itemize} \item One one one one one one one one one one one one one one one one one one one one one one one one one one one one one one one.\refill \item Two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two.\refill \item Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre.\refill \end{itemize} If \code{\back item} has leading whitespace, incorrect formatting is obtained. Compare this list with the previous one.\refill The input is \begin{verbatim} \begin{itemize} \item One one one one one one one one one one one one one one one one one one one one one one one one one one one one one one one.\refill \item Two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two.\refill \item Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre.\refill \end{itemize} \end{verbatim} \noindent and the \code{info} output is \begin{verbatim}  * One one one one one one one one one one one one one one one one one one one one one one one one one one one one one one one.  * Two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two.  * Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre. \end{verbatim} \begin{itemize} \item One one one one one one one one one one one one one one one one one one one one one one one one one one one one one one one.\refill \item Two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two.\refill \item Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre Tre.\refill \end{itemize} \section{Refilling} I find that in practice, I need \code{\back refill} at the end of every paragraph. Is it feasible perhaps to have a single top-level macro like \code{\back alwaysrefill} that would do this globally (excluding of course those environments like \code{example} and \code{verbatim} where line breaks are obeyed)?\refill In any event, it seems a bad idea in the absence of \code{\back refill} to have to format lines according to the length that they will appear in the \code{info} file, which in my view, for readability should be about 60 characters long instead of 70.\refill \section{Blank lines} The \LaTeX{}info manual says on page 8:\refill \begin{verbatim} LaTeX ignores the line-breaks in the input text, except for blank lines, which separate paragraphs. Info generally preserves the line breaks that are present in the input file. Therefore, break the lines in the LaTeXinfo file the way you want them to appear in the output Info file, and let LaTeX take care of itself. Since Info does not normally refill paragraphs when it processes them, a line with commands in it will sometimes look bad after Info has run on it. To cause Info to refill the paragraph after finishing with the other processing, you need to put the command `\refill' at the end of the paragraph. (*Note Refilling Paragraphs and Preventing Indentation::.) \end{verbatim} I find some inconsistencies which make it difficult to control the number of blank lines in the output.\refill One example is sectioning commands: \code{\back section} supplies an extra blank line of its own, and if it is followed by a blank line in the input file, as in this one, two blank lines are present in the \code{info} output. For readability, I usually prefer to have sectioning commands followed by one or more blank lines in the \LaTeX{} file. They do not affect the \LaTeX{} output. Would it be reasonable, perhaps as a user option, to have a command \code{\back ignoreblanklinesafter\{envname\}} to allow user customization of where blank lines are flushed?\refill Another example is a pair of \code{ifinfo} and \code{iftex} environments; the output contains an extra blank line that should not be there. For example, the input\refill \begin{verbatim} Blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah. \begin{iftex} This is for \TeX{}. \end{iftex} \begin{ifinfo} This is for \code{info}. \end{ifinfo} Blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah. \end{verbatim} \noindent produces output with two blank lines that I don't feel should be there:\refill Blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah. \begin{iftex} This is for \TeX{}. \end{iftex} \begin{ifinfo} This is for \code{info}. \end{ifinfo} Blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah.\refill In the \LaTeX{} output, this example is formatted (correctly) as a single paragraph, with the sentence \emph{This is for \TeX{}.} embedded in the middle.\refill \c We need to keep the next part on the same page! \clearpage Another example is \code{verbatim} text. This \code{verbatim} environment occurs embedded in this paragraph\refill \begin{verbatim} Blah blah blah blah blah blah blah blah blah blah. Blah blah blah blah blah blah blah blah blah blah. Blah blah blah blah blah blah blah blah blah blah. \end{verbatim} and yet is preceded, but not followed, by a blank line in the output \code{info} file. The \LaTeX{} output has a blank line before and after the \code{verbatim} lines.\refill Here is the same sort of thing again, but with a blank line before and after the \code{verbatim} environment, which is how I normally write it:\refill \begin{verbatim} Blah blah blah blah blah blah blah blah blah blah. Blah blah blah blah blah blah blah blah blah blah. Blah blah blah blah blah blah blah blah blah blah. \end{verbatim} \noindent This line follows the \code{verbatim} environment, with an explicit \code{\back noindent} before it.\refill These two examples have similar appearance in the \LaTeX{} output, but in the \code{info} file, there is an asymmetry from the extra blank line:\refill \begin{verbatim} Another example is `verbatim' text. This `verbatim' environment occurs embedded in this paragraph Blah blah blah blah blah blah blah blah blah blah. Blah blah blah blah blah blah blah blah blah blah. Blah blah blah blah blah blah blah blah blah blah. and yet is preceded, but not followed, by a blank line in the output info file. The LaTeX output has a blank line before and after the `verbatim' lines. \end{verbatim} \begin{verbatim} Here is the same sort of thing again, but with a blank line before and after the `verbatim' environment, which is how I normally write it: Blah blah blah blah blah blah blah blah blah blah. Blah blah blah blah blah blah blah blah blah blah. Blah blah blah blah blah blah blah blah blah blah. This line follows the `verbatim' environment, with an explicit `\noindent' before it. \end{verbatim} \section{Hyphenation} Since \LaTeX{}info and \TeX{}info are often used to write about Emacs, \TeX{}, \LaTeX{}, and computer programming, a good deal of use is made of typewriter text. In particular, with Lisp code, long words like \code{latexinfo-format-buffer} are common. \LaTeX{} normally turns off hyphenation in typewriter text, which in such cases results in many overfull boxes.\refill I have therefore found it useful to turn hyphenation back on by \TeX{} code like this:\refill \begin{verbatim} \begin{iftex} \global\hyphenchar\nintt = `\- \global\hyphenchar\tentt = `\- \global\hyphenchar\elvtt = `\- \global\hyphenchar\twltt = `\- \end{iftex} \end{verbatim} I suggest that this should be included in \file{latexinfo.sty} as a standard feature, perhaps with a user-callable macro to turn it off and on as needed.\refill \section{Environment nesting} \code{LaTeX-mode} provides for indentation of \code{\back begin} \dots \code{\back end} groups according to their nesting level. This enhances readability and comprehension of document structure.\refill Unfortunately, \LaTeX{}info does not allow leading space on these commands, quitting instead with this error message: \emph{Extraneous text at beginning of command line}.\refill I request that the regular-expression patterns which are used to match these commands in \file{latexinfo.el} be extended to accept leading space on \code{\back begin} and \code{\back end} commands.\refill \section{Verbatim environment} \LaTeX{}info's prohibition of \code{verbatim} environments inside list environments is a serious restriction.\refill I found a workaround for this: code the start as\refill \begin{verbatim} \begin {verbatim} \end{verbatim} \noindent with \emph{two} spaces after the \code{\back begin}, and put the verbatim text in separate \code{iftex} and \code{ifinfo} groups. This is clearly an ugly hack, and does not give correct output in the typeset verbatim text (the spaces after the \code{\back begin} are illegal).\refill Is it feasible to lift this restriction?\refill \section{Verbatim text} Documents of the type such as my TUGboat article make extensive use of \code{\back verb|...|}.\refill \LaTeX{}info does not recognize this; it strips the \code{\back verb} command word, leaving the argument \code{|...|} in the \code{info} output.\refill It should be relatively easy to handle this correctly, turning it into a \code{\back code\{...\}} sequence, with backslashes replaced by \code{\back back}.\refill Please consider adding support for it.\refill \section{Macros} The extensive index of the TUGboat article was facilitated by being able to define macros that generated names in both the text and the index in the appropriate font. Thus, I wrote \code{\back FUNCTION\{LaTeX-mode\}} and \code{\back VARIABLE\{LaTeX-standard-environments\}} to do the job.\refill The lack of macros in \LaTeX{}info and \TeX{}info make the preparation of input for them very painful.\refill \begin{itemize} \item One cannot use meaningful names, like \code{\back FUNCTION}, but instead must mentally map them into the predefined \code{\back code}, \code{\back ctrl}, \code{\back file}, \code{\back kbd}, \code{\back key}, \code{\back samp}, and \code{\back var} commands.\refill \item Repeated constructs must be manually repeated throughout the document, resulting in tedium and worse, inconsistency of formatting when slight variations creep in.\refill \end{itemize} \begin{sloppypar} The TUGboat article index has 1314 entries, and the \LaTeX{}info article has 1127 entries spread over 6 indexes. With this many, obtaining consistency is almost impossible. Not only did I have to manually insert over 1100 \code{[cfkptv]index\{...\}} entries, I had to decide with each one which of the six prefix letters was required, and it took several formatting passes and checking of the indexes to get them right.\refill \end{sloppypar} It seems to me that one of the most important features that \emph{must} be added in future \LaTeX{}info and \TeX{}info versions is a simple macro facility. I don't think that it should be very hard to be able to handle \LaTeX{}-style definitions of the form\refill \begin{verbatim} \newcommand{\FUNCTION}[1]{#1\findex{#1}} \end{verbatim} \noindent and build up a table of user-defined macros that would be searched for during processing, and expanded. I don't believe that it is necessary to try to support the more general macros that \TeX{} provides which involve pattern matching among the arguments, but it should be possible to recognize the simple form\refill \begin{verbatim} \def\FUNCTION#1{#1\findex{#1}} \end{verbatim} as well in both \TeX{}info and \LaTeX{}info. \section{Fonts} I expect that the situation of converting a \LaTeX{} file to a \LaTeX{}info file will not be uncommon in the future. Therefore, widening the subset of \LaTeX{} that is recognized will be desirable. In particular, I think that font switches like \code{\{\back tt ...\}} should be recognized as equivalent to one of the predefined names like \code{\back code} or \code{\back samp}.\refill The status of the italic correction is a mystery to me. If you use \LaTeX{}-style font selection, like\refill \begin{verbatim} {\it italic correction\/} \end{verbatim} \noindent you get in the output\refill \begin{verbatim} {italic correction} \end{verbatim} Is the italic correction provided by \code{\back dfn} and \code{\back emph}, and does it automatically disappear before period and comma? I had thought that writing a \TeX{} macro to do that automatically would be quite difficult, but in the most recent issue of \TeX{}hax, there is a reference to newly-contributed files \file{sty.quote} and \file{sty.italic} on one of the servers that do just that.\refill \section{Braces} Since braces are \TeX{} commands to delimit groups, and disappear from the output except in verbatim text, or when prefixed with a backslash, I maintain that the same thing should apply to the \code{info} output file. At present, the braces remain, as shown by the font example of the last section, which expanded to\refill \begin{verbatim} {italic correction} \end{verbatim} \section{Ties} Ties (the tilde character) are preserved in the \code{info} output; they should be converted to space except inside \code{verbatim} environments and whatever \code{\back verb|...|} maps into.\refill \section{Bibliographies} I found it necessary to manually convert the \file{.bbl} bibliography file and insert it in the \LaTeX{}info document in the form\refill \begin{verbatim} \begin{ifinfo} \chapter*{Bibliography} \begin{description} \item[Alexander:TB7-3-138] James Alexander. \code{Tib}: a reference setting package for \TeX. \emph{TUGBoat}, 7(3):138, October 1986.\refill \item[Alexander:TB8-2-102] James Alexander. \code{Tib}: a reference setting package, update. \emph{TUGBoat}, 8(2):102, July 1987.\refill \end{description} \end{verbatim} Its appearance in the \file{.bbl} file is not very different:\refill \begin{verbatim} \begin{thebibliography}{10} \bibitem{Alexander:TB7-3-138} James Alexander. \newblock {{\Tib: a reference setting package for \TeX}}. \newblock {\em TUGBoat}, 7(3):138, October 1986. \bibitem{Alexander:TB8-2-102} James Alexander. \newblock {{\Tib: a reference setting package, update}}. \newblock {\em TUGBoat}, 8(2):102, July 1987. \end{thebibliography} \end{verbatim} If the problems with braces, ties, and font selections noted above were resolved, then it is possible that the \file{.bbl} file itself could be handled by \LaTeX{}info automatically.\refill Doing the job manually is tedious, and since my \LaTeX{}info paper is a subset of the TUGboat article, I discovered only long after the initial conversion that I had inadvertently included some bibliography entries to which there was no reference in the text.\refill \section{Figures} \LaTeX{}info understandably provides only limited support for tables. It does not support figures at all. However, `figure' does not necessarily mean a graphic image; it can be textual as well.\refill My TUGboat article uses the \code{figure} environment exclusively in place of the \code{table} environment. Tables, in my view, tend to imply floating \emph{tabular} material.\refill The figure contents in the TUGboat article are exclusively verbatim text, such as screen images. For the \LaTeX{}info version, I had to change them into \code{table} environments.\refill Can \LaTeX{}info please offer both figures and tables, with the understanding that figures may not contain graphical images if they are to be viewed online? Both are likely to be required in general.\refill \end{document}