4

The following minimal working example employs a cals table in the document environment and works fine:

\documentclass{article}

%document encoding
\usepackage[utf8]{inputenc}

%geometry
\RequirePackage[a4paper, layoutwidth=10.5cm, layoutheight=20cm, noheadfoot, nomarginpar, margin=0mm, showcrop]{geometry}
\RequirePackage{calc}
\geometry{layouthoffset=0.5\paperwidth-5.25cm}
\geometry{layoutvoffset=0.5\paperheight-10cm}
\setlength{\topskip}{0mm}
\setlength{\parindent}{0mm}

%table
\RequirePackage{cals}

\begin{document}
\thispagestyle{empty}
\begin{calstable}
\makeatletter
\colwidths{{3.30cm}{1.95cm}{5.25cm}}
\def\cals@cs@width{0.8pt}
\def\cals@rs@width{0.8pt}
\setlength{\cals@paddingT}{1.44ex}
\setlength{\cals@paddingL}{1em}
\brow \nullcell{tbl}\nullcell{tb}\nullcell{tbr}\spancontent{} \ht\cals@current@row=30mm \erow
\brow \alignC \nullcell{tbl}\nullcell{tbr}\spancontent{} \alignL \cell{} \ht\cals@current@row=22mm \erow
\makeatother
\end{calstable}
\end{document}

However, when I put the code in a \newcommand called \calscommand I get a Use of \cals doesn't match its definition \calscommand error:

\documentclass{article}

%document encoding
\usepackage[utf8]{inputenc}

%geometry
\RequirePackage[a4paper, layoutwidth=10.5cm, layoutheight=20cm, noheadfoot, nomarginpar, margin=0mm, showcrop]{geometry}
\RequirePackage{calc}
\geometry{layouthoffset=0.5\paperwidth-5.25cm}
\geometry{layoutvoffset=0.5\paperheight-10cm}
\setlength{\topskip}{0mm}
\setlength{\parindent}{0mm}

%table
\RequirePackage{cals}
\newcommand{\calscommand}{%
\thispagestyle{empty}
\begin{calstable}
\makeatletter
\colwidths{{3.30cm}{1.95cm}{5.25cm}}
\def\cals@cs@width{0.8pt}
\def\cals@rs@width{0.8pt}
\setlength{\cals@paddingT}{1.44ex}
\setlength{\cals@paddingL}{1em}
\brow \nullcell{tbl}\nullcell{tb}\nullcell{tbr}\spancontent{} \ht\cals@current@row=30mm \erow
\brow \alignC \nullcell{tbl}\nullcell{tbr}\spancontent{} \alignL \cell{} \ht\cals@current@row=22mm \erow
\makeatother
\end{calstable}
}

\begin{document}
\calscommand
\end{document}

What am I doing wrong?

1 Answer 1

5

move

\makeatletter

before your definition and

\makeatother

after it. You need the @ to be a letter used in command names at the point of the definition where you use those commands, not inside the definition.

1
  • Moving \makeatletter and \makeatother to the correct positions indeed did the trick. Thank you very much, David! May 18, 2013 at 9:04

You must log in to answer this question.

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