Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer 1

up vote 6 down vote accepted

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}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.