I found this page very useful but the original page was missing so I copied the file from google's cache. The original link is: http://web.engr.oregonstate.edu/~kaj/ltxtips.html

Amitabha

# LaTeX Tips

Here are several Tips which we encountered. I assume you are not a novice of LaTeX. If you are, these tips might be difficult to understand and please refer to other website or books first. A best free resource is "The Not So Short Introduction to LaTeX2e" (Gzipped Postscript version), or PDF version.

You can find others in General documentation about (La)TeX.
Do you need more? Handbooks are very useful. They have not only LaTeX but also vi, emacs, C, and so on. (Thanks José).

### Contents

• Figures
• How to Include Xfig File with LaTeX Format Letters (epsfig)
• How to Put Two Figures Next to Each Other (minipage)
• How to Put Two Figures Next to Each Other (subfigures)
• How to Put FOUR Figures in One Page (subfigure)
• How to Rotate the Graph with its Caption (rotating)
• How to Use Analog Library in Xfig
• How to include OSU logo
• How to erase the label in the postscript file
• Slides
• How to Make Slides (seminar)
• File conversion
• Postscript -> Xfig (pstoedit)
• Postscript -> *.ai (Adobe Illustrator) file
• How to Include Combined PS/LATEX Pictures in MS-Word
• Others
• How to eliminate page numbers
• How to Change the style of section numbers

## Figure

#### How to Include Xfig File with LaTeX Format Letters

You can draw your schematic with Xfig and in that schematic you can write any equations or characters with the LaTeX format. LaTeX includes those equations into your figure.
Here is how to do that.
1. First you're in Xfig. Write equations or characters in the schematic. You need "$" in both sides. eg. $\phi\$



2. Press the "Edit" icon and change the flag. Make the characters "Special".

3. "Export" the figure. In the "language" menu, choose "Combined Postscript/LaTeX". Don't choose "Encapseled postscript" if you need to print the equations with LaTeX format.
The file name will be "foo.pstex_t" when you're editing "foo.fig".

4. You don't have to specify scale in Xfig, using ("Magnif") in the "Export" menu. After saving EPS file, you can change its scale in LaTeX.
NOTE: In DVI viewer, you may find the pictures are scaled correctly, but not LaTeX text. Don't panic! After making postscript file using that dvi file, LaTeX text is also scaled correctly. Thanks to José to find this solution!

Below info works well, but old info. You don't have to obey this.
Modify the scaling ("Magnif") in the "Export" menu if you need.
So far, I don't know how to change the scale in LaTeX file, when you include the equations with LaTeX format in your schematic.

5. Then you're writing your TeX file. Insert \usepackage{epsfig} command between \documentclass and \begin{document}.
That means:
       \documentclass{article}
\usepackage{epsfig}
\begin{document}


6. Write the command to insert your figure in TeX file.
Command scalebox change your scale in postscript file, but you may not see scaled figure in dvi file. eg.

\begin{figure}[h]
\centerline{
\scalebox{0.8}{
\input{foo.pstex_t}
}
}
\caption{This is an example}
\label{fig-eg}
\end{figure}


7. If you don't have LaTeX format characters in your figure. You just "Export" into the eps file. Then, include as follows.
eg.
       \begin{figure}[h]
\centerline{
\epsfig{file=foo2.eps, scale=0.5}
}
\caption{Picture without equations}
\label{fig-eg2}
\end{figure}


8. Compile your latex file and check it with xdvi. Congratulations!

#### How to Put Two Figures Next to Each Other

See below minipage command! figure1.eps and figure2.eps are the EPS figures.

\begin{figure}[h]
\hfill
\begin{minipage}[t]{.45\textwidth}
\begin{center}
\epsfig{file=figure1.eps, scale=0.5}
\caption{figure 1}
\label{fig-tc}
\end{center}
\end{minipage}
\hfill
\begin{minipage}[t]{.45\textwidth}
\begin{center}
\epsfig{file=figure2.eps, scale=0.5}
\caption{figure 2}
\label{fig-tc}
\end{center}
\end{minipage}
\hfill
\end{figure}


#### How to put two figures next to each other: Part2.

You can put two or more figures as a part of one figure with captions: (a) xxx (b) yyy (c) zzz.
You need subfigure package in your header, i.e. use
\usepackage{subfigure}
See p.152 in LaTeX companion book for more detail.
Now you can understand this example.
\begin{figure}[htbp]
\begin{center}
\mbox{
}
\caption{I like these!}
\label{fig:my_car}
\end{center}
\end{figure}


#### How to put FOUR figures in one page

Easy! See this!
\begin{figure}[htbp]
\begin{center}
\mbox{
\subfigure[Toyota]{\scalebox{0.3}{\input{celica.pstex_t}}}
}
\mbox{
\subfigure[Subaru]{\scalebox{0.3}{\input{Outback.pstex_t}}}
}
\caption{I like these!}
\label{fig:my_car}
\end{center}
\end{figure}


#### How to rotate the graph with its caption

You may use rotating package and use sidewaysfigure instead of a figure environment. Refer LaTeX companion book (p.327).

#### How to Use Analog Library in Xfig

José created analog library. You can refer that library at:
/nfs/dither/analog2/tmp/XFIG.lib/Libraries
You may read the man page of Xfig and use a proper option to include this library when you start Xfig.

#### How to include OSU logo

Here is my modified eps file.

I just put this eps file into the author fields.
\author{
\\
\centerline{\epsfig{file=logo_black.eps, scale=0.3}}
\\
Tetsuya Kajita \\
\\
{\small  Advisor: Prof. XXXX } \\
}


Our (OSU) officical site is here. But I found their EPS file has a trouble. There are some unwanted "binary" codes at the beginning and the end of the eps file. You should remove them. Or use my modified file for ease.
Should I tell them ... ? Yes. I did, but no reply yet. :-)

#### Scaling figures

Scaling example, with \resizebox:
\begin{figure}[ht]
\centerline{\resizebox{1.00\linewidth}{!}{\input{fig0b.pstex_t}}}
\caption{A switched-capacitor DAC}
\label{f0}
\end{figure}


Another example, for \epsfxsize:
\begin{figure}[ht]
\centerline{\epsfxsize 1.00\linewidth \epsfbox{fig1array.eps}}
\caption  {A switched-capacitor DAC with the proposed analog
mismatch correction}
\label{f1}
\end{figure}

Thanks to José for this tip.

## Slides

#### How to Make Slides

Seminar Package

• You can also make slides using slides class easily.
       
\documentclass{slides}


But I hear that you can't include eps files in it. And this way may be not good for presentations. So, I'm using seminar pkg.

#### Printing

• Printing slides in 2-page-up format with a border around each slide:

psselect -r slides.ps | psnup -2 -pletter -b10 -d4 > slides.ps2


Thanks to José for this tip.

## File conversion

#### Postscript -> Xfig

Use pstoedit command.
Now you can edit the schematic and add some text in it, too.

#### Postscript -> *.ai (Adobe Illustrator) file

You can import *.ai file into Mayura Draw (PC draw software) and edit it in your PC.

#### How to Include Combined PS/LATEX Pictures in MS-Word:

First of all, I don't think it is good way to keep using MS-Word now. Think different. In case you *really* need it, José tells you how to do this. (Thanks José)
1. Create a tex file containing only the desired picture;
2. Compile it with LaTeX;
3. Create a eps file with: dvips -E picture.eps -o picture.dvi

If the bounding box doesn't look right, you can adjust it
by editing the file picture.eps. Look for the following
line in the beginning:

%% BoundingBox:

There are four numbers following this line:
Lower left x, Lower left y, Upper right x, Upper right y

When you are done, it is straightforward to include this
in Word, or any other program that accepts eps files.



## Others

#### How to eliminate page numbers

Here is the word from Péter. (Thanks Péter)

To ignore page numbers:

\pagestyle{empty}

but which will still keeps the page number for the first page. To ignore
that one also you should add to the first page (only):

\thispagestyle{empty}


Here is Péter's example, based on "The Not So Short Introduction to LaTeX2e" (Gzipped Postscript version). (Thanks Péter)
\documentclass[12pt,letterpaper,notitlepage,openright,twoside]{report}
\usepackage{fancyhdr}
\usepackage{epsfig}
\usepackage{rotating}
%\usepackage{amssymb}

\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}{}}
\fancyhf{}
\renewcommand{\footrulewidth}{0.0pt}
\fancypagestyle{plain}{
}
\begin{document}


#### How to Change the style of section numbers

Use below command (thanks José):

\renewcommand \thesection{\roman{section}}


If you need a period after the roman number,

\renewcommand \thesection{\roman{section}.}



The second example may bring another problem when you have sub-section. i.e. an extra dot after the number.
[ TOP ] | [ LaTeX Tips ] | [ MATLAB Tips ] | [ HSPICE Tips ] | [ SwitCap2 Tips ]