# Problem with markboth

I'm using isodate package since

1. A user should insert the date as the title of the chapter in the format as in the example : 31/12/1987
2. The chapter should have the title 31st Dec 1987,

following some post here I arrived at:

\documentclass{book}
\usepackage[orig,british]{isodate}
\usepackage{blindtext}
\makeatletter
\def\short@month@english{\ifcase\month\or
Jan\or Feb\or Mar\or Apr\or May\or Jun\or
Jul\or Aug\or Sep\or Oct\or Nov\or Dec\fi}
\newcommand{\printshortdate}[1]{{%
\let\month@english\short@month@english% Update English month lookup (locally)
\newcommand{\printsupdate}[1]{{
\let\day@english\supday@english
\printdate{#1}
}}
\makeatother
\newcommand{\chaplab}[1]{\label{chap:#1}}
\begin{document}
\chapter{\printshortdate{31/12/1987}}
\blindtext
\blindtext
\blindtext
\blindtext
\blindtext
\blindtext
\end{document}


However there is something wrong with \markboth since, if I remove \blindtext command and so the document is just one page, all is ok, while adding text, I get errors and the chapter name in the header is a mess. I would like to have as the header exactly 31st Dec 1987

I'm using isodate since in the same document I need the same date but in other format and, as a user I want to insert it only once.

Your command has to be robust in order to go to mobile arguments.

The trick is replacing newcommand with DeclareRobustCommand

Here is the code:

\documentclass{book}
\usepackage[orig,british]{isodate}
\usepackage{lipsum}
\makeatletter
\def\short@month@english{\ifcase\month\or
Jan\or Feb\or Mar\or Apr\or May\or Jun\or
Jul\or Aug\or Sep\or Oct\or Nov\or Dec\fi}

\DeclareRobustCommand{\printshortdate}[1]{%
\let\month@english\short@month@english% Update English month lookup (locally)
\printdate{#1}%

\makeatother

\begin{document}
\chapter{\printshortdate{31/12/1987}}
\lipsum[4-12]
\end{document}


With output (on page 2):

Please mind the fact that I deleted some extra {s (in the newcommand definition)

If you need it only for one chapter use

\chapter*{\printshortdate{31/12/1987}}


if it shouldn't appear in the TOC, or

\chapter{\protect\printshortdate{31/12/1987}}


which is, of course, the same the solution of the other answer.