Installation (Windows)

  • Install Miktex from
  • For GUI install Texnic Center:
  • When running Latex for the first time set up pdf and postscript viewer locations (optional)
  • For spelling it is suggested to active all the options under: Tools -> Options -> Spelling -> Options (optional)
  • Local database for macro files, bibliography files, etc.: It is generally good to generate a local repository of macro and bib files that can be called in different files or even be shared between different users for consistency. This process is explained below.

Local database

  • We call the local folder for storing latex style and bib files $LOCALTEXMF.
  • To simplify the file sharing between group members I set up my local folder (calling it $LOCALTEXMF) in dropbox:


  • Within this folder there should be a specific folder structure for different files:
    • Style files: tex/latex
    • Bibliography files: bibtex/bib
  • Installing the local latex folder location: The address of this folder should be added to latex installation. This document explains the process.
    1. Add style files under $LOCALTEXTMF/tex/latex and bibliography files under $LOCALTEXTMF/tex/latex
    2.  Run Miktex setting (admin)
    3. Add your path to Roots. Note that the trailing \tex\latex\… must not be included
    4. Afterwards, select General tab and press Refresh FNDB button
  • Almost the same process can be followed for TexShop.
  • Note that step 4 should be repeated after the addition of any new files to $LOCALTEXTMF.


  •  When downloading papers save the .bib file from the database with the same name (example here: remove .txt extension).
  • Add the contents of the bib file to appropriate bibliography with an appropriate item title such as author:year (example: remove .txt extension).
    We currently have a shared folder in dropbox under the address: Dropbox\Shared\latex\bibtex\bib for this purpose.
  • Cite the papers with their title in the text with \cite{title}, \citep{title}, etc. depending on the document/journal requirements.
  • Insert bibliography database files and bibliography style at the end of tex file before \end{document}. Example:

Macros and Style files

Macros and style files include a list of commands and shortcuts that can be used in tex files. A same macro file can be found at macro.tex (remove .txt from the end).

To use macros:

  • Add them to the same folder of your tex file.
  • Add the command:   \input{MACRONAME} before \begin{document}

It is better, however, to define a style file and store it in the style file location so that all tex files can access it without having a copy of the macro file in the same directory.

To make and save a style file in latex do the following:

  • Create a sty file from include file:
  • Add
    \ProvidesPackage{FILENAME}[short introduction] (e.g. \ProvidesPackage{macros}[2014/02/04 reza macros])
    at the beginning of the file.
  • Add \endinput at the end of the file.  Further details about this topic can be found here (especially the post by xport)
  • A sample sty file can be found at: macros.sty (remove txt extension)
  • We currently have a shared folder in dropbox under the address: Dropbox\Shared\latex\tex\latex for this purpose.


Figures can be generated with several programs such as Adobe Illustrator, xfig, inkscape (below), or any other graphical editors. For complicated math symbols it is often recommended to not use the native capabilities of the graphical editor as they may not look professional. There are two general approaches to have highly complicated notations in the figures:

  1. psfrag tool (home page; pdf documentation) As directly taken from its homepage “psfrag allows LATEX con­struc­tions (equa­tions, pic­ture en­vi­ron­ments, etc.) to be pre­cisely su­per­im­posed over En­cap­su­lated PostScript fig­ures, us­ing your own fa­vorite draw­ing tool to cre­ate an EPS fig­ure and plac­ing sim­ple text ‘tags’ where each re­place­ment is to be placed, with PSfrag au­to­mat­i­cally re­mov­ing these tags from the fig­ure and re­plac­ing them with a user spec­i­fied LATEX con­struc­tion, prop­erly aligned, scaled, and/or ro­tated”.
  2. Writing expressions in latex and inserting them into the figure directly. There are several tools in windows and Mac for this. In windows the program inkscape can be directly linked to Latex for this approach (as explained below).

Comparison of the two approaches:

Advantage of 1 (psfrag):

  • The latex expressions can be modified without modifying the base figure. This provides greater flexibility in changing notations in the figure without changing the base figure.

Advantages of 2 (direct insertion into the figure):

  • psfrag should be used with latex compiler (tex -> div -> ps -> pdf) as opposed to the faster and flexible pdflatex compiler  (tex -> pdf).
  • Adjusting Latex symbols with psfrag can be cumbersome.
  • Saving the figure as as stand alone object is more difficult (a tool for this purpose is discussed below).

psfrag tools:

  • psfrag2pdf.bat : This program saves psfrag generated figures into a stand alone figure (useful for presentations for example). To use this program do the following:
    1. Install ghost script from:
    2. If the bin directory is not added to the path add it to the path (type gs on command line cmd to check if gs is recognized). To add a directory to the path follow the instructions here. For example, on my local computer the path is: C:\Program Files (x86)\gs\gs9.02\bin.
    3. Copy and rename gswin32c.exe to gswin.exe in the bin folder.
    4. Add psfrag2pdf.bat to the bin folder.
  • To use psfrag2pdf.bat follow these steps (all the file can be found here):
    1. Generate a postscript figure (.eps) file with markers in place of final latex expressions. A sample file is: contactShock.eps (remove txt extension).
    2. Generate or modify a tex file to replace markers with latex expressions. A sample file is contactShock.tex (remove txt extension).
    3. In the file location run psfrag2pdf.bat fileName (e.g.  psfrag2pdf.bat contactShock) to generate the pdf file (sample contactShock.pdf).

 Direct insertion latex in figures

As mentioned there are many programs allowing direct insertion of latex expressions into figures. One very attractive option is the program:

Inkscape (

  • Installation:  Described in this document by James Davis (if link broken try this).
  • Typing Latex expressions: Extensions -> Render -> Latex Formula
    Inkscape_LatexFormulaand type Latex math formula enclosed in \( \).
  • Using Latex style files: Sometimes it is easier to use macros to generate Latex formulas. For that the user needs to generate a style file and add it to Latex style location (described above) and call the style name in the latex Formula box:
    Inkscape_LatexFormula Inkscape_StyleFile

Presentation (Beamer)

The package beamer class (homepage; documentation - alternative link) is an excellent tool to prepare math intensive presentations. Some useful resource are:

Useful packages

Here is a short list of some useful packages for presentation and article modes: