1

I'm merging 5-10 pandoc generated tex files using the docmute package. The individual files build, however when I \subimport or \input them into my main document I get an error:

! LaTeX Error: No \title given

This is because everything outside the \begin{document}...\end{document} is stripped by docmute, so \title{} is not called for the individual documents when merging. Actually, I don't want to call \maketitle at all for the merged documents.

How can I conditionally use maketitle? I've tried various \if combinations, including things like:

\ifdef{\@title}{\maketitle}{}
2

The initial state of \@title is not that it is undefined, it is defined by

\def\@title{\@latex@error{No \noexpand\title given}\@ehc}

so you want

\makeatletter
\def\zz@title{\@latex@error{No \noexpand\title given}\@ehc}

\ifx\zz@title\@title
% do nothing
\else
\maketitle
\fi

\makeatother

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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