3

I am playing with floatrow, however the images are not aligned at the top and I do not know what I am doing wrong.

\begin{figure}[H]
\begin{floatrow}
\floatbox{figure}[0.4\textwidth][\FBheight][t]
{\caption{first image positioned at the top}
 \label{fig:floatrow:example:3:a}}
{\includegraphics[width=0.25\textwidth]{images/TestBild.png}}
%
\floatbox{figure}[0.4\textwidth][\FBheight][t]
{\caption{second image positioned at the top}
 \label{fig:floatrow:example:3:b}}
{\includegraphics[width=0.2\textwidth]{images/TestBild.png}}
\end{floatrow}
\end{figure}

also I would like to add a defined spacing between the pictures, but have not found out how. Typically I add either \hspace{2em} or \hfill, but both do nothing if inserted between the commands (as expected).

7

You can use the option heightadjust=object for \floatsetup, as I did in the following example:

\documentclass[10pt]{article}
\usepackage{floatrow}
\usepackage[demo]{graphicx}

\floatsetup{heightadjust=object}

\begin{document}

\begin{figure}
\begin{floatrow}
\floatbox{figure}[.4\textwidth][\FBheight][t]
{\caption{first image positioned at the top}
 \label{fig:floatrow:example:3:a}}
{\includegraphics[width=0.25\textwidth,height=7cm]{images/TestBild.png}}\hspace*{1cm}
%
\floatbox{figure}[.4\textwidth][\FBheight][t]
{\caption{second image positioned at the top}
 \label{fig:floatrow:example:3:b}}
{\includegraphics[width=0.2\textwidth]{images/TestBild.png}}
\end{floatrow}
\end{figure}

\end{document}

I used the demo option for the graphicx package to replace the images with black rectangles; do not use that option in your actual code.

enter image description here

  • 1
    why do you need valign=tif this is already included in the floatbox command? – Matthias Pospiech Oct 31 '11 at 23:15
  • @MatthiasPospiech: you're right; valign=t is not necessary with your code. – Gonzalo Medina Oct 31 '11 at 23:27

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.