1

I wanted to get beamer to show the date in a smaller font and mistakenly wrapped the \date{December 15, 2017} field with the \small tag. Surprisingly, instead of emitting an error or changing the font size, pdflatex produced ‘December 11, 2017’ as a result. Is there an explanation for such behaviour?

UPD: It was pointed out that \small is a switch and does not take argument. However, {\small \date{December 15, 2017}} produces December 12, 2017.

7
  • 1
    Welcome to this site. You should post a full Minimal Working Example (MWE). Dec 11, 2017 at 0:18
  • I am not sure what you did but perhaps you should try \date{\small{}December 15, 2017} instead of \date{December 15, 2017} as \small is a switch . Dec 11, 2017 at 0:20
  • \date{\small{XXX}} works as expected. \small{\date{XXX}} produces the weird result.
    – macleginn
    Dec 11, 2017 at 1:56
  • Henri's warning in his answer is correct. From your comment I am not sure whether you understand the difference of \small{foo} bar and {\small{}foo} bar. \small is a switch and does not take an argument. Dec 11, 2017 at 2:59
  • 1
    @CampanIgnis, thanks for the hint. {\small \date{December 15, 2017}} incredibly produces December 12, 2017.
    – macleginn
    Dec 12, 2017 at 1:25

2 Answers 2

3

\small has nothing to do with the problem.

The fact is that \date does not print the date, but rather sets an internal variable to the date given as argument. The working is essentially

\newcommand{\date}[1]{\renewcommand{\internaldate}{#1}}

(different names and more complex action, but this is the idea) and the code for \maketitle will use \internaldate.

When you do

\small{\date{July 38, 1973}}

or

{\small\date{July 38, 1973}}

the \date instruction is performed in a group, so the redefinition of \internaldate is forgotten as soon as the group ends and you eventually get today’s date, which is used by default. This explains why you got 11 when you posed the question and 12 when you revised it. In the first case the group is because \small takes no argument.

1
  • Thank you so much! I realised today that it has smth to do with extracting the current date, but did not grasp the whole picture.
    – macleginn
    Dec 13, 2017 at 10:28
5

Don't put \small in the \date{...}. This will have unforeseen side effects. Better change the way the date is printed using \setbeamerfont.

\documentclass{beamer}
\setbeamerfont{date}{size=\small}
\begin{document}

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

\end{document}
2
  • I think the point was to explain the strange behaviour, not how to change font size. Dec 11, 2017 at 0:49
  • 1
    @gigabytes “Strange input might yield strange output.” Is that enough explanation? Also I can't even reproduce the problem in the question, can you? Dec 11, 2017 at 0:50

You must log in to answer this question.

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