[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#195109: tetex-extra: Missing comment character in style file



Hilmar Preusse <hille42@web.de> wrote:

> Before I mind to forward that bug to upstream: Would you be so kind as
> to post a little piece of code, which shows that your statements are
> correct.

Example code should not really be necessary, since it should be obvious
to anyone who understands how TeX processes its input, that this code is
prone to error.  (Hint, compare the definition of \idx@activebar to that
of \idx@activehat, earlier in the file.)

Good style dictates that, when defining macros in a style file --
particularly code that will be expanded while processing the text of the
document, such as horizontal or vertical mode -- spaces should be
avoided inside the definition (except for spaces at the beginning of the
line to provide proper indentation).  In addition, all lines should
either end in a commmand (i.e., something that begins with a backslash)
or should end in a comment, since both of these techniques cause TeX to
ignore the newline and the spaces at the beginning of the next line.
This prevents spurious spaces from creeping into the document, since in
certain modes, a space is significant.

Anyhow, here is an example:

    \documentclass{article}
    \usepackage{makeidx,index}\makeindex\shortindexingon
    \begin{document}
    \section{A Section}
    This is a sample_{Sample} paragraph_{Paragraph}.
    \printindex
    \end{document}

If you run this code through LaTeX and makeindex, you'll notice that a
spurious space is inserted before the period at the end of the sentence.
The fix cited earlier in this bug report removes this space.

- Brian



Reply to: