0

When I define one single newcommand the document it is fine, there is a MWE:

\documentclass{article}
\newcommand{\varB}{\def \@varB}

\newcommand{\printvarB}{@varB} \varB{variable B}

\begin{document} \printvarB \end{document}

The result is a page with the text variable B.

But, when I try define a second variable by using \newcommand the following error appears: Use of @ doesn't match its definition. With the following description:

*\printvarA ->@varA

l.10 \printvarA

If you say, e.g., \def\a1{...}', then you must always put 1' after `\a', since control sequence names are made up of letters only. The macro here has not been followed by the required stuff, so I'm ignoring it.*

Here a MWE that leads to the previous error:

\documentclass{article}
\newcommand{\varA}{\def \@varA}
\newcommand{\varB}{\def \@varB}
\newcommand{\printvarA}{\@varA}
\newcommand{\printvarB}{\@varB}
\varA{variable A}
\varB{variable B}

\begin{document} \printvarA \printvarB \end{document}

The desire result I want is to print both texts: variable A variable B.

Can someone help me to understand that error? As well, how can I fix it?

Thanks!

DiegoMath
  • 113

0 Answers0