Archive for the ‘LaTeX’ Category

LaTeX – customizing the depth of the table of contents and subsection headings

You can set the general depth of the contents listing using:

\setcounter{tocdepth}{n} where n is the level, starting with 0 (chapters only)

and the general depth subsection headings using:

\setcounter{secnumdepth}{n} where n is the level, starting with 0 (chapters only)

in the preamble (i.e. before \begin{document}. This will work for the whole document.

Categories: LaTeX

LaTeX – customizing the depth of the table of contents for different parts of document

You can set the general depth of the contents listing using:

\setcounter{tocdepth}{n} where n is the level, starting with 0 (chapters only)

in the preamble (i.e. before \begin{document}. This will work for the whole document.

If you want to have the appendixes listed only as chapters you can use the package tocvsec2 which allows you to change the depth level in different parts of the document. You can set the level up to sections in one part with:


and later set it to sections or subsections. The level will remain the way you set it until the next \settocdepth command. Be shure not to have a line \renewcommand{\tableofcontents} right before the \settocdepth.

Categories: LaTeX

List with small line spacing



\item {this}

\item {that}


Categories: LaTeX

JabRef Eintragstypen (Entrytypes)

  • @article: ein Journalpaper
  • @inproceedings: ein Konferenzpaper
  • @masterthesis: Eine Diplomarbeit u.ä.
  • @techreport: Technical Report, z.B. vom IMISE oder Ontomed
  • @incollection: Buchbeiträge, z.B. Telemedizinführer
  • @proceedings: Tagungsband, Tagungsbericht, Veröffentlichung
  • @misc: wenn sonst nichts zutrifft
Categories: LaTeX

Page margins and the \footheight command

Page margins

There are a few commands to redefine the page layout:

\baselinestretch A decimal value for the spacing. 


To set double-spacing on your document, use the command: \renewcommand{\baselinestretch}{2}

\textwidth The normal width of the text on the page. 


To change this, use the command: \setlength{\textwidth}{x}
where x is a length.

NOTE: If you change the textwidth, you will almost certainly want to change the evenside- and oddsidemargin.

\textheight The normal height of the body of a page.
One inch less than the distance from the left edge of the paper to the left margin of the text on right-hand pages.
\evensidemargin The same as \oddsidemargin except for left-hand pages.
\marginparwidth The width of marginal notes.
\marginparsep The amount of horiz. space between the outer margin and a marginal note.
\topmargin One inch less than the distance from the top edge of the paper to the top of the page’s head.
\headheight The height of a box containing the header.
\headsep The amount of vertical space between the header and the body of a page.
\toskip The minimum distance from the top of the body to the bottom of the first line of text.
\footheight The height of a box containing the page’s footer.
\footskip The distance from the bottom of the last line of text in the body to the bottom of the footer.

You can use the commands like this:

\newlength{cmd} define cmd to be a length
\setlength{cmd}{len} set length of cmd to be len
\addtolength{cmd}{len} add len to length cmd
\settowidth{cmd}{txt} set cmd to width of txt

latex margins


cm Centimetres
The width of the letter M in the current font
The height of the letter x in the current font
Picas (1pc = 12pt)
Points (1in = 72.27pt)


The \footheight command will not affect the way the style works with LaTeX2.09.  You can use the other commands like \textheight25.5cm instead to format your page.

Categories: LaTeX

Latex font sizes and styles

Font sizes

Note that the font size definitions are set by the document class. Depending on the document style the actual font size may differ from that listed above. And not every document class has unique sizes for all 10 size commands.

Absolute Point Sizes in the article, proc, report, book, and letter Document Classes
size 10pt (default) 11pt option 12pt option
\tiny 6.80565 7.33325 7.33325
\scriptsize 7.97224 8.50012 8.50012
\footnotesize 8.50012 9.24994 10.00002
\small 9.24994 10.00002 10.95003
\normalsize 10.00002 10.95003 11.74988
\large 11.74988 11.74988 14.09984
\Large 14.09984 14.09984 15.84985
\LARGE 15.84985 15.84985 19.02350
\huge 19.02350 19.02350 22.82086
\Huge 22.82086 22.82086 22.82086
Absolute Point Sizes in the memoir, amsart, and amsbook Document Classes
size 10pt (default) 11pt option 12pt option
\tiny 7.33325 7.97224 8.50012
\scriptsize 7.97224 8.50012 9.24994
\footnotesize 8.50012 9.24994 10.00002
\small 9.24994 10.00002 10.95003
\normalsize 10.00002 10.95003 11.74988
\large 10.95003 11.74988 14.09984
\Large 11.74988 14.09984 15.84985
\LARGE 14.09984 15.84985 19.02350
\huge 15.84985 19.02350 22.82086
\Huge 19.02350 22.82086 22.82086
Absolute Point Sizes in the slides Document Class
\tiny 17.27505
\scriptsize 20.73755
\footnotesize 20.73755
\small 20.73755
\normalsize 24.88382
\large 29.86258
\Large 35.82510
\LARGE 43.00012
\huge 51.60014
\Huge 51.60014
Absolute Point Sizes in the beamer Document Class
size 10pt (default) 11pt option 12pt option
\tiny 5.31258 6.37509 6.37509
\scriptsize 7.43760 8.50012 8.50012
\footnotesize 8.50012 9.24994 10.00002
\small 9.24994 10.00002 10.95003
\normalsize 10.00002 10.95003 11.74988
\large 11.74988 11.74988 14.09984
\Large 14.09984 14.09984 16.24988
\LARGE 16.24988 16.24988 19.50362
\huge 19.50362 19.50362 23.39682
\Huge 23.39682 23.39682 23.39682

Font styles

There are three main font families: roman (e.g., Times), sans serif (e.g., Arial) and monospace (e.g., Courier). You can also specify styles such as italic and bold.

The following table lists the commands you will need to access the typical font styles:

LaTeX command Equivalent to Output style Remarks
\textnormal{…} {\normalfont …} document font family this is the default or normal font
\emph{…} {\em …} emphasis typically italics
\textrm{…} {\rmfamily …} roman font family
\textsf{…} {\sffamily …} sans serif font family
\texttt{…} {\ttfamily …} teletypefont family this is a fixed-width or monospace font
\textup{…} {\upshape …} upright shape the same as the normal typeface
\textit{…} {\itshape …} italic shape
\textsl{…} {\slshape …} slanted shape a skewed version of the normal typeface (similar to, but slightly different from, italics)
\textsc{…} {\scshape …} Small Capitals
\uppercase{…} uppercase (all caps) Also \lowercase. There are some caveats, though; see here.
\textbf{…} {\bfseries …} bold
\textmd{…} {\mdseries …} medium weight a font weight in between normal and bold

You may have noticed the absence of underline. Although this is available via the \underline{…} command, text underlined in this way will not break properly. This functionality has to be added with the ulem (underline emphasis) package. Stick \usepackage{ulem} in your preamble. By default, this overrides the \emph command with the underline rather than the italic style. It is unlikely that you wish this to be the desired effect, so it is better to stop ulem taking over \emph and simply call the underline command as and when it is needed.

  • To restore the usual em formatting, add \normalem straight after the document environment begins. Alternatively, use \usepackage[normalem]{ulem}.
  • To underline, use \uline{…}.
  • To add a wavy underline, use \uwave{…}.
  • And for a strike-out \sout{…}.
Categories: LaTeX

BibTeX and bibliography styles

In your LaTeX file, these two commands insert the reference/bibliography section in your publication:


The “xxx” is the name of the bib file (yyy.bib) containing the reference database, e.g. \bibliography{mybiblio} would call on file “mybiblio.bib”.

The “yyy“‘ is a style name. See some of the available styles in section below. You can also use your own style file (.bst) with this command.

You can also use a subfolder for your styles:


Bibliography styles

Here you can find some bibliography styles.

Here you can find some bibliography styles for German texts.

The chicago style is one of my favorite styles.

The PDF file bibstyles.pdf illustrates how these bibliographic styles render citations and reference entries:

1: ieeetr
2: unsrt
4: ama
5: cj
6: nar
7: nature
8: phjcp
9: is-unsrt
10: plain
11: abbrv
12: acm
13: siam
14: jbact
15: amsplain
16: finplain
17: IEEEannot
18: is-abbrv
19: is-plain
20: annotation
21: plainyr
22: decsci
23: jtbnew
24: neuron
25: cell
26: jas99
27: abbrvnat
28: ametsoc
29: apalike
30: jqt1999
31: plainnat
32: jtb
33: humanbio
34: these
35: chicagoa
36: development
37: unsrtnat
38: amsalpha
39: alpha
40: annotate
41: is-alpha
42: wmaainf
43: alphanum
44: apasoft

If you want to edit a .bst file you should have a look at this file and if you want to create a new one you can use makebst (command: latex makebst).

Compiling the document and bibliography

To fully compile and cross-link references you have to repeat some commands. To create a .dvi or .pdf file use the following commands:

to create .dvi file: to create .pdf file: result:
1 latex mydocument pdflatex mydocument creates .aux file which includes keywords of any citations
2 bibtex mydocument bibtex mydocument uses the .aux file to extract cited publications from the database in the .bib file, formats them according to the indicated style, and puts the results into in a .bbl file
3 latex mydocument pdflatex mydocument inserts appropriate reference indicators at each point of citation, according to the indicated bibliography style
4 latex mydocument pdflatex mydocument refines citation references and other cross-references, page formatting and page numbers
Categories: LaTeX

Including eps graphics in pdfLaTeX

Traditionally, LaTeX users generate postscript output using dvips. An alternative is to use pdfTeX to generate PDF files directly. The PDF format offers a number of advantages over postscript:

  • Smaller uncompressed file sizes.
  • Much more efficient bitmap inclusion.
  • Availability of hyperlinks.
  • Better accessibility for inexperienced users.
  • Adobe’s Acrobat reader offers facilities for electronic presentations

The postscript generated by dvips can be converted to pdf format with the Adobe software or ghostscript, but there are a number of disadvantages in comparison to using pdfTeX. In particular, the files are usually larger, and ghostscript prior to v6.0 converts the type-1 scalable fonts into type-3 bitmaps, resulting in poor appearance when viewing. The type-3 bitmaps will also occur if the dvips isn’t configured to use type-1.

The main limitation of pdfTeX is that postscript figures cannot yet be directly imported into documents. Instead, inclusions must be bitmaps (PNG or JPG), a simple format of PDF, or MetaPost output. Some EPS graphics may be converted to PDF and included, but I have had limited success with this approach in the pase. However, I have found that conversion through MetaPost is quite robust for vector graphics. For bitmaps you will want to instead convert to PNG for line-art or JPG for photos.

via pdf

In more recent times, the later versions of epstopdf by Sebastian Rahtz et al. appear to quite successfully perform the translation to pdf directly. This means that the pdf generation process is quite easy:

  • Convert the .eps files to .pdf using epstopdf
  • Conditionally include the graphics package, as shown below.
  • Include the images in the LaTeX file, perhaps following the example below
  • The same file can then be used to generate dvi output with LaTeX, or pdf output with pdfTeX.

via mps

I would consider this section now obsolete, and graphics would now be generally be included with pdf as described above. Hovewer, to instead perform the conversion via MetaPost, you will need both pstoedit and metapost. I suggest pstoedit v3.14 or later as it incorporates changes and bug fixes I made. Metapost is found in most TeX distributions. To generate a .mps file from a .eps file, use the following commands:

pstoedit -f mpost -fontmap /usr/local/lib/pstoedit/fontmap.mpost 

mv file.1 file.mps

You will need to alter the path to the fontmap.mpost file to suit you installation. The last line is necessary because metapost gives the output file the extension of “.1”, while it is more convenient to import it into pdfTeX with an extension of “.mps”.

With a little bit of trickery, it is possible to make metapost typeset any mathematics during the conversion. This means that it is possible to include LaTeX equations in graphic editor that does not natively support it (such as Sketch).

The LaTeX File

To import graphics into pdfTeX, the easiest way is to simply use the graphics (or graphicx) package, and no option should now be required. So simply use this at the top:


A figure may then be included by a command like:


If the extension is not specified, LaTeX will find the .eps file, and pdfTeX will find the .mps or .pdf file.

The following is an example of inserting a figure called FigureExample.eps, FigureExample.pdf or FigureExample.mps. If you leave the extension off, usually the best one is chosen automatically.

\caption{An Example Figure}

In order to keep files small, I recommend using the Times or Helvetica fonts, as these are built-in fonts on pdf readers, and don’t need to be included in the file. For example, use the times package (\usepackagetimes in the preamble).

Categories: LaTeX

LaTeX Error: Cannot determine size of graphic (no BoundingBox)

What’s a BoundingBox?

A BoundingBox is a entry that is located in PostScript files that tells the reader the scale limits of the file. LaTeX uses this entry to determine how to place the image in the document.

How to fix the LaTeX problem

It is quite easy to fix this problem. The free software package ImageMagick is used in this case to convert the images from one form to another. ImageMagick is able to convert many image formats to many other types. To do the conversion just enter this into your console:

root@toor ~ # convert image.jpg image.eps

You can find a portable Win32 release here.

For converting jpgs to PostScript files there is also a free utility named jpeg2ps. You can download it from here.

Categories: LaTeX

Using LaTeX with BibTeX.

1. run latex
2. run bibtex
3. run latex
4. run latex again

Categories: LaTeX