Stockholm 5:th of May 2009.

KTH regulations: This is a personal web page created by Lars Jonsson. More information. You can contact me at ljonsson AT kth DOT se. This page contains a cookie, used for visitor statistics.


Lars remarks on Printing, LaTeX, ...

... as well as links, macros and suggestions around and about producing, printing and presenting your results in LaTeX. First, links to others: A good latex reference is Introduction to Using TEX (Harvard Mathematics). It contains lots of details which we will not try to reproduce here. The 3300 most used latex symbols and how to access them are avalable from CTAN.
What this page does provide is:


An example

Here is a simple example that answer some basic questions about the use of macros and headers in LaTeX:
The file test.tex contain examples of references, macros, how to make sections as well as a time-mark at the bottom of each page. The time-mark macro(s) are in the file now_macro.tex and some basic 'replacement' macros are in the file macro_dyn.tex.
To handle reference to papers, books etc. I have attached a bibliography file: stein.bib.


Basics: To make a LaTeX document --- under Linux

Store the files from the section An example above in a separate directory,

Typeset the file test.tex, from above e.g.

latex test 
bibtex test, either through emacs menu TeX or from command line e.g
bibtex test

Typeset twice again (to get the bibliography correct) e.g.

latex test
latex test

If all worked out well, you now have the result in an dvi file. I provide mine here test.dvi. To display it use

xdvi test
To translate it to postscript, use
divps test -o test.ps
To create a portable document file (pdf):
ps2pdf test.ps

Sometimes the resulting pdf-document has dropped its margins. This will occure even if we specified a4 paper format in the latex. The resulting pdf-file does not remember this latex setting. It looks as if the whole text moved up to the left top corner. This is typical for the problem of paper size. One solution is:

ps2pdf -sPAPERSIZE=a4 test.ps test.pdf

Sometimes one can use as an alternative:

pdflatex test

to directly create a PDF-file. This is supposed to have some better searching and display properties than the file created by ps2pdf.
Note: to use the typesetter all your .eps-files has to be .pdf:

epstopdf  figure.eps
For more details on pdflatex see eg. prepare pdf-files form LaTeX. One often occurring problem while useing pdflatex or direct conversion to pdf-formats is that some useful tools like psfrag do not work anymore, and as of yet (2007-08) there is no pdffrag nor pdfrag tool. There are some routs around see pdfrack Home page and fragmaster Home page.

One work around is to use ps2pdf. A better alternative is to use Latex create a single -.ps document containing the figure with its psfrag replacments and then to use the ps2eps package e.g.

ps2eps filename.ps
and then
epstopdf filename.eps
It is a roundabout way to solve the problem, but it works.

Upon submitting your manuscript to an archive, I recomend to use the style file habbrv.bst which provides eprint and can be used to include internal links. The style file you can find here with an explanation of how it works.


Guidelines



Remarks on slides in LaTeX

To make slides I use the slides macro to get an appropriate font, and some additional macros of my own. Here is an example: slideshow.tex.
After typesetting (latex slideshow): slideshow.dvi
To display the show use:
xdvi -paper a4r slideshow 
To translate .dvi -> ps, use:
dvips -t landscape slideshow -o slideshow.ps
The special command:
\special{landscape}\special{! /landplus90 true store}
in the file, makes sure that the file does not turn upside down. It might still cause some trouble when printing (using e.g. psnup) more than one page, since the pages may appear counter clockwise. The counter to these troubles is to write
psnup -l -4 filename newfile
It works like a dream.


Back-of-the-Book Indexing

Indexing a LaTeX document with help of the program MakeIndex with syntax
MakeIndex filename
is straight forward on a superficial level. The program solves the technical part of indexing i.e. how to associate the position (page) with a desired word or concept in the text is there solved. The keyword to use in the LaTeX document is
\index{favorite word}
It is also neccessary to include
\documentclass{book}
\usepackage{makeidx}
in the preamble as well as
\printindex
where you want to print the index.
I also recommend the additional package \usepackage{index} which have a number of nice shortcuts like not having to retype the word upon indexing.

However to produce a good index, that is how an index is organization and structured and typographically presented is less that trivial. One document that discuss the idea of organizing (book indexing and/or back-of-book indexing) a text (or texts) is TAO-maps. Which discuss the model Topics Association Occurrence Maps, it clears some of the idea structure of how a text can be indexed.
Models which answers or suggest

is still largely left to the individual. I am still searching for a good description on how such an organization should look like. A webpage with an introduction to back-of-the book index theory would be desired.

From my point of view, a simple index which only lists one level of topics is the easiest to construct. On the other hand, one might get several very similar words scattered through the index: e.g. surface current density, volume current density, current density, will all be split into several places e.g. under the letters c,s and v. An alternative might be to list all three as subtopics to of e.g. current density. Such a subtopic listing often have troubles with associations. E.g. imagine that we choose current and density as two separate topics, should then a current density subtopic (of density, and of current) have mutual associations between density and current (see also...)?

Ideally an index is to be a concentration of the information in a text. This ideal requires an iterative procedure to extract an appropriate set of pointers to the text, almost like constructing a miniature abstract for each paragraph.


Printing


Bugs, errors and some fixes in LaTeX and related software

\qed-in the middle of the page error:

The command \qed, as implemented by amstex has a minor bug. If the file ends with \qed, the type-setting does not move the box all the way to the right-hand side of the page, but stops somewhere in the middle. This problem might be fixed by inserting one or two carriage return after the command \qed.

Upside down landscape ps-files from LaTeX

Upon typsetting dvips of the dvi file from a latex document with a header of the type \documentclass[landscape]... through
dvips -t landscape document
causes the resulting postscript file to display upside down. One quick fix for this is to insert the command
\special{landscape}\special{! /landplus90 true store} 
immediately after \documentclass in the tex file.

For printing landscape oriented fiels with psbind/psnup see the printing section.