2

Using \insertauthor in \ifthenelse statement throws an error (no error if it is used elsewhere in the document). \inserttitle or \insertdate works fine. Why do I get an error when I use \insertauthor as below? You can see that I am trying to check if author information is provided.

\documentclass{beamer}
\usepackage{ifthen}

%\title{Title goes here}
\author{me}

\begin{document}

\ifthenelse{\equal{\insertauthor}{}}{empty}{not empty}

\end{document}

1 Answer 1

2

The \insertauthor macro does more than just inserting the author, so you run into a problem with exandability.

Instead you can check if \beamer@shortauthor or \beamer@andstripped is empty or not (the result will be different for the case \author[]{me}, not sure which behaviour you would like).

I also included a second approach which is used in beamer to test e.g. in footlines if certain information is available

\documentclass{beamer}
\usepackage{ifthen}

\author{me}

\makeatletter
\newcommand{\fooooo}{\ifthenelse{\equal{\beamer@shortauthor}{}}{empty}{not empty}}

\newcommand{\foo}{\expandafter\ifblank\expandafter{\beamer@shortauthor}{empty}{not empty}}
\makeatother

\begin{document}
\begin{frame}
\fooooo

\foo
\end{frame}
\end{document}

You must log in to answer this question.

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