3

So I was finally able to create a MWE for this one:

I am creating my own beamer style which has some areas, where all text is supposed to be all caps. Using \MakeUppercase with the beamer class' macros \insertFOO is problematic for all FOOs, because of the order in which things are expanded ... so they say. There are several questions on this topic and the solutions all include constructs of the form

\expandafter\MakeUppercase\expandafter{all caps stuff}

This works a little bit for me.

\expandafter\MakeUppercase\expandafter{\insertdate \inserttitle}

works exactly how I want it, but

\expandafter\MakeUppercase\expandafter{\insertdate \inserttitle \insertauthor}

does not. A fairly minimal non working example is this:

\documentclass{beamer}

\defbeamertemplate*{title page}{myway}[1][]{%
        \expandafter\MakeUppercase\expandafter{%the expandafterblock
           \insertdate
           \inserttitle
           \insertauthor
        }
}

\title{Some Title}
\author{My Name}
\date{\today}

\begin{document}
\begin{frame}[plain]\titlepage\end{frame}
\end{document}

This code will fail with

\insertauthor ->\def \inst
                       {\beamer@insttitle }\def \and {\beamer@andtitle }...

It fails because \insertauthor is inside the expandafterblock. By removing \insertauthor or placing it outside the the expandafterblock, this code will compile.

It would seem \insertauthor behaves uniquely, compared to other beamer \insert macros. If I had to guess, I'd pinpoint the problem to the fact, that you can attribute authors to institutions (if present), by prefixing author names with \inst[<number>]. So the question is:

How can I wrap \insertauthor on the title page, such that the author's/s' name(s) are capitalized?

P.S.: All questions I was able to find on this problem were about titles only, or not specific to the beamer class. Since beamer's \insertauthor seems to be a special case, I am fairly certain this is not a duplicate.


Update/Ending

While I haven't been able to actually solve the problem, I found an aceptable way to work around it by replacing the \expandafter\MakeUppercase\expandafter construct with this:

\fontspec{Our Sans Serif Font}[Letters=UppercaseSmallCaps,Scale=1.1]\scshape

Not ideal, but acceptable. A true solution would follow along Ulrike's advice to create a font which also has/uses capital letters for small letters. While fontspec is quite powerful, it does not enable me to simply make *TeX use the uppercase letters for any input letter. IMO a good solution would teach this trick to fontspec.

5
  • It looks like insertauthor relies on the other commands prefixed insert, to already be defined before the group is opened. This isn't the case now, since it waits for those checks after the main group has finished (I'm guessing at the level of frame). I'd consider a workaround at a lower level.
    – 1010011010
    Jun 30, 2015 at 7:59
  • You don't need the \expandafter. \MakeUppercase{\insertdate\inserttitle} works too. But you can't put arbitrary commands in \MakeUppercase. \insertauthor contains \def; it won't work. To capitalized arbitrary input you would need a suitable font. Why don't you use \scshape in the title? Jun 30, 2015 at 8:09
  • If the authors name should always be capitalized, you could use something like \let\oldauthor\author and \renewcommand{\author}[1]{\oldauthor{\MakeUppercase{#1}}} as a work around.
    – crixstox
    Jun 30, 2015 at 9:18
  • @UlrikeFischer: I could only use \scshape if all capital letters are made lowercase first. I want to establish LaTeX as allowed tool. I get this only if I strictly adhere to the CI.
    – Bananguin
    Jun 30, 2015 at 9:39
  • Well with the original \insertauthor it won't work. You will have either to redefine it, or create an "All capital" font, or find some other way to capitalize the names. Jun 30, 2015 at 9:46

1 Answer 1

3

If you just use \insertdate and \inserttitle, you don't need \expandafter, because \MakeUppercase does full (protected) expansion on its argument.

However, \inserttitle is quite different from the other two macros. Indeed, \insertdate expands to \today (in general to the argument given to \date) and, similarly, \inserttitle expands to the argument given to \title.

On the other hand, the expansion of \insertauthor is

\def\inst{\beamer@insttitle}\def\and{\beamer@andtitle}My Name

which is something \MakeUppercase will choke on.

We can patch the \author command or, rather, the internal command that's called, so it defines \insertauthor in a safer way. Note however that your template will definitely break if there is more than one author.

\documentclass{beamer}
\usepackage{etoolbox}

\makeatletter
\newrobustcmd{\titlepreliminaries}{%
  \def\inst{\beamer@insttitle}%
  \def\and{\beamer@andtitle}%
}
\patchcmd{\beamer@author}
  {\def\inst{\beamer@insttitle}\def\and{\beamer@andtitle}}
  {\titlepreliminaries}
  {}{}
\makeatother

\defbeamertemplate*{title page}{myway}[1][]{%
   \MakeUppercase{\insertdate}\\
   \MakeUppercase{\inserttitle}\\
   \MakeUppercase{\insertauthor}
}

\title{Some Title}
\author{My Name}
\date{\today}

\begin{document}
\begin{frame}[plain]\titlepage\end{frame}
\end{document}

enter image description here

A different patch, proposed by Gonzalo Medina, is

\makeatletter
\patchcmd{\beamer@author}
  {\def\and{\beamer@andtitle}#2}
  {\def\and{\beamer@andtitle}\MakeUppercase{#2}}
  {}{}
\makeatother
\defbeamertemplate*{title page}{myway}[1][]{%
  \MakeUppercase{\insertdate}\\
  \MakeUppercase{\inserttitle}\\
  \insert‌​author
}

This allows multiple authors, but has the downside that author names will be typeset in uppercase also in the other places they appear.

3
  • 1
    Using (sorry about poor formatting here in comments) something like \makeatletter \xpatchcmd{\beamer@author} {\def\and{\beamer@andtitle}#2} {\def\and{\beamer@andtitle}\MakeUppercase{#2}} {} {} \makeatother \defbeamertemplate*{title page}{myway}[1][]{\MakeUppercase{\insertdate}\\\MakeUppercase{\inserttitle}\\\insertauthor} you can have multiple authors. Jun 30, 2015 at 16:34
  • @GonzaloMedina This might have unwanted consequences in other places where \beamer@author is used, but I'll add it, thanks.
    – egreg
    Jun 30, 2015 at 16:40
  • 1
    If beamerprosper is not loaded (which is almos ever the case), then it's completely safe, since the only place in which \beamer@author is used is where it is being redefined. Jun 30, 2015 at 16:52

You must log in to answer this question.

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