Some useful collected LaTeX-wisdom

Resources

  • Mathfont-gallery and LaTeX fonts for download
  • The Tug font catalogue for LaTeX with examples.
  • The really great introduction and help (pdf) for graphics in LaTeX.
  • Good tutorial and help file for typesetting tables in LaTeX (only in German).
  • \usepackage{amsmath} provides (not only) great alternatives for the standard math mode environment \begin{equation}…\end{equation}. E.g. align, alignat, gather, … Each has different features, multiline, centered, left alignment, split, etc. A complete list with explanations can be found in the official amsmath documentation in sections 3 ff.
  • Detexify a great tool to look up all kind of LaTeX symbols. Just draw them by hand into a white square.
  • “Creating tables and inserting pictures” is a chapter in the book LaTeX by Stefan Kottwitz.
    Particularly, he describes well how to deal with pictures, embedded into text in LaTeX.
    This chapter you can download for free as a pdf.

Nice, nonstandard LaTeX packages

  • \usepackage{psfrag}
  • \usepackage{psfragx} If you use Matlab for plotting graphs, then you might be interested in a package and a Matlab File called laprint.m. It exports your figures (highly convenient with a dialog) into a specially labelled *.eps file with an additional .tex file. the .tex file contains all labels automatically, perfectly prepared so that they are replaced with psfrag as soon as the *.tex is compiled.
    Great thing.
    Gnuplot offers a comparable solution built in, as I was told. \usepackage{psfragx} extends this approach even further with a modified laprint.m like file that embedds the \psfrag{…}{…} commands for the graph labels into the eps file and with the modified package \usepackage{psgrafx} reads those out during LaTeX compiling.
    I use laprint.m and not psgrafx as I anyway like to modify the psfrag replacements for all graphs.
    Once again a hint that I got from the German TeX newsgroup.
  • \usepackage{breakurl} When you do not compile with pdflatex (e.g. because you want to use \usepackage{psfrag}), urls with hyperref are not line wrapped. This package wraps them again and remains working lins! Great particularly for bibliographies with links. (via)
  • \usepackage{mathtools} \mathtoolsset{showonlyrefs}  % use \refeq{eqlabel} or \eqref{eqlabel} to reference equations. Then only really referenced equations get a number.
  • \usepackage[activate]{pdfcprot}  % for special character protrusion not only in pdfTeX but also in LaTeX. Depreciated, use microtype instead!
    \usepackage{microtype}  %  A LaTeX interface to the micro-typographic extensions of pdfTeX: most prominently, character protrusion and font expansion, furthermore the adjustment of interword spacing and additional kerning, as well as hyphenatable letterspacing (tracking) and the possibility
    to disable all or selected ligatures.
  • \usepackage{sistyle} \SIdecimalsign{.} % Automatic and nice typesetting of numbers with units in math and text environment when you write them like \SI{326e-5}{As/(Vm^2)^-1}.
    \usepackage{siunitx}                 % Is a newer, better alternative. I have changed to siunitx
  • \usepackage[numbers]{natbib} % Very powerful to change the way references are handled.
  • \usepackage[refpage,refeq]{nomencl} % Add \nomenclature{$A$}{A is just a letter.} anywhere in your document and create a nomenclature list with \printnomenclature. Always needs an adapted run of makeindex.
  • \usepackage{showlabels} % Great for writing: Shows in a sidemark where \label or other commands are applied.
  • \usepackage{refcheck} % Does the same even more sophisticated with check routines but less flexible.
  • \usepackage{cmap}  % With out this package (load before fontencoding!) ligature words are not searchable in final pdfs!

Editors

  • The infamous shareware WinEdt.
  • Winedt supports the free version of the great online and offline working thesaurus from WordWeb. Simply thesaur by clicking on a word and hitting ctr, alt, enter. Be careful: Shareware, not freeware, just as Winedt.
  • Emacs and AucTeX, for windows explained here
  • Has nice features like: Compiles your equations and displays them inline in the rest of the code. But has some problems with very large document and multi-file documents.
  • Bib-it is a BibTeX citation organizer less sophisticated than my preferred JabRef. But it has a BibTeX-style generator which I really like to use. It gives you .bst-files as you like them, which you can simply select by \bibliographystyle{myownstyle} in your document.

Hyphenation rules for LaTeX

LaTeX includes a rather large database of words with hyphenation patterns. The matching one is selected when selecting the language in the document header. Nevertheless, sometimes it is necessary to teach LaTeX hyphenation for words which are not yet defined in this database. This is possible document wide or just at the incidence of a word in the context. The latter is very simple to solve. Just add one of the following commands in the place of the missing hyphenation:

  • - hyphen, suppresses others
  • “=     hyphen which allows others
  • “~     hyphen without wrapping
  • \-     hyphen, excluding second hyphen
  • “-     hyphen, allowing second hyphen
  • ““     wrapping position without hyphen
  • –     German dash
  • —     English extra long dash

Typesetting hints

    • The standard notation for vectors in the anglo american style is bold face. At the same time these vectors are still variables. Thus they should be typeset in italics. This and the fact that the standard LaTex command $\mathbf{vector}$ does not work for greek letters which can also represent vectors, has lead me to this great website, proposing the use of:
      \documentstyle[amstex]{article}
      \begin{document}
      ... $\boldsymbol{vector}$ or $boldsymbol{\beta}$ e.g. ...
      \end{document}

      It works great. I just redefined my own \newcommand in my header file saying \newcommand{\vc}[1]{\boldsymbol{#1}}. Hence I can now use $\vc{vector}$ for vectors, also for greek letters and everything looks fine. Nice side effect: I can simply change the vector layout any time, for example to the German standard of arrows on top of vector letter.

    • I needed chapters or sections which are numbered but which are not included in the table of contents (TOC). For not numbering and not including a chapter in the TOC, the solution is pretty simple. Just use \chapter*{title} e.g. But the way I desired is not so easy. After some search I found a solution on the German TeX Newsgroup. A \newcounter and a \newcommand seem unavoidable.
    • If someone else also tries to align something on the bottom of a page in LaTeX. I tried it for 30 minutes. Save that time, do it as follows. It’s really simple. On a plain page you have to add something as a first element, than add a \vfill and then the object (e.g. a text) that you want to place on the bottom of the page:
~
\vfill
This text will be displayed on the page bottom.
\newpage

The \vfill is an elastic placeholder that grows as much as is necessary  to fill the page. The ~ is a placeholder that displays nothing. I am to lazy to think about a construction with phantom constructs or something like that… I don’t mind about a little invisible space character in the beginning of the page.

Tricks for some packages that I used:

  

  Nomenclature

The package nomenclature ( \usepackage{nomencl} ) enables you in combination with the additional program makeindex (that is part of MiKTeX, but usually not integrated) to create words, symbols or whatever you like throughout the document. For the LaTeX editor of my choice, Winedt, there exists a ready to use macro that invokes makeindex with a click.

\nomenclature{$A$}{A is just a letter}

That are displayed in sorted manner in a list, called “Nomenclature” at the end of your document.

I wanted to have the nomenclature not as a chapter (usually it creates just like \bibliography or \tableofcontents its own chapter in books or reports and section in articles) but simply as a list to put somewhere, e.g. as a \section with some preceding text (in fact just the preceding text would be a user command of the package nomenclature but to get rid of the \chapter was not possible by user commands).

I knew from the nomenclature-documentation that I had to use the LaTeX command \renewenvironment for that purpose but it did not work somehow. So I asked the fabulous German LaTeX-newsgroup. The answer of Paul Ebermann hits the point and is stored on the google groups service. The problem is solved just by defining a \renewenvironment in the document header as follows. The code is taken from the original .sty file of the package nomenclature. I commented out the commands that cause the section or chapter heading to be created as I wanted to get rid of them. The \makeatletter and \makeatother commands are necessary for LaTeX to parse the used @’s correctly. For details read the group answer or google.

The code:

\makeatletter
\renewenvironment{thenomenclature}{%
%\@ifundefined{chapter}%
%  {
%    \section*{\nomname}
%    \if@intoc\addcontentsline{toc}{section}{\nomname}\fi%
%  }%
%  {
%    \chapter*{\nomname}
%    \if@intoc\addcontentsline{toc}{chapter}{\nomname}\fi%
%  }%
%
  \nompreamble
  \list{}{%
    \labelwidth\nom@tempdim
    \leftmargin\labelwidth
    \advance\leftmargin\labelsep
    \itemsep\nomitemsep
    \let\makelabel\nomlabel}}%
  {%
  \endlist
  \nompostamble}
\makeatother

Not yet checked but seeming interesting

PDFsync

\usepackage[novbox]{pdfsync}

Synchronizes the currently displayed position of editing in several editor-pdfviewer combinations. Winedt also is reported to support this.

LaTeXiT Once again a program that I cannot use. But for those who have a  Mac it is an option to typeset formulas inside other programs (like Powerpoint, Keynote, InDesign) with the ease of use and the asthetic level of LaTeX, even as clickable editable vector graphics.

Titlepage designs

I had searched for hours and found nothing. Just when I was ready, I found this ideas for professional titlepage design, including the corresponding LaTeX code.