Admin Login • Member Login • Workshop Attendee Login

Latex Frequently Asked Questions

The answers provided here are from someone who is not very experienced with LaTeX. If you have better solutions for any of these questions, I will be delighted and thankful to learn about them.

1. How can I use font sizes that are not predefined as options in a LaTeX class?

Article and revtex4 classes have options for 10pt, 11pt and 12pt font sizes. To use different font sizes (or font types) you can define fonts in the LaTeX document with the \DeclareFixedFont command (this has to come after \begin{document})

\DeclareFixedFont{\CodelineFont}{\encodingdefault}{\familydefault}{\seriesdefault}{\shapedefault}{size}

Explanation:
{\CodelineFont} name of the font created
{\encodingdefault} Encoding if the font, which is usually OT1.
{\familydefault} Family of the font, which is cmr by default.  For time package, the default is ptm.
{\seriesdefault} Series of the font, which is m by default.
{\shapedefault} Shape of the font, which is n by default.  Other values can be it, sl, sc, ui and ol.
{size} Size of the font, which is 10 by default.  Two values can be specified, one for the size and one for the baseline (space between 2 lines).

Examples:
(i) To use the default font, size 14pt:

\begin{document}
\DeclareFixedFont{\fourteenpt}{\encodingdefault}{\familydefault}{\seriesdefault}{\shapedefault}{14pt}
{\fourteenpt 
Text goes here.
} 
\end{document}

This defines a new font called fourteenpt  (use a name of your choice).

(ii) Helvetica, 9pt:

\DeclareFixedFont{\helvnine}{OT1}{phv}{m}{n}{9}

(iii) Helvetica, 9pt, italic:

\DeclareFixedFont{\helvnineit}{OT1}{phv}{m}{it}{9}

(iv) Times Roman, 12pt, boldface:

\DeclareFixedFont{\ttlfnt}{OT1}{ptm}{b}{n}{12}

NOTE: LaTeX not always manages to use the font and size defined in \DeclareFixedFont.  Watch for the warnings during the compilation of your text to see the actual font size used.

2. How can I place a figure exactly where I want it to be?

Many LaTeX classes (including article.cls and revtex4.cls) use floating figures, that is, LaTeX decides where to place each figure. Here is an example of how to place a figure exactly where you want it to be (uses caption2 package, it does not use the figure environment):

\documentclass[]{article}
\usepackage[final]{graphics}
\usepackage{epsfig}
\usepackage{caption2}
\makeatletter
\newcommand\figcaption{\def\@captype{figure}\caption}
\makeatother

\begin{document}

To insert a figure:

\vspace{1cm}
\\
\begin{minipage}{\textwidth}
\centering
\includegraphics[clip,angle=0,width=0.8\textwidth]{fig1.eps}
\figcaption{\label{fig:one} Figure caption goes here.}
\end{minipage}
\\ 
\vspace{1cm}

\end{document}

3. How can I insert a onecolumn text/equation when using the twocolumn option in Revtex4?

\documentclass[twocolumn]{revtex4}
\begin{document}

This text is in the twocolumn format.

\begin{widetext} 
This text is in the onecolumn format.
\end{widetext}

\begin{widetext}
\begin{equation}
This equation is in the onecolumn format.
\end{equation} 
\end{widetext}

\end{document}

4. How do I change the default paragraph indentation?

Paragraph indentation can be set as follows:

\setlength{\parindent}{size}

This command has to appear after \begin{document}. E.g. for a 8mm indentation:

\setlength{\parindent}{8mm}

Shan-Ho (shtsai at uga dot edu)

Latest News

Your Support