3

I am trying to provide a summary and associate a symbol with the equations that define it. To achieve this goal, I tried using a tabularx and within the tabularx place align* environments to provide the definition. I've seen this is possible here: https://tex.stackexchange.com/a/121409/70681

My code looks like this:

\begin{figure}[ht]
\begin{tabularx}{\linewidth}{c X}
\makecell{$\compilerenv$ \\ Environment compile \\ function} & {\begin{align*}
    A &= B \\
    A &= C \end{align*}}
\end{tabularx}
\end{figure}

makecell is a command defined as \newcommand{\makecell}[2][@{}c@{}]{\begin{tabular}{#1}#2\end{tabular}}.

I tried compiling the code without the align* column (replaced it with a single letter) and it worked.

The error I get is:

! Misplaced \omit.
\math@cr@@@ ...@ \@ne \add@amps \maxfields@ \omit
                                              \kern -\alignsep@ \iftag@ ...
l.10 \end{tabularx}

! Misplaced \omit.
\math@cr@@@ ...@ \@ne \add@amps \maxfields@ \omit
                                              \kern -\alignsep@ \iftag@ ...
l.10 \end{tabularx}

repeated a number of times.

Help would be greatly appreciated. Thank you!

Radu Szasz
  • 219
  • 3
  • 11
  • 2
    Did you try with $\begin{aligned} ... \end{aligned}$? – Bernard Apr 16 '18 at 09:59
  • @Bernard aligned works. Thank you so much! Would you mind making this as an answer so I can accept it? – Radu Szasz Apr 16 '18 at 10:00
  • @DavidCarlisle Sorry! I'll do that from my next question. I didn't post on TexExchange much and while I read a lot, I always took the fact that there's a whole document posted for granted. – Radu Szasz Apr 16 '18 at 10:03

2 Answers2

8

In the place of the align* environment, this should work (you can add the \displaystyle directive if necessary):

$\begin{aligned} ... \end{aligned}$
Bernard
  • 271,350
3

I get no error from your input, but not an exciting result either:

\documentclass{article}
\usepackage{amsmath,tabularx}

\newcommand{\makecell}[2][c]{\begin{tabular}{@{}#1@{}}#2\end{tabular}}
\newcommand{\compilerenv}{???}

\begin{document}

\noindent
\begin{tabularx}{\linewidth}{c X}
\hline
\makecell{$\compilerenv$ \\ Environment compile \\ function} &
  {\begin{align*}
    A &= B \\
    A &= C \end{align*}}\\
\hline
\makecell{$\compilerenv$ \\ Environment compile \\ function} &
\centering\arraybackslash
$\begin{aligned}
    A &= B \\
    A &= C \end{aligned}$ \\
\hline
\end{tabularx}

\end{document}

A better result is obtained with \centering and aligned, as you see in the bottom part (I used rules just to have a better look at the involved spaces).

enter image description here

egreg
  • 1,121,712