Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Following a minimal code from somebody who asked why it produces a longer line for caption text of the figure, than a line in the main text.

\documentclass[12pt]{article}
\usepackage{array,latexsym,amsthm,amsfonts}
\usepackage[dvips,dvipdf]{graphicx,color}
\setlength{\textwidth}{7.0in} 
\setlength{\textheight}{9.0in}
\setlength{\oddsidemargin}{-.25in} 
\setlength{\topmargin}{0in}
\setlength{\tabcolsep}{0.09in}

\title{test}
\begin{document}

\maketitle

aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa 


\begin{figure}[h,t,b]
\includegraphics[scale=.25]{b.eps}
\caption{The triangular lattice with faces labelled as close-packed (C) and empty (O), the corresponding planar modification, and its generator.}
\end{figure}

\end{document}

I failed to reproduce the problem he has. But I think the solution may be to set up the textwidth for the figure caption, to match it with the textwidth in the main text.

So I wonder how to set the textwidth for the figure caption?

share|improve this question
add comment

1 Answer

You can use the floatrow package and set wider margins for the floating environments:

\documentclass[12pt]{article}
\usepackage[demo]{graphicx}

\usepackage{floatrow}
\setfloatmargins{\hspace{-0.5in}}{\hspace{-0.5in}}

\title{test}
\begin{document}

\maketitle

aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa
aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa
aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa
aaa aaa aaa


\begin{figure}[htb]
\centering
\includegraphics[scale=.25]{b.eps}

\caption{The triangular lattice with faces labelled as close-packed (C) and empty (O),
the corresponding planar modification, and its generator.}

\end{figure}

\end{document}

I've used the demo option just to provide a mock illustration, don't use it yourself. Note however that latexsym is obsolete and amssymb should be used instead (which loads amsfonts). Also the options dvips and dvipdf shouldn't be passed to graphicx or color.

The positioning specifier can be [htb], without commas.

enter image description here

share|improve this answer
    
Thanks! What do the two parameters in \setfloatmargins{\hspace{-0.5in}}{\hspace{-0.5in}} man? –  Tim Oct 23 '12 at 21:46
    
@Tim They are the amounts by which the horizontal space is enlarged at the left and at the right. Choose your own. –  egreg Oct 23 '12 at 22:12
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.