Journal home page
General information
Submit an item
Download style files
Copyright
Contact us
logo for The PracTeX Journal TUG logo

Ask Nelly:
     What is different when I click on the pdfLaTeX rather than the LaTeX icon in WinEdt?
     How do I convert my document to the publisher's requirements for double-spacing, line numbers, and figures on their own pages?
     How do I interrupt an enumerate environment and then continue it later in the document?

The Editors

Abstract


Ask Nelly is a question and answer column. Nelly is the quiet person who sits at the back corner desk, who knows a lot, and when asked any question is always ready with a patient answer. If Nelly doesn't know the answer, Nelly will know an expert who has the answer. Feel free to Ask Nelly about any aspect of LaTeX, TeX, Context, etc.


Q: I have heard that pdfTeX has capabilities beyond those available with TeX alone. What is different when I click on the pdfLaTeX rather than the LaTeX icon in WinEdt?

A: First, it is somewhat misleading to speak of "pdflatex" in this context. Here is a recap of the basic TeX "engines" (actual binaries):

  • Knuth's original "tex" (still used in the free distributions for plain TeX)
  • "etex" done by Philip Taylor et al. (not currently used in the distributions)
  • "pdftex" done by Han The Thanh et al. (not currently used in the distributions)
  • "pdfetex" which combines etex and pdftex (used for everything but "tex"), presently maintained by Thanh, Martin Schroder, and others.
So, when you invoke PDFLaTeX, what you are really invoking is the pdfetex binary, with the LaTeX macros loaded as a "format" (.fmt file).

Second, and to get to your real question, you heard right that pdfTeX has capabilities beyond the original TeX. Two main new features in pdftex that come immediately to mind are:

  • it can read most image formats (jpg, png, pbm, pdf, metapost output) directly -- with general .eps figures being the primary exception.
  • there are "microtypography" capabilities for even higher output quality than the original TeX had; these additional capabilities are made available in LaTeX with \usepackage{microtype} -- for more information, see http://tug.org/TUGboat/Articles/tb25-1/thanh.pdf

Also, etex has additional debugging information available from \tracingall. This has proven helpful for tracing obscure problems. It has a number of other additional programming features, but no significant output-related features.

Most other features often associated with PDFs (hyperlinks, colors, etc.) can be achieved with the original TeX. There are related advanced features that are part of the PDF document format, which of course pdftex gives access to, but this is beyond the scope of your question and this answer. See the pdftex manual.


Q (follow-up): Follow-up question: If the pdfLaTeX icon in WinEdt and the LaTeX icon in WinEdt both result in calls to pdfeTeX where does the distinction get implemented such that the former can use all the different image formats and the later only can use .eps. Is this because the former calls pdfeTeX in pdf output mode and the later calls pdfeTeX in dvi mode?

A (follow-up):

That's exactly right.

The distinction is created when the .fmt files mentioned above are made. Invoking a binary named "pdflatex" reads the so-called "format file" pdflatex.fmt, which was created (in teTeX and TeX Live) by reading the file pdflatex.ini. Similarly, invoking a binary named "latex" reads the format file latex.fmt, which was created by reading the file latex.ini. In both cases, the exact same LaTeX macro files are read.

The difference is that latex.ini sets \pdfoutput=0 (\pdfoutput is a new primitive parameter in pdfTeX-based engines). This, finally, is what makes pdf(e)tex's output be DVI instead of PDF. (pdflatex.ini leaves \pdfoutput=1, meaning to output PDF.) The image-reading code and such are all implemented internally to depend on \pdfoutput.

I should say that the files might not be named "whatever.ini" in other distributions, and the exact names of the .fmt files aren't necessarily identical, but that is all an implementation-dependent issue. The underlying setting of \pdfoutput must be the same; that is the primitive parameter which controls the behavior. (This is true in the freely available TeX systems that I'm aware of. Of course I do not know how the proprietary implementations are implemented!)

Final dangerous bend: there are actually even more steps done behind the scenes, so that the .fmt files can get created on the fly instead of users having to create them explicitly, but that's not germane to your pdf question.


The above question and follow-up question were answered by Karl Berry. Karl has been a long-time board member of TUG, became TUG president in 2003, and was elected for another term in 2005. Among other projects, he is co-administrator of the tug.org server, co-editor of TeX Live, and a member of the TUGboat production team. For more about Karl, see his TUG interview.

tpjlogo


Q: I have written my paper in LaTeX and want to submit it to a peer-reviewed scientific journal. The journal, however, is a tad old-fashioned, and wants me to submit my paper with double linespacing, linenumbers and with each figure and table on a separate sheet rather than in the text. In the text it should only say: "[Figure 1 about here]". How do I do that?

A:

This is, unfortunately, a common problem in several fields of science. On the bright side, this means that several other people came across these problems and solved them. We can just use their expertise. Let's take it in three steps.

  1. The linespacing.

    Linespacing in LaTeX can easily be adjusted, using the \baselinestretch command. This is defined by the \begin{document} command, so it should be set in the document itself, rather than in the preamble. To typeset your paper with double linespacing, just give the commands

        \renewcommand{\baselinestretch}{2}
        \normalsize
    

    immediately after the \begin{document}. The \normalsize command sets the text to normalsize, which is what it starts at anyway, but when it is left out, your text will not be typeset with double linespacing.

    To set linespacing at, for example, one and a half, just replace the "2" in the above command by "1.5"

    For more sophisticated line spacing adjustment, take a look at the setspace package, by Geoffrey Robin.

    Note: Double linespacing usually looks exceedingly ugly, and should, therefore, only be used when absolutely necessary.

  2. Linenumbers

    Stephan I. Böttcher has developed the lineno.sty just for the purpose of listing linenumbers in your document. If your TeX-distribution does not install it, it can be found on CTAN in the directory

        /tex-archive/macros/latex/contrib/lineno/
    
    The package is now maintained by Uwe Lück, and is currently at version 4.41. It has many options (such as referring to linenumbers, just as you would to pages), for which I refer you to the manual that comes with it. For our purpose only a few of those options are needed. In your document preamble include the package:
        \usepackage{lineno}
    

    And in the beginning of your document, turn on linenumbering with the command:

        \linenumbers
    

    If necessary, you can turn it off again later in your document by using

        \nolinenumbers
    
  3. Figures and tables at the end of the document

    In order to get the floats (the technical term for LaTeX material that can be moved about in your document; figures and tables are the most common examples of floats) to be placed at the end of your document, just use the endfloat package by James Darrell McCauley and Jeff Goldberg. If you do not have it yet, download it from CTAN in the directory

        /tex-archive/macros/latex/contrib/endfloat/
    

    and simply include it in the preamble:

        \usepackage{endfloat}
    

    This will take care of everything. All floats will be moved to the end of the document, each on a page of their own. The package also automatically generates a list of tables and a list of figures preceding the tables and figures respectively. It also puts the text "[Figure 1 about here.]" on a line of its own in your text at the point where you had your original \begin{figure} ... \end{figure} declaration.

    Using these three tricks (or only one or two of them, depending on the journal you're writing for) you can butcher your pretty LaTeX layout in no time, just the way the editors want you to!


This question was answered by Yuri Robbers. He holds a degree in Animal Behaviour and is a teacher, a researcher and a published author. He's always had a keen interest in typography, possibly because his father is a professional typographer. Ever since he discovered LaTeX in 1995, he's always done his best to avoid using word processors, and he has embarked on a quest to learn as much as possible about TeX and its derivatives, and apply this knowledge whenever possible. Contact him at mailto

tpjlogo


Q: I have an enumerate environment in my document that I want to interrupt, and continue later on in the document.

A:

This is a common problem. Not only does it occur whenever one wants to explain something in more detail in between "enumerate" entries, but also when creating a presentation using, for example, the Beamer package, and one enumerated list spans more than one slide.

The way to do this is to creat an auxiliary counter in the preamble of your document like this:

    \newcounter{saveenumi}

Then, whenever you want to end a numbered list, save the current value of its counter in your newly defined counter like this:

    \begin{enumerate}
      \item ...
      \item ...
      \item ...
      \setcounter{saveenumi}{\theenumi}
    \end{enumerate}

Now you can type additional text, or end your slide and begin a new one, and then, n your next enumerate environment, just restore the saved counter, and continue where you left off:

    \begin{enumerate}
      \setcounter{enumi}{\thesaveenumi}
      \item ...
      \item ...
      \item ...
    \end{enumerate}

Please note the difference between enumi and theenumi, as well as between saveenumi and thesaveenumi. In order to read the value of a counter, use its name prefixed with "the", and in order to store something in a counter, use its name without any prefix. There is no need to define the version with "the": LaTeX takes care of that automatically.

In case you have an enumerate environment within an enumerate environment (within an enumerate environment, etc.) then just create an additional new counters (or two or three...), like this:

    \newcounter{saveenumi}
    \newcounter{saveenumii}
    \newcounter{saveenumiii}

And at the end of your list, store all relevant counters:

    \setcounter{saveenumi}{\theenumi}
    \setcounter{saveenumii}{\theenumii}
    \setcounter{saveenumiii}{\theenumiii}

and restore them again when you begin the new list:

    \setcounter{enumi}{\thesaveenumi}
    \setcounter{enumii}{\thesaveenumii}
    \setcounter{enumiii}{\thesaveenumiii}

That should do the trick.

For further customisations to enumerate, itemize and description lists, including functionality shown here, see the enumitem package, by Javier Bezos.


This question was answered by Yuri Robbers. He holds a degree in Animal Behaviour and is a teacher, a researcher and a published author. He's always had a keen interest in typography, possibly because his father is a professional typographer. Ever since he discovered LaTeX in 1995, he's always done his best to avoid using word processors, and he has embarked on a quest to learn as much as possible about TeX and its derivatives, and apply this knowledge whenever possible. Contact him at mailto

tpjlogo


Page generated June 9, 2010 ; TUG home page; search; contact webmaster.