Text FormattingError: File ended while scanning use of \@argdef

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
Maunz
Posts: 2
Joined: Mon Jan 07, 2013 12:00 pm

Error: File ended while scanning use of \@argdef

Post by Maunz »

Hi everyone

I'm currently writing a scientific report where I use siunitx for my SI units. So instead of always typing e.g \SI{2}{\celsius} I wanted to create a new command to faciliate the writing. However, I get the error stated in the title and I have no clue how to make it work. I use a new command for \SI{}{\uL}which does its job. Where am I making a mistake?

Code: Select all

% test
\documentclass{scrartcl}
\usepackage{siunitx}
\sisetup{load-configurations = abbreviations}

\newcommand{\cel}[1]{\SI{#1}{\celsius}

\begin{document}
\cel{2}
\end{document}
Error message:
Runaway argument?
{\SI {##1}{\celsius } \par \begin {document} \cel {2} \end {document}\ETC.
! File ended while scanning use of \@argdef.
<inserted text>
\par
<*> test.tex

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Error: File ended while scanning use of \@argdef

Post by cgnieder »

Hi Maunz,

Welcome to the LaTeX community. There's a closing brace missing after {\celsius}. The error is actually telling you that: the file ended while TeX was still reading the argument definition. Solution:

Code: Select all

\newcommand{\cel}[1]{\SI{#1}{\celsius}}
Regards
site moderator & package author
Maunz
Posts: 2
Joined: Mon Jan 07, 2013 12:00 pm

Re: Error: File ended while scanning use of \@argdef

Post by Maunz »

Oh my gosh..really, sometimes I amaze myself :oops: . Thanks for stating the obvious!
Post Reply