I am trying to do something that seems relatively simple but I can't get it to work. Basically, I would like one of the columns in my math mode array to be text, so I am trying to use pre and post processing >{}
and <{}
like so
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
\begin{array}{{>{\text\bgroup}c<{\egroup}}@{:}c@{=}c}
a & x^2 & x^2 \\
b & y^2 & y^2 \\
c & z^2 & z^2
\end{array}
\end{align}
\end{document}
This leads to an "illegal character in array arg" error. What is the right way to do this?
Best Answer
You're close. In the modified example below, I'm using the
array
environment and define a special column type,L
', that's automatically in text mode. The reason this works is becausel
,c
, andr
are automatically in math mode in anarray
environment.Note the second intercolumn specifier,
@{{}={}}
: The pairs of{}
curly braces before and after the=
sign are there to inform TeX that the=
sign is to be treated as a so-calledmathrel
object. In case this sounds a bit cryptic:mathord
,mathbin
, andmathrel
objects each have different amounts of whitespace before and after them. An easy way to make TeX treat a=
symbol as amathrel
object even though it occurs in a non-equation setting is to pre- and post-fix it with (empty) math "atoms", viz.,{}
.Note also that it's not necessary to use the
align
environment as there is really only one "equation" in the example.