1

When I load array or siunitx or (probably other packages that I haven't tried), I get an error saying:

! Package array Error: Illegal pream-token (\specifier): `c' used.

\documentclass[preview,border=12pt,12pt]{standalone}
\usepackage{mathtools,booktabs}

\newcommand\specifier{%
        r@{}r@{}l
        @{\quad}c@{\quad}
        r@{}r@{}l
        @{}c}

\newcommand\act[1]{\xrightarrow{\quad\mathclap{\times #1}\quad}}
\newcommand\ope[1]{~\smash{\raisebox{.8\normalbaselineskip}{$#1$}}}
\newcommand\equ[3]{{}#1 & {}#2 & {}=#3}

\begin{document}
$
    \begin{array}{\specifier}
     \equ{3x}{+3y}{7} & \act{1} & \equ{3x}{+3y}{7}            \\[\jot]
     \equ{3x}{}{22}   & \act{3} & \equ{3x}{}{66}   & \ope{-}  \\\cmidrule{5-7}
         &&           &         & \equ{}{{{-3y}}}{59}         \\[\jot]
         &&           &         & \equ{}{y}{-59/3}            \\
    \end{array}
$
\end{document}

How to get rid of an error when I load array or siunitx?

1 Answer 1

6

You can't use commands directly as array or tabular preamble. But you can use \newcolumntype as follows.

\documentclass[preview,border=12pt,12pt]{standalone}
\usepackage{mathtools,booktabs}
\usepackage{array}
\newcolumntype\specifier{%
        r@{}r@{}l
        @{\quad}c@{\quad}
        r@{}r@{}l
        @{}c}

\newcommand\act[1]{\xrightarrow{\quad\mathclap{\times #1}\quad}}
\newcommand\ope[1]{~\smash{\raisebox{.8\normalbaselineskip}{$#1$}}}
\newcommand\equ[3]{{}#1 & {}#2 & {}=#3}

\begin{document}
$
    \begin{array}{\specifier}
     \equ{3x}{+3y}{7} & \act{1} & \equ{3x}{+3y}{7}            \\[\jot]
     \equ{3x}{}{22}   & \act{3} & \equ{3x}{}{66}   & \ope{-}  \\\cmidrule{5-7}
         &&           &         & \equ{}{{{-3y}}}{59}         \\[\jot]
         &&           &         & \equ{}{y}{-59/3}            \\
    \end{array}
$
\end{document}

You must log in to answer this question.

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