# Own command works not with all LaTeX distributions and LaTeX document classes

A new defined command (see below) works on my windows with MiKTeX 2.9 and on a Mac with MacTeX. On another windows (running in a Mac) with an absolute fresh installed MiKTeX and on the same Mac in Mac OS with MacTeX the command doesn't work.

We are using absolutely the same files. The scrartcl class is used in there.

The command:

\newcommand{\mysection}[1]{%
\refstepcounter{section}%
\sectionmark{#1}%
}


The Error Message on the failing distributions (when the command is called):

Argument of \XKV@d@fine@k@y has an extra }.
<inserted text>
\par
l.6 \mysection{Die rationalen Zahlen $\Qe_0^+$}


## Update

I updated all my Packages via MiKTeX update manager and get the error now, too. I created a MWE. Interesting is that it works with class article, but not with scrartcl:

\documentclass{scrartcl}

\newcommand{\mysection}[1]{%
\refstepcounter{section}%
\sectionmark{#1}%
}

\begin{document}
\tableofcontents
\mysection{test}
\end{document}


The error message is:

Argument of \reserved@a has an extra }.
<inserted text>
\par
l.11 \mysection{test}

• You are not using absolutly the same files. So check carefully the log for differences. – Ulrike Fischer Sep 18 '14 at 14:04
• The error message is from xkeyval (which had some updates this year) but the code you show is not obviously using that) please always post a complete small document that demonstrates the error, not just a fragment – David Carlisle Sep 18 '14 at 14:13
• with the new MWE I get (texlive 2014) ! Argument of \reserved@a has an extra }.  what error do you see with miktex – David Carlisle Sep 18 '14 at 20:55
• @David Carlisle: I added the Error message in the question. – Rafael Wörner Sep 18 '14 at 20:57
• yes that's what I get so whatever it is it's an unrelated error to the one you put in the initial question (which was about xkeyval package) – David Carlisle Sep 18 '14 at 20:58

\listfiles


to your document and compare the package versions listed on the two machines. Update any packages that are out of sync (xkeyval most likely given the error message).

The MWE you added shows a missing \protect

\documentclass{scrartcl}

\newcommand{\mysection}[1]{%
\refstepcounter{section}%
\sectionmark{#1}%