1

I tried to implement a metalevel for the author and title commands, because most style files want them to be a little bit different and I want to be able to easily change the style file.

Long story short I observed that the amsart class behaves strangely, when I insert a macro into \title{}. It does not throw an error, but does not capitalize the title. However it will be still typeset in boldface.

So there is neither no effect nor all effects. I also tried to place \expandafter at all places that I could think of, but apparently I don't really understand this command.

\documentclass[a4paper,reqno]{amsart}

\usepackage[utf8]{inputenc}

\begin{document}

\newtoks\mytitleA
\mytitleA={This is a title}

\newcommand{\mytitle}{This is a title}
\newcommand{\myauthor}{This is me}

% toggle the following commands to see that only the last version
% produceses the correct layout
%\title{\the\mytitleA}
%\title{\mytitle}
\title{This is a title}

% for the author I cannot spot a difference
\author{\myauthor}
\author{This is me}

\maketitle

\end{document}

Other style files like article don't seem to typeset the title differently, if it is nested in a macro, at least I couldn't tell the difference. Hence, maybe there is something wrong with the amsart implementation of \title{} or \maketitle.

Is there a way of fixing this or at least make a nested macro work?

1
  • why are you using a toks register for the title? Ah sorry you tried both. Commented Feb 7 at 10:15

1 Answer 1

1

You forgot one that does work, namely

\expandafter\title\expandafter{\the\mytitleA}

Of course nothing avoiding \the in front of \mytitleA can work, because \the is necessary in order to deliver the contents of the \toks register.

What's the problem? By default amsart just uses \uppercase (it shouldn't, but that's another issue).

You can avoid the issue by loading textcase that coerces amsart into using \MakeTextUppercase so full (protected) expansion is made before \uppercase does its job.

With a \toks register

\documentclass[a4paper,reqno]{amsart}
\usepackage{textcase}

\newtoks\mytitleA
\mytitleA={This is a title}
\newcommand{\myauthor}{This is me}

\begin{document}

\title{\the\mytitleA}
\author{\myauthor}

\maketitle

\end{document}

With a command

\documentclass[a4paper,reqno]{amsart}
\usepackage{textcase}

\newcommand{\mytitle}{This is a title}
\newcommand{\myauthor}{This is me}

\begin{document}

\title{\mytitle}
\author{\myauthor}

\maketitle

\end{document}

Output (the same with both examples)

enter image description here

3
  • Thank you, this solves my question. However, I just realized that, if I want to use the optional parameter of \title[short title]{long title}, then I don't see how I can generalize this solution. Commented Feb 7 at 11:37
  • @NathanaelSkrepek Neither do I, without knowing what your aim is. Why not simply using the standard syntax?
    – egreg
    Commented Feb 7 at 13:09
  • I don't see where to put \expandafter in \title[\myshorttitle]{\myshorttitle} in order to have everything typset "normally". As I explained in the beginning of my post, I want to implement a metalevel to easily switch between style files. However, I think the solution with \usepackage{textcase} will do it. Commented Feb 7 at 13:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .