Some of my LaTeX tricks
Every mathematician of the last 20 years should have their personal bag of LaTeX tricks. Here's a couple of mine:
- Graphics. This, in particular, is an area where everyone has their own tricks. My standard procedure is as follows:
- Create some graphic in XFig, making sure that all text is marked special. (You can do this automatically by editing your
.xfigrc
file.) - Using TransFig, convert this file into four formats:
pstex
,pstex_t
,pdftex
,pdftex_t
. There's a catch here: you need to make sure thatmyfigure.pdftex_t
version includesmyfigure.pdf
, notmyfigure.pdftex
, which is the default. I guess this counts as a bug. This chore is usually done by a script for me:#!/bin/sh
# Convert all fig files to four other formats, using fig2dev.
for FILE in *.fig; do
FILE=`basename $FILE .fig`
if [ $FILE.fig -nt $FILE.pstex ]; then
fig2dev -L pstex $FILE.fig $FILE.pstex
fi
if [ $FILE.fig -nt $FILE.pstex_t ]; then
fig2dev -L pstex_t -p $FILE.pstex $FILE.fig $FILE.pstex_t
fi
if [ $FILE.fig -nt $FILE.pdf ]; then
fig2dev -L pdftex $FILE.fig $FILE.pdf
fi
if [ $FILE.fig -nt $FILE.pdftex_t ]; then
fig2dev -L pdftex_t -p $FILE.pdf $FILE.fig $FILE.pdftex_t
fi
done - Then in my LaTeX file, I have this code in the preamble:
\usepackage{ifpdf}
and whenever I want to include the file
\ifpdf
\pdfcompresslevel=9
\providecommand{\myinput}[1]{\input{#1.pdftex_t}}
\usepackage[pdftex]{graphicx}
\else
\providecommand{\myinput}[1]{\input{#1.pstex_t}}
\usepackage{graphicx}
\fimyfigure.fig
, I just write\myinput{myfigure}
.
- Create some graphic in XFig, making sure that all text is marked special. (You can do this automatically by editing your
- I'm very proud of the following piece of code:
\newcounter{storedequation} % To store the equation number when we
Now we have an environment
% temporarily change it.
\let\storedtheequation=\theequation
\newenvironment{lettereqns}[1]{%
\setcounter{storedequation}{\value{equation}}%
\setcounter{equation}{0}%
\renewcommand{\theequation}{#1\arabic{equation}}}{%
\setcounter{equation}{\value{storedequation}}%
\renewcommand{\theequation}{\storedtheequation}}lettereqns
, with one parameter, which makes all equations in it be numbered (P1), (P2) etcetera if the parameter is P.
0 Comments:
Post a Comment
<< Home