2

I have a beamer theme in a .sty file, and I want to make a command \supervisor that works like \author.

In the .sty file, I added the following:

\newcommand{\supervisor}[1]{#1}

\newcommand{\insertsupervisor}{\supervisor}

But in the main file, when I declare \supervisor{Someone}, before \begin{document}, just like \author and \title etc, I get the error "Missing: begin document". The text then appears at the top of the titlepage, without the fontsize and colour that I assigned to supervisor.

How should I correctly declare this command such that it works like author for example? (I cannot find how \author is actually defined for beamer).

1
  • Welcome to TeX.SX! \author works in another way: it does something like \newcommand{\author}[1]{\def\@author{#1}} and then you could refer to the value by calling \@author. – TeXnician Sep 8 '18 at 10:17
1

The trick is to define a new command \insertsupervisor inside \supervisor

\documentclass{article}

\newcommand{\supervisor}[1]{\gdef\insertsupervisor{#1}}

\supervisor{Foo bar}

\begin{document}

    \insertsupervisor

\end{document}

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.