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.

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).

share|improve this question
add comment

1 Answer 1

up vote 7 down vote accepted

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

share|improve this answer
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
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.