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 have an addition to this question: Two figures side by side.

Suppose we have two pictures, making them of uneven height. I am looking for a way to not use subfig and align two figures side-by-side, while keeping the captions vertically aligned.

I've created the following example:

\documentclass{article}
\title{Two Figures Side by Side}
\author{Little Bobby Tables}
\usepackage{lipsum}
\usepackage{tikz}

\newcommand{\exedout}{
\begin{tikzpicture}
\path node (LL) {}
    ++ (0.8\textwidth, 0.8\textheight) node (UR) {}
    (LL -| UR) node (LR) {}
    (LL |- UR) node (UL) {};
\draw (LL) rectangle (UR) (LL) -- (UR) (UL) -- (LR);
\end{tikzpicture}
}

\newcommand{\exedouttwo}{
\begin{tikzpicture}
\path node (LL) {}
    ++ (0.8\textwidth, 0.4\textheight) node (UR) {}
    (LL -| UR) node (LR) {}
    (LL |- UR) node (UL) {};
\draw (LL) rectangle (UR) (LL) -- (UR) (UL) -- (LR);
\end{tikzpicture}
}
\begin{document}
\maketitle
How can I put two figures side-by-side? Not two sub-figures, but two actual figures
with separate "Fig.: bla bla" captions. A figure is supposed to spread over the
entire text width, but I have two figures which are narrow and long, and I need to
save the space in order to withstand the pages limit.

\lipsum

\begin{figure}
\centering
\begin{minipage}{0.45\textwidth}
\centering\exedout
\caption{first figure but with more comments than the second picture to see what the different is.}
\end{minipage}
\begin{minipage}{0.45\textwidth}
\centering\exedouttwo
\caption{second figure}
\end{minipage}
\end{figure}

\lipsum

\end{document}

It gives the following result:

wrong alignment

But I need this:

right alignment

share|improve this question
1  
minipage environments have placement parameters [c], [t] and [b], do they help? –  uli Dec 6 '11 at 12:43

2 Answers 2

up vote 9 down vote accepted

Use the [t] optional argument of minipage to align both to the top baseline (i.e. the image baseline / lower line). I also added %s to your macros to avoid extra spaces being inserted by the source code line breaks.

\documentclass{article}
\usepackage{lipsum}
\usepackage{tikz}

\newcommand{\exedout}{%
\begin{tikzpicture}
\path node (LL) {}
    ++ (0.8\textwidth, 0.8\textheight) node (UR) {}
    (LL -| UR) node (LR) {}
    (LL |- UR) node (UL) {};
\draw (LL) rectangle (UR) (LL) -- (UR) (UL) -- (LR);
\end{tikzpicture}%
}

\newcommand{\exedouttwo}{%
\begin{tikzpicture}
\path node (LL) {}
    ++ (0.8\textwidth, 0.4\textheight) node (UR) {}
    (LL -| UR) node (LR) {}
    (LL |- UR) node (UL) {};
\draw (LL) rectangle (UR) (LL) -- (UR) (UL) -- (LR);
\end{tikzpicture}%
}
\begin{document}
How can I put two figures side-by-side? Not two sub-figures, but two actual figures
with separate "Fig.: bla bla" captions. A figure is supposed to spread over the
entire text width, but I have two figures which are narrow and long, and I need to
save the space in order to withstand the pages limit.

\lipsum

\begin{figure}
\centering
\begin{minipage}[t]{0.45\textwidth}
\centering\exedout
\caption{first figure but with more comments than the second picture to see what the different is.}
\end{minipage}
\begin{minipage}[t]{0.45\textwidth}
\centering\exedouttwo
\caption{second figure}
\end{minipage}
\end{figure}

\lipsum

\end{document}
share|improve this answer
    
Yes, this is what I was looking for. I already tried it with only a single [t], but didn't come up with doing it at both minipages. –  Marnix Dec 6 '11 at 13:28

Is using floatrow an option?

Note that in the following example I made the two figures narrower by changing \exedout and \exedouttwo, as ffigbox doesn't seem to change \textwidth as minipage does, hence the two figures would be too wide.

\documentclass{article}
\title{Two Figures Side by Side}
\author{Little Bobby Tables}
\usepackage{lipsum}
\usepackage{tikz}
\usepackage{floatrow}
\newcommand{\exedout}{
\begin{tikzpicture}
\path node (LL) {}
    ++ (0.4\textwidth, 0.8\textheight) node (UR) {}
    (LL -| UR) node (LR) {}
    (LL |- UR) node (UL) {};
\draw (LL) rectangle (UR) (LL) -- (UR) (UL) -- (LR);
\end{tikzpicture}
}

\newcommand{\exedouttwo}{
\begin{tikzpicture}
\path node (LL) {}
    ++ (0.4\textwidth, 0.4\textheight) node (UR) {}
    (LL -| UR) node (LR) {}
    (LL |- UR) node (UL) {};
\draw (LL) rectangle (UR) (LL) -- (UR) (UL) -- (LR);
\end{tikzpicture}
}
\begin{document}
\maketitle
How can I put two figures side-by-side? Not two sub-figures, but two actual figures
with separate "Fig.: bla bla" captions. A figure is supposed to spread over the
entire text width, but I have two figures which are narrow and long, and I need to
save the space in order to withstand the pages limit.

\lipsum

\begin{figure}
\begin{floatrow}
\ffigbox{\caption{first figure but with more comments than the second picture to see what the different is.}}{\exedout}
\ffigbox{\caption{second figure}}{\exedouttwo}
\end{floatrow}
\end{figure}

\lipsum

\end{document}

enter image description here

share|improve this answer
    
Seems like a good alternative if I need any other configurations like aligning them both at the top. –  Marnix Dec 6 '11 at 13:29

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.