2

I am Using the following method to put two pictures beside each other in one figure:

\begin{figure}[ht]
    \centering      
    \subfloat[ Caption 1 ]{\includegraphics[height=5cm]{Bilder/Peltiermodell/Waermestroeme}}
        \qquad
    \subfloat[ Caption 2 ]{\includegraphics[height=5cm]{Bilder/Peltiermodell/Waermestroeme_ES}} 
    \caption{ Maincaption  }\label{fig:waermestroeme}           
\end{figure}

Using the height in stead of the width to define the size lets me match the height of graphics with different aspect ratios pretty easily. The problem is that the sub caption of the second subfigure is shifter to the right. This does not happen when defining size using the width.

The caption format is configured as follows:

 \usepackage[format=hang,indention=0.0cm ,labelfont = bf,width=0.9\textwidth, font=small,]{caption}

/edit added a minimal example:

\documentclass[a4paper,12pt,twoside]{report}
\usepackage{graphicx}   
\usepackage{subfig}
\usepackage[format=hang,indention=0.0cm ,labelfont = bf,width=0.9\textwidth, font=small,]{caption}  %   

\begin{document}
\begin{figure}[ht]%---------------Doppelbild:Wärmestroeme--------
        \centering
    \subfloat[Caption 1]{\includegraphics[height=5cm]{Bilder/Peltiermodell/Waermestroeme}}
        \qquad
    \subfloat[Caption 1]{\includegraphics[height=5cm]{Bilder/Peltiermodell/Waermestroeme_ES}}   
        \caption{main caption}\label{fig:waermestroeme}
\end{figure}
\end{document}

the problem seems to be with the width=0.9\textwidth in the caption setup...but if i ged rid of that it extends all the captions to text width wich doesn't look too good.

Can I make it work anyways ? Maybe change the caption setup just for this one float ? how would I do that ? Why does this not happen when defining the size using the width ?

lots of questions :-)

thanks for the help !!

  • Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. – jub0bs May 28 '14 at 13:50
  • added a minimal example...doing that i identified the problem within the caption setup...still need a way to fix this though.. – Jo.schua May 28 '14 at 15:36
1

You have either to reset the width or, better, set the margin for the subfloat captions:

\documentclass[a4paper,12pt,twoside]{report}
\usepackage[demo]{graphicx} % demo is just for the example

\usepackage{caption}
\usepackage{subfig}

\captionsetup{
  format=hang,
  indention=0.0cm,
  labelfont = bf,
  width=0.9\textwidth,
  font=small
}
\captionsetup[subfloat]{% other settings are inherited
  margin=0pt
}

\begin{document}
\begin{figure}[ht]%---------------Doppelbild:Wärmestroeme--------
\centering
\subfloat[Caption 1]{\includegraphics[height=5cm]{Bilder/Peltiermodell/Waermestroeme}}\qquad
\subfloat[Caption 1]{\includegraphics[height=5cm]{Bilder/Peltiermodell/Waermestroeme_ES}}

\caption{main caption}\label{fig:waermestroeme}
\end{figure}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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