\indent and subfloat

187 views
Skip to first unread message

Vinz' !

unread,
Sep 22, 2010, 10:34:09 AM9/22/10
to LaTeX Users Group
Hi,

I am trying to have two subfloat pictures which span an area equal to
textwidth, minus the indentation used by paragraphs, with the
following code:

\begin{figure}[ht]
\indent
\subfloat[$190\:\mu s$]{\includegraphics[width=0.45\textwidth]{setup/
fig/tempDiff/190.pdf}}
\hfill
\subfloat[$570\:\mu s$]{\includegraphics[width=0.45\textwidth]{setup/
fig/tempDiff/570.pdf}}
\indent
\caption{Détail de champs vectoriels obtenus pour des temps de
différenciation différents}
\label{fig:tempDiffAbb}
\end{figure}

to no effects: the floats stay aligned on the total text width, just
as it does without \indent.

Can anybody help, please ?

Stephan Ronald

unread,
Sep 22, 2010, 12:29:47 PM9/22/10
to latexus...@googlegroups.com

Hi Vincent,
On looking at the TeX code, I think it is not easy to indent the caption without a hack or putting it inside a box. Please check whether the following approach suits your need.

\makeatletter
\def\figbox#1{%
  \parindent=2pc% you can change the parindent here
  \@tempdima=\textwidth%
  \advance\@tempdima -\parindent%
  \xdef\newtextwidth{\the\@tempdima}%
  \indent\vbox{\hsize=\newtextwidth\parindent=0pc#1}%
}

\begin{figure}[ht]
\figbox{%

       \subfloat[$190\:\mu s$]{\includegraphics[width=0.45\textwidth]{setup/ fig/tempDiff/190.pdf}}
       \hfill
       \subfloat[$570\:\mu s$]{\includegraphics[width=0.45\textwidth]{setup/ fig/tempDiff/570.pdf}}
       \caption{Détail de champs vectoriels obtenus pour des temps de différenciation différents}
       \label{fig:tempDiffAbb}
}
\end{figure}

--
Stepen Ronald
Reply all
Reply to author
Forward
0 new messages