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'm writing a presentation with Beamer and I need the minipage package. When I worked on Linux there was no problem: apparently, minipage does not exist for Mac OS.

I've so tried to install genmpage, but I really can't understand how to use it (I searched some examples on Google but all I can find are documentation pages I'm not too familiar with).

Here is an example of what I used to do on linux:

\frame{
\frametitle{Title of the slide}
\begin{minipage}{.5\textwidth}
\hspace{-1.25cm}
\centering
\includegraphics[height=0.55\textheight]{figA.pdf}\\
\hspace{-1.25cm}
\caption{caption of figA\\
\scriptsize\textcolor{red}{[Wu et al., Nature (2009)]}}
\end{minipage}%
\begin{minipage}{.5\textwidth}
\hspace{+0.25cm}
\centering
\includegraphics[height=0.55\textheight]{figB.pdf}\\
\hspace{+0.25cm}
\caption{caption of figB\\
\scriptsize\textcolor{red}{[Tizio, Caio et al., Nature (2006)]}}\\
\end{minipage}
}

What should I do to solve this problem? Is it possible to somehow install the "original" minipage package? And if not, what are the commands of genmpage?

share|improve this question
    
The minipage environment is defined by the LaTeX kernel I believe, you don't need any package to use it. Edit: And genmpage should be part of MacTeX I think, so you shouldn't need to install it. –  Torbjørn T. Apr 7 at 4:21
    
Could you explain exactly what you want to do? –  Torbjørn T. Apr 7 at 4:26
    
I simply would like to vertically divide some of my slides so that I can put two figures side by side and some text below each of them (see edited question). Actually, I think that calling the package is necessary, but I am not sure 100%. –  Orso Apr 7 at 5:08
3  
Trust me, you do not need a package to use \begin{minipage}{5cm}...\end{minipage}. The error you get from that code is caption outside float, which makes sense as there is no figure environment. However, you don't really need \caption here do you? If you remove just \caption your code works fine. –  Torbjørn T. Apr 7 at 5:12
    
You are 100% right. :-) Thank you so much! –  Orso Apr 7 at 5:15

1 Answer 1

up vote 5 down vote accepted

I don't think there is any minipage package, but the minipage environment is defined in the LaTeX kernel, so no packages are required to use it. The code you show doesn't work because you've used \caption outside a floating environment (figure), it has nothing to with the minipage or operating system.

So you could add a figure environment around the two minipages to allow the use of \caption. You would need to remove the \\ in the caption, as that doesn't work, but using an empty line instead works fine. You could also use the technique described in Line break in table caption using beamer.

However, you could also just ditch the caption altogether. Remove \caption from your code and it compiles fine.

You could also use the columns and column environments provided by beamer. As noted by Ignasi in a comment, if you add onlytextwidth as an option to the columns, i.e. \begin{columns}[onlytextwidth], the extra space seen in the last frame below won't be added, giving a result similar to that in the third frame.

The code below illustrates all these approaches. The demo option causes the images to be replaced by black rectangles, so you don't want that for your real document.

enter image description here

\documentclass[demo]{beamer}

\begin{document}

\begin{frame}
\frametitle{Original code without caption}
\begin{minipage}{.5\textwidth}
\hspace{-1.25cm}
\centering
\includegraphics[height=0.55\textheight]{figA.pdf}\\
\hspace{-1.25cm}
caption of figA\\
\scriptsize\textcolor{red}{[Wu et al., Nature (2009)]}
\end{minipage}%
\begin{minipage}{.5\textwidth}
\hspace{+0.25cm}
\centering
\includegraphics[height=0.55\textheight]{figB.pdf}\\
\hspace{+0.25cm}
caption of figB\\
\scriptsize\textcolor{red}{[Tizio, Caio et al., Nature (2006)]}
\end{minipage}
\end{frame}

\begin{frame}
\frametitle{With figure environment}
\begin{figure}
\begin{minipage}{.5\textwidth}
\centering
\includegraphics[height=0.55\textheight]{figA.pdf}

\caption{caption of figA

\scriptsize\textcolor{red}{[Wu et al., Nature (2009)]}}
\end{minipage}%
\begin{minipage}{.5\textwidth}
\centering
\includegraphics[height=0.55\textheight]{figB.pdf}

\caption{caption of figB

\scriptsize\textcolor{red}{[Tizio, Caio et al., Nature (2006)]}}
\end{minipage}
\end{figure}
\end{frame}

\begin{frame}
\frametitle{Modified version with just minipages}
\begin{minipage}{.5\textwidth}
\centering
\includegraphics[height=0.55\textheight]{figA.pdf}

caption of figA

\scriptsize\textcolor{red}{[Wu et al., Nature (2009)]}
\end{minipage}%
\begin{minipage}{.5\textwidth}
\centering
\includegraphics[height=0.55\textheight]{figB.pdf}

caption of figB

\scriptsize\textcolor{red}{[Tizio, Caio et al., Nature (2006)]}
\end{minipage}
\end{frame}

\begin{frame}
\frametitle{columns example}
\begin{columns}
\begin{column}{.5\textwidth}
\centering
\includegraphics[height=0.55\textheight]{figA.pdf}

caption of figA

\scriptsize\textcolor{red}{[Wu et al., Nature (2009)]}
\end{column}%
\begin{column}{.5\textwidth}
\centering
\includegraphics[height=0.55\textheight]{figB.pdf}

caption of figB

\scriptsize\textcolor{red}{[Tizio, Caio et al., Nature (2006)]}
\end{column}
\end{columns}
\end{frame}

\end{document}
share|improve this answer
    
With columns environment you can use onlytextwidth option to make all columns only occupy textwidth with adding any extra horizontal space. –  Ignasi Apr 7 at 10:22

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.