1

This question already has an answer here:

Consider the following MWE:

\documentclass{article}

\usepackage{xpunctuate}
\DeclareRobustCommand\eg{e.g\xperiod}

%% Standard Conditions symbol
\providecommand\barcirc{\mathpalette\@barred\circ}%
\def\@barred#1#2{\ooalign{\hfil$#1-$\hfil\cr\hfil$#1#2$\hfil\cr}}%
\newcommand\stst{^{\protect\barcirc}}%

\begin{document}

Maybe a list, \eg, a, b, c, and d.

\end{document}

Which fails to compile with the error message

! Use of \@ doesn't match its definition.
\xprd@Out ->\xprd@Obj .\@\xspace

Why does this happen? It seems that the code which should only create a symbol redefined the \@ command but how?

marked as duplicate by egreg, Heiko Oberdiek, elemakil, user31729, Torbjørn T. Oct 6 '14 at 11:58

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    You need \makeatletter if you want to use @ in this way. – Ian Thompson Oct 6 '14 at 11:33
  • @IanThompson Indeed... This was actually the condensed MWE from my much larger document where in a file three \input statements deep the \stst command was defined. Is there some way to tell (pdf)latex to warn me if I'm using \@ commands outside of a \makeat{letter,other} group? My header file has grown a bit... so I fear there could be more of this hidden somewhere. – elemakil Oct 6 '14 at 11:36
  • @elemakil --- None that I am aware of. This doesn't usually cause a problem because commands with @ generally only appear in packages and classes (where @ is allowed by default) and (occasionally) in the preamble (where it isn't, so you have to be careful). – Ian Thompson Oct 6 '14 at 11:41
  • @egreg Yes! I'm not sure how to continue, should I delete the question, mark as duplicate or accept an answer? – elemakil Oct 6 '14 at 11:41
  • @elemakil No, there's no way to do what you hope. The question I linked is our “canonical” one for this kind of problems. It's up to you choosing whether to delete or keep the question – egreg Oct 6 '14 at 11:41
2

It's possible that you must enclose between \makeatletter and \makeatother definitions that contain @.

\documentclass{article}

\usepackage{xpunctuate}
\DeclareRobustCommand\eg{e.g\xperiod}

%% Standard Conditions symbol
\makeatletter
\providecommand\barcirc{\mathpalette\@barred\circ}%
\def\@barred#1#2{\ooalign{\hfil$#1-$\hfil\cr\hfil$#1#2$\hfil\cr}}%
\newcommand\stst{^{\protect\barcirc}}%
\makeatother

\begin{document}

Maybe a list, \eg, a, b, c, and d.

\end{document}

For more information you must read What do \makeatletter and \makeatother do?

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