0

I'd like to align a tabular next to a tikz graphic in such way that both tabular and the graphic would start on the top of the page. However, even after adding the [t] option, the tabular, which is shorter than the grapic, ends up aligned to the bottom of the graphic.

Here's a minimal example

\documentclass{article}
\usepackage{tikz}

\begin{document}

\begin{minipage}[t]{0.4\textwidth}
    \begin{tabular}{|c|c|}
        \hline
        A & B \\
        \hline
        1 & 2 \\
        3 & 4 \\
        \hline
    \end{tabular}
\end{minipage}
\begin{minipage}[t]{0.6\textwidth}
    \begin{tikzpicture}
        \draw (0,0) circle (3);
    \end{tikzpicture}
\end{minipage}

% The rest of the document

\end{document}

The result ends up looking like this E

How can I move the tabular to the top of the page?

1 Answers1

1

Add an additional \vspace{0pt} at the top of each minipage should do.

Reference: Comments to this answer and another answer.

What did work is to be sure to set the [t] position indicator for each minipage, and then to specify \vspace{0pt} at the top of each minipage. Then the resulting minipages are all aligned at the top of each other.

\documentclass{article}
\usepackage{tikz}

\begin{document}

\noindent % <- for overfull box
\begin{minipage}[t]{0.4\textwidth}
    \vspace{0pt} % <-- add this
    \begin{tabular}{|c|c|}
        \hline
        A & B \\
        \hline
        1 & 2 \\
        3 & 4 \\
        \hline
    \end{tabular}%
\end{minipage}%
\begin{minipage}[t]{0.6\textwidth}
    \vspace{0pt} % <-- add this
    \begin{tikzpicture}
        \draw (0,0) circle (3);
    \end{tikzpicture}%
\end{minipage}

% The rest of the document

\end{document}

Result