TeX - LaTeX Asked on November 28, 2021
I have a footline where I want to output the authors name, but it is perfectly legitimate to not pass the authors name and hence the insertshortauthor
macro can be empty. The problem is we use |
in our template to separate the data fields, therefore I need to know if the field actually prints something.
To my understanding, the beamer@shortauthor
macro is only defined, after author
was called, at least I do not see it defined outside beamerbasetitle.sty
, where it reads:
defauthor{@dblargbeamer@author}
longdefbeamer@author[#1]#2{%
definsertauthor{definst{beamer@insttitle}defand{beamer@andtitle}#2}%
defbeamer@shortauthor{#1}%
ifbeamer@autopdfinfo%
defbeamer@andstripped{}%
beamer@stripands#2 andrelax
{letinst=@gobbleletthanks=@gobbledefand{, }hypersetup{pdfauthor={beamer@andstripped}}}
fi%
}
and hence I don’t get, why I can’t just check if beamer@shortauthor
was defined yet. At least my MWE whcih reads:
documentclass{beamer}
makeatletter
setbeamertemplate{footline}{ifdefinedbeamer@shortauthorinsertshortauthor~|~else No author givenfi Some more information}
makeatother
begin{document}
frame{No author given yet, footline should say so but does not}
author{Author}
frame{Author given now, footline is good}
end{document}
Doesn’t work as expected, the ifdefined
does not consider beamer@shortauthor
to ever be undefined. How can I check if there will be a short author or not to decide if I need to output the ~|~
?
Note that line 167 of beamerbasetitle.sty
contains author{}
, hence beamer@shortauthor
is always defined and initially empty, and one can/should test if meaningful author{...}
is used by ifxbeamer@shortauthor@empty
.
The following example outputs
documentclass{beamer}
makeatletter
setbeamertemplate{footline}{%
ifxbeamer@shortauthor@empty
No author given
else
leavevmodeinsertshortauthor~|~%
fi
Some more information%
}
makeatother
begin{document}
frame{No author given yet, footline should say so but does not}
author{Author}
frame{Author given now, footline is good}
end{document}
Answered by muzimuzhi Z on November 28, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP