Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.
\monthname[10] \ordinaldate{10}

produces October 10th, as expected. But once I put it into a section, I get this error:

! Argument of \@ordinalnum has an extra }.
<inserted text> 
                \par 
l.11 \section*{\monthname[10] \ordinaldate{10}}

What is happening and why?

EDIT

Though

\section*{\monthname[10] \protect\ordinaldate{10}}

works just fine for displaying the date like I want to, I suddenly get a new error from the main file that I am including this 2006-10.tex file from:

! Extra \else.
\@include ...ediate \closeout \@partaux \fi \else 
                                                  \deadcycles \z@ \@nameuse ...
l.89 \include{Years/2006-10}

I am not using \if or \else statements anywhere in either the main document, or this included document. The error goes away if I remove \protect\ordinaldate{10}.

Weirdly enough, adding other things like \protect\dayofweekname{10}{10}{2006} doesn't produce such an error. Only putting in \protect\ordinaldate{10} causes the include error.

EDIT 2

\protect\ordinalnum{10} doesn't cause such an error, despite \protect\ordinaldate{10} doing so, so I guess I will just use \ordinalnum for now

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

You need to \protect \ordinaldate:

\documentclass{article}
\usepackage{datetime}
\begin{document}

\section{\monthname[10] \protect\ordinaldate{10}}

\end{document}

enter image description here

share|improve this answer
    
It worked! Thank you, and I wonder if you could take a stab at the new problem I'm having now? –  wrongusername Sep 10 '13 at 5:23
    
@wrongusername you need to \protect it only in sectional units (such as in \section, \chapter...) and maybe also in \caption. No need to \protect it in other contexts. –  Gonzalo Medina Sep 10 '13 at 5:32
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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