Archive

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.

Advertisements
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:

\settocdepth{chapter}

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

\usepackage{paralist}

\begin{compactitem}

\item {this}

\item {that}

\end{compactitem}

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:

Command
\baselinestretch A decimal value for the spacing. 

Example:

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

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

Example:

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.
\oddsidemargin
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:

Command
\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

Units

Unit
cm Centimetres
em
The width of the letter M in the current font
ex
The height of the letter x in the current font
in
Inches
pc
Picas (1pc = 12pt)
pt
Points (1in = 72.27pt)
mm
Millimetres

\footheight

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
size
\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:

\bibliography{xxx}
\bibliographystyle{yyy}

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:

\bibliographystyle{./Styles/mystyle}

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
3: IEEE
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