3

I'm writing a math paper, and I want to include workings in my tables. My tables are created in the tabu environment, and I want to split my equations as so:

[variable]=[intermediate step] =[final answer]

except that the two = signs are aligned. How can I do this? split does not seem to work in the tabu environment.

Here is an MWE:

\documentclass[british, 11pt, reqno]{amsart}

\usepackage[utf8]{inputenc}

\usepackage{geometry}
\geometry{a4paper}
\geometry{margin=2cm}

\usepackage{graphicx}

\usepackage{booktabs}
\usepackage{tabu}

\begin{document}

\begin{tabu} to \textwidth{X[c] X[c]}
\toprule
Column 1 & Column 2\\
\midrule
0 & $0=0$\\
\bottomrule
\end{tabu}

\end{document}

My full preamble is here as well, in case any package or option I added may be interfering:

\documentclass[british, 11pt, reqno]{amsart}

\usepackage[utf8]{inputenc}

\usepackage{graphicx}

\usepackage{booktabs}   % These are miscellaneous packages...
\usepackage{array}
\usepackage{paralist}
\usepackage{verbatim}
\usepackage{subfig}

\usepackage{fancyhdr}   % These are for footers...
\usepackage{lastpage}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\lhead{}\chead{}\rhead{}
\lfoot{}\cfoot{\vspace{5pt}\thepage~of \pageref{LastPage}}\rfoot{}

% These are extra stuff I use in my math, and my bibliography...
\usepackage{babel}   % To use british as the bibliography language mapping for APA
\usepackage{csquotes}   % To use babel
\usepackage{amsmath, amssymb}   % for some of my math symbols
\usepackage{tikz}   % For my diagrams
\usetikzlibrary{positioning}
\usepackage{float}   % For diagram positioning
\usepackage{tabu}   % For tables
\usepackage{longtable}   % For breaking tables over pages
\usepackage{setspace}   % For setting line spacing
\onehalfspacing
\setcounter{tocdepth}{5}   % For setting table of contents numbering depth
\setcounter{secnumdepth}{5}   % For numbering subsubsections
\usepackage[backend=biber, style=apa]{biblatex}   % For my bibliography
\DeclareLanguageMapping{british}{british-apa}
\addbibresource{Biblio.bib}
0

2 Answers 2

5

You can use aligned:

\documentclass{article}
\usepackage{amsmath}
\usepackage{tabu,booktabs}

\begin{document}

\noindent
\begin{tabu} to \textwidth{X[c] X[c]}
\toprule
Column 1 & Column 2\\
\midrule
0 & $\begin{aligned}[t] x &= a \\ &=b\end{aligned}$ \\
\bottomrule
\end{tabu}

\end{document}

enter image description here

5
  • Thank you! Why doessplit not work, however? It uses the same notation AFAIK, with ampersands and double backstrokes...
    – Victor Z
    Aug 8, 2017 at 2:40
  • @VictorZ split requires display math, which is what you don't want to begin with.
    – egreg
    Aug 8, 2017 at 8:14
  • I see! Does that mean that split is more suited for math and equations, while align is suited for aligning other applications?
    – Victor Z
    Aug 8, 2017 at 14:01
  • also, what is the difference between align and aligned? @egreg
    – Victor Z
    Aug 8, 2017 at 15:45
  • @VictorZ align builds a math display, aligned doesn't (and you need to be in math mode for using it).
    – egreg
    Aug 8, 2017 at 15:50
0

Because display math and tabular etc. redefine things like & and \\, it is better to create and store display math in a savebox outside the tabu.

Setting \belowdisplayskip=0pt resulted in a gap of \dp\strutbox below the bottom baseline but setting \abovedisplayskip=0pt resulted in a gap of \baselineskip above the top baseline.

\documentclass[british, 11pt, reqno]{amsart}

\usepackage[utf8]{inputenc}

\usepackage{geometry}
\geometry{a4paper}
\geometry{margin=2cm}

\usepackage{graphicx}

\usepackage{booktabs}
\usepackage{tabu}

\usepackage{mathtools}
\newsavebox{\mybox}

\begin{document}

\savebox{\mybox}{\begin{minipage}{\dimexpr 0.5\textwidth-3\tabcolsep}%
\abovedisplayskip=\dimexpr \ht\strutbox-\baselineskip\relax
\belowdisplayskip=0pt
\begin{align*}
x &= a \rule{1pt}{\ht\strutbox} \\
&= b \rule[-\dp\strutbox]{1pt}{\dp\strutbox}
\end{align*}\end{minipage}}%
\noindent\rlap{\fboxsep=0pt\fbox{{\usebox{\mybox}}}}\rule{\textwidth}{0.5pt}% test centering
\bigskip

\noindent\begin{tabu} to \textwidth{X[c] X[c]}
\toprule
Column 1 & Column 2\\
\midrule
0 & \usebox{\mybox}\\
\bottomrule
\end{tabu}

\end{document}

demo

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .