# MInipage not working with text and array/table with theorem environment

I am having a problem putting text and array side by side using minipage. I realized that the error is due to theorem environment, since without this it works. This is what I am getting

The code is below

\documentclass{article}
\usepackage{amsthm, amsmath, amssymb, mathtools, thmtools}
\usepackage{graphicx}
\theoremstyle{definition}
\declaretheorem[name=Theorem]{theorem}
\begin{document}
\begin{theorem}
\begin{minipage}[c]{0.55\textwidth}
Group of Integers modulo $n$ consists of the set $\{0, 1, 2, \dots, n - 1\}$ with the
operation of addition modulo $n.$ Imagine the numbers 0 through $n - 1$ to be points on the unit circle, each
one separated from the next by an arc of length $2\pi / n.$ To add two numbers $h$ and $k,$ start with $h$
and move clockwise through an arc of $k$ times $2\pi / n.$ The sum $h + k$ will be one of the numbers 0
through $n - 1.$ From geometrical considerations it is clear that this kind of addition is associative. Zero
is the identity element of this group and $n - h$ is the inverse of $h$ [for $h + (n - h) = n,$ which
coincides with 0]. This group, the group of integers modulo $n,$ is represented by the symbol $Z_n.$
\end{minipage}
\hspace*{\fill}
\begin{minipage}[c]{0.4\textwidth}
\begin{equation*}
\begin{array}{c|cccccc}
+_{6} & 0 & 1 & 2 & 3 & 4 & 5 \\ \hline
0 & 0 & 1 & 2 & 3 & 4 & 5 \\
1 & 1 & 2 & 3 & 4 & 5 & 0 \\
2 & 2 & 3 & 4 & 5 & 0 & 1 \\
3 & 3 & 4 & 5 & 0 & 1 & 2 \\
4 & 4 & 5 & 0 & 1 & 2 & 3 \\
5 & 5 & 0 & 1 & 2 & 3 & 4
\end{array}
\end{equation*}
\end{minipage}
\end{theorem}

\end{document}

• Here is a strange one: try adding \item before the first minipage – daleif Apr 6 '20 at 20:53
• @daleif Hahaaa worked like a charm. Thank you – Kumarm Apr 6 '20 at 21:04
• A theorem is actually a list of one item, where the \item has already been called. Who says we cannot have more that one item. It comes with a cost though. LaTeX is allowed to page break at this new item – daleif Apr 6 '20 at 21:06
• @daleif Can you write it as an answer so that I can accept it? – Kumarm Apr 6 '20 at 22:01

Since theorems are implemented using lists, where the \item is hidden in the header we can cheat.

Try adding another \item before the first minipage.

Caveat larex is now allowed to page break between the theorem header and the rest.

I guess you prefer something like this:

\documentclass{article}
\usepackage{amsthm, amsmath, amssymb, mathtools, thmtools,array}
\usepackage{graphicx}
\theoremstyle{definition}
\declaretheorem[name=Theorem]{theorem}
\begin{document}

\vspace{\topsep}
\begin{minipage}[t]{0.55\textwidth}
\begin{theorem}
Group of Integers modulo $n$ consists of the set $\{0, 1, 2, \dots, n - 1\}$ with the
operation of addition modulo $n$. Imagine the numbers 0 through $n - 1$ to be points on
the unit circle, each one separated from the next by an arc of length $2\pi / n$. To add
two numbers $h$ and $k$, start with $h$ and move clockwise through an arc of $k$ times
$2\pi / n$. The sum $h + k$ will be one of the numbers $0$ through $n - 1$. From
geometrical considerations it is clear that this kind of addition is associative. Zero
is the identity element of this group and $n - h$ is the inverse of $h$ [for
$h + (n - h) = n$, which coincides with $0$]. This group, the group of integers modulo
$n$, is represented by the symbol $Z_n$.
\end{theorem}
\end{minipage}
\hspace*{\fill}%
\raisebox{-1.2ex}{$\begin{array}[t]{c|cccccc} +_{6} & 0 & 1 & 2 & 3 & 4 & 5 \\ \hline 0 & 0 & 1 & 2 & 3 & 4 & 5 \\ 1 & 1 & 2 & 3 & 4 & 5 & 0 \\ 2 & 2 & 3 & 4 & 5 & 0 & 1 \\ 3 & 3 & 4 & 5 & 0 & 1 & 2 \\ 4 & 4 & 5 & 0 & 1 & 2 & 3 \\ 5 & 5 & 0 & 1 & 2 & 3 & 4 \end{array}$}\par\vspace{\topsep}

\end{document}


If you prefer center alignment:

\documentclass{article}
\usepackage{amsthm, amsmath, amssymb, mathtools, thmtools,array}
\usepackage{graphicx}
\theoremstyle{definition}
\declaretheorem[name=Theorem]{theorem}
\begin{document}

\vspace{\topsep}
\begin{minipage}{0.55\textwidth}
\begin{theorem}
Group of Integers modulo $n$ consists of the set $\{0, 1, 2, \dots, n - 1\}$ with the
operation of addition modulo $n$. Imagine the numbers 0 through $n - 1$ to be points on
the unit circle, each one separated from the next by an arc of length $2\pi / n$. To add
two numbers $h$ and $k$, start with $h$ and move clockwise through an arc of $k$ times
$2\pi / n$. The sum $h + k$ will be one of the numbers $0$ through $n - 1$. From
geometrical considerations it is clear that this kind of addition is associative. Zero
is the identity element of this group and $n - h$ is the inverse of $h$ [for
$h + (n - h) = n$, which coincides with $0$]. This group, the group of integers modulo
$n$, is represented by the symbol $Z_n$.
\end{theorem}
\end{minipage}
\hspace*{\fill}%
$\begin{array}{c|cccccc} +_{6} & 0 & 1 & 2 & 3 & 4 & 5 \\ \hline 0 & 0 & 1 & 2 & 3 & 4 & 5 \\ 1 & 1 & 2 & 3 & 4 & 5 & 0 \\ 2 & 2 & 3 & 4 & 5 & 0 & 1 \\ 3 & 3 & 4 & 5 & 0 & 1 & 2 \\ 4 & 4 & 5 & 0 & 1 & 2 & 3 \\ 5 & 5 & 0 & 1 & 2 & 3 & 4 \end{array}$\par\vspace{\topsep}

\end{document}


Punctuation after in inline formulas should go outside the formula: $Z_n$. instead of $Z_n.$

• Thanks for the answers. I would prefer the theorem to end after minipage as it has qedsymbol at the end. Also for the Punctuation, sometimes '.' gets to the new line if I put it outside. – Kumarm Apr 6 '20 at 21:11
• @Kumarm Sorry, but there's no trace at all of QED in your question. About punctuation, TeX will never detach it from the formula, unless you add a space in between. – egreg Apr 6 '20 at 21:14
• Sorry about that. I did not kew that someone will do it like the way you did that's why I did not included it in the question. – Kumarm Apr 6 '20 at 22:01