## Knowledge Base

CSE-IT Contact Info
Keller Hall - Room 1-201
Office Hours: M-F 8:00 AM - 5:00 PM
612-625-0876
csehelp@umn.edu
Or use the red phone in the labs.

# Use TeX

TeX is a typesetting software. It can be used for precise placement of text on a page, or for document organization concepts like title, author, abstract and section.

The TeX language is written in plain ASCII text, so it can be written with basic text editors and formatted later by TeX. The basic "write-render" workflow can be augmented with programming editors (like emacs, kate, vi) or with TeX editing environments (kile, TeXshop, etc.).

Characters written in TeX can be exchanged over low-fidelity media like plain-email and instant-messaging.

TeX output can be dvi, ps or pdf.

CTAN has an online catalog of TeX resources.

 LaTex Source Editing with Kile, a TeX IDE. Pdf LaTeX output can be indexed by search engines. HTML can also be generated from TeX.

## TeX Software

If you have other TeX software installed and added to this list, let the computer staff know.

The easiest way to set up TeX is with a 500MB TeX distribution that includes many current TeX tools. The TeX distribution to download depends on what operating system you run. The TeX User Group (TUG.org) and TeX.stackexchange.com can be good sources of support.

Software below is a good starting point with a few operating system specific tools also listed.

Cross Platform: Windows, Mac and Linux

Linux

TeX Editors

• Any programming editor with syntax highlighting like Emacs, Vim, or Gedit
• kile TeX Editor
• lyx Quasi-WYSWIG LaTeX editor

Layout Viewers

Utilities

Figures and Graphics

• transfig Utilities for creating TeX documents with portable graphics
• xfig An X Window System tool for drawing basic vector graphics
• Inkscape Desktop illustration software for making vector graphics

Macintosh

Windows

## Tips and Tricks

Inverse Search Between PDF and TeX Source

While proofreading TeX documents, it's helpful to go between matching points of the PDF/DVI and source versions of the document. The source is made before it's pdf, so to search from the source to the PDF is called a forward search. The opposite direction (from PDF/DVI to source) is called inverse or reverse searching.

The mechanism to perform forward or inverse searches depend what software is editing the TeX source, and what software is previewing the PDF/DVI.     Some key and mouse combinations to do searches are in the table below.

 Editor OS Forward Search Inverse Search Kile+KDVI Linux Forward Search Button Middle Click Kile+Okular Linux Forward Search Button Shift Click TeXShop Mac OS X ? Command+Click Vim/xdvi Linux _g Ctrl Click Emacs/xdvi Linux * Ctrl Click WinEdt Windows

*   Shortcut commands in Emacs and Vim are user chosen.

## TeX Inputs

LaTeX can include other files using the \input{} command. By default LaTeX searches the directory the main TeX file is in, but can search other directories. LaTeX will search automatically through the directory techmf/tex for any files listed in the TeX project.

1. Make a directory called texmf/tex in your home directory with the following command:
mkdir -p ~/texmf/tex
2. That's it! You're done. Now just add any files you need to this directory for any LaTeX project you're working on and they will be found when the document is compiling.

Other files can also be found if they are listed in the TEXINPUTS environment variable.

Environment variables like TEXINPUTS are used by command line shells (sh, csh, zsh, bash) to define behavior. Details for how to set environment variables differ for different shells, bash is the default shell on Linux and Mac OS X.

### To set up a TEXINPUTS directory you can do the following steps.

1. Make a directory called TEXINPUTS in your home directory with the following command.
mkdir ~/TEXINPUTS
2. Add the following lines to the bash configuration file ~/.bashrc using an editor like emacs, gedit, or vi.
3. TEXINPUTS=.:\$HOME/TEXINPUTS:/usr/share/texmf/tex/latex//
export TEXINPUTS
The double slash causes bash to recurses through the system texmf library for the TEXINPUTS environment variable.
4. Close the shell and restart it, or log out and log back in.
5. Verify TEXINPUTS is set by running echo \$TEXINPUTS in the shell. You should see the directories that were set in the ~/.bashrc file.

## Figures with XFig, CTAN packages and Inkscape

Many people used xfig to make illustrations for LaTeX papers, but folks may user newer desktop apps or a CTAN packages to make figures. Xfig is illustration software that's been around since 1985, though Xfig updates still happen (as of August 2013).

Inkscape is another illustration package, and it can load xfig files. Inkscape's user interface is a much closer match to other desktop software people may have used. LaTeX text can be set using the menu Effects->Render->LaTeX Formula.

For bulk figure conversion from fig to eps or svg, fig2vect is available, but not included in the default Fedora distro.