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}
Result
The compiled example

Open in the editor

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}
Result
The compiled example

Open in the editor

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}
Result
The compiled example

Pitfalls

Compiled with pdfLaTeX from TeX Live 2023.

Related pages