Place content side by side in LaTeX (minipage)
Write two minipage environments directly after each other, each with its width as argument. They stand next to each other as long as the widths add up to no more than \linewidth and no empty line separates them.
Preamble
The snippets on this page need these lines before \begin{document}:
\usepackage{graphicx}Two blocks of text
The argument is the width of the box; text wraps inside it. \hfill between the boxes pushes them to the left and right edge.
\noindent
\begin{minipage}{0.48\linewidth}
The left block. Its text wraps at 48 percent of the line width.
\end{minipage}\hfill
\begin{minipage}{0.48\linewidth}
The right block starts on the same line.
\end{minipage}Align the tops or the bottoms
The optional argument sets which line of the box sits on the surrounding line: [t] the first, [b] the last, [c] the middle (default). Give both boxes [t] so their first lines are level.
\noindent
\begin{minipage}[t]{0.48\linewidth}
A short block.
\end{minipage}\hfill
\begin{minipage}[t]{0.48\linewidth}
A longer block. It has more lines than the left one,
but both start at the same height.
\end{minipage}Text next to an image
An image is one tall line whose baseline is its bottom edge, so [t] alone aligns the first text line with the bottom of the image. \vspace{0pt} at the start of both boxes gives them a common top edge.
\noindent
\begin{minipage}[t]{0.35\linewidth}
\vspace{0pt}
\includegraphics[width=\linewidth]{image.png}
\end{minipage}\hfill
\begin{minipage}[t]{0.6\linewidth}
\vspace{0pt}
The text starts at the top edge of the image and wraps
in the space to the right of it.
\end{minipage}Pitfalls
- The line break after
\end{minipage}counts as a space. Two boxes of0.5\linewidthplus that space are wider than the line, and LaTeX reports an overfull hbox; put%or\hfilldirectly after\end{minipage}. - A footnote inside a
minipageis printed at the bottom of the box and marked with a letter. - A
minipagenever breaks across pages. For two images with captions, see Place images side by side in LaTeX and Subfigures in LaTeX.
Compiled with pdfLaTeX from TeX Live 2023.