[Tex/LaTex] Error: Missing \endcsname inserted. \tex_let:D \begin{}

templates

I'm using texmaker 4.5. I'm trying to compile the following text on Windows 10:

\documentclass[english]{MastersDoctoralThesis} 
\begin{document}
\frontmatter 
\begin{titlepage}

    The Title.

\end{titlepage}
\begin{declaration}

    The Declaration.

\end{declaration}
\end{document} 

But when I compile it, the following error appears:

''! Missing \endcsname inserted.
<to be read again>
\tex_let:D
\begin{document}''

How can I solve it?


The template can be found at: http://www.latextemplates.com/template/masters-doctoral-thesis

Best Answer

Update: 2017/03/09 With the new update of xparse and expl3 packages from 2017/03/07 it is possible to use commands defined with \DeclareDocumentCommand in \csname ...\endcsname constructs ago, which is the case in the background code of `\pagestyle, for example.

The \blank@p@gestyle macro is defined in MDT with \DeclareDocumentCommand which isn't expandable, but \pagestyle needs an expandable name, so this fails.

With this bypassing code

\makeatletter
\AtBeginDocument{
  \renewcommand{\blank@p@gestyle}{empty}
}
\makeatother

the macro is exandable again.

A future release of xparse will remove the necessity of this bypass.

This tiny document shows the same error (and is the short version of what happens)

\documentclass{article}

\usepackage{xparse}

\DeclareDocumentCommand{\foo}{}{empty}

\begin{document}
\pagestyle{\foo}

\end{document}
Related Question