4

It appears that different classes set up author layouts using tables. I would like to render one of these outputs:

Equivalent to \begin{tabular}{rl}:

  Joe Schmoe My Boss
    Jane Doe His Boss

or, equivalent to \raggedleft:

  Joe Schmoe My Boss
   Jane Doe His Boss

from something resembling this M(N)WE:

\documentclass{beamer}

\author{%
Joe Schmoe, My Boss%
\and
Jane Doe, His Boss%
}

\begin{document}
\maketitle
\end{document}

I don't mind using \institute or something equivalent for job title, and I can even drop the job title to see a simple solution.

In some other document classes there is a nice solution involving \preauthor, which I could modify in my style file. Unfortunately, I get an unknown command error in Beamer 3 on \preauthor with that code. Are there equivalent constructs in Beamer?

There is also another approach that uses a tabular environment but that also fails in Beamer.

Ideally, I would like to change \defbeamertemplate*{title page}{default theme}{... in my beamer style file, so that I could still use \author{} with all its trimmings in the main file, but since I do not use authors anywhere else on the slide, a solution using some kind of box in the main source would work as well.

1

One option redefining the internal \beamer@author defined in beamerbasetitle.sty (in this way, the definition will be theme-independent) to use a tabular with the desired alignment; you need to use the optional argument to provide a proper information for the author bookmark:

\documentclass{beamer}
\usetheme{Madrid}

\makeatletter
\long\def\beamer@author[#1]#2{%
  \def\insertauthor{\def\inst{\beamer@insttitle}\def\and{\beamer@andtitle}%
  \begin{tabular}{rl}#2\end{tabular}}%
  \def\beamer@shortauthor{#1}%
  \ifbeamer@autopdfinfo%
    \def\beamer@andstripped{}%
    \beamer@stripands#1 \and\relax
    {\let\inst=\@gobble\let\thanks=\@gobble\def\and{, }\hypersetup{pdfauthor={\beamer@andstripped}}}
  \fi%
}
\makeatother

\title{The title}
\author[Joe and Jane]{%
Joe Schmoe, & My Boss \\
Jane Doe, & His Boss
}

\begin{document}
\begin{frame}
\maketitle
\end{frame}
\end{document}

enter image description here

Change \begin{tabular}{rl} to \begin{tabular}{r} above for the other alignment required.

In a comment it has been requested to redefine \and so that it acts as \tabularnewline to separate author rows in the mandatory argument of \author; here's the required modification:

\documentclass{beamer}
\usetheme{Madrid}

\makeatletter
\long\def\beamer@author[#1]#2{%
  \def\and{\tabularnewline}
  \def\insertauthor{\def\inst{\beamer@insttitle}\def\and{\tabularnewline}%
  \begin{tabular}{rl}#2\end{tabular}}%
  \def\beamer@shortauthor{#1}%
  \ifbeamer@autopdfinfo%
    \def\beamer@andstripped{}%
    \beamer@stripands#1 \and\relax
    {\let\inst=\@gobble\let\thanks=\@gobble\def\and{, }\hypersetup{pdfauthor={\beamer@andstripped}}}
  \fi%
}
\makeatother

\title{The title}
\author[Joe \and Jane]{%
Joe Schmoe, & My Boss \and
Jane Doe, & His Boss
}

\begin{document}
\begin{frame}
\maketitle
\end{frame}
\end{document}

enter image description here

  • Thanks! Is it possible to use \and instead of \\ to separate authors, so that, when the template changes, the \author field doesn't need to change? I see that there are references to \and in your MWE \def. I tried redefining \and, so that it could retain its usual role in separating authors, but my changes (using \renewcommand) were ignored. – Leo Mar 20 '14 at 12:27
  • @Leo yes, it's possible. Please see my updated answer. – Gonzalo Medina Mar 20 '14 at 15:28
  • Thank you. Not only did that work great, but more importantly I can understand it and modify it too. – Leo Mar 21 '14 at 13:05

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.