TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to use isodate's \printdate as part of a command to create a new section. Simplified example:



\newcommand{\datesec}[1]{\section{Date \printdate{#1}}}




This gets numerous errors when run through pdflatex, starting with:

! Undefined control sequence.
\@nnil ->\@nil 

l.10 \datesec{2010-11-01}

I've tried every expansion trick I know (which is not saying much). In my experiments it also seems to me that I've managed to make a section heading successfully include the date, but then the PDF bookmark generated (I think) by hyperref just shows "Date " without including the output from \printdate.

How can I use \printdate in a section title and also have it generate a correct, complete PDF bookmark? Thanks!

P.S.: I've had a little more luck with datetime's \formatdate but not much, and it also has a less pleasing syntax.

share|improve this question
What you are trying to do looks really hard to achieve because the isodate macros really aren't oriented towards being fully expandable. What exactly are your requirements? What features of the isodate package do you need? – Harald Hanche-Olsen Nov 4 '10 at 19:28
I'm looking for the ability to type a short ISO date, like 2010-11-01, and then be able to choose (and maybe later change) how that date will be formatted. I need to include this date in some kind of command (like \datesec) that will create a section, but maybe later will create a subsection or a subsubsection instead, etc. Make sense? – dsedivec Nov 4 '10 at 20:40

This compiles, but I had to turn it around


\newcommand{\datesec}[1]{\texorpdfstring{Date \printdate{#1}}{}}


share|improve this answer
Thanks for the answer. As I commented above (after you left this answer) I'd vastly prefer to put the \section in the command so that I can change its nesting within other sections later. – dsedivec Nov 4 '10 at 21:20

Your Answer


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.