Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unintuitive behaviour of \usebeamerfont #476

Open
ghost opened this issue May 1, 2018 · 12 comments
Open

Unintuitive behaviour of \usebeamerfont #476

ghost opened this issue May 1, 2018 · 12 comments
Assignees
Labels
question Further information is requested

Comments

@ghost
Copy link

ghost commented May 1, 2018

The following example document gives a tiny 3rd line while I would expect a Huge one. Why? If this is not a bug: Is there any way to prevent/change this behavior? I would like to apply the "caption name" font settings only, w/o applying the "caption" font settings as well.

\documentclass{beamer}
\setbeamerfont{caption}{size=\tiny}

\begin{document}
\begin{frame}
\par
{\tiny Some tiny text}\par
{\Huge Some Huge text}\par
{\Huge\usebeamerfont{caption name}Some Huge text!?}\par
\end{frame}
\end{document}
@josephwright josephwright self-assigned this May 1, 2018
@josephwright josephwright added the bug Something isn't working label May 1, 2018
@josephwright
Copy link
Owner

This is by-design: caption name inherits from caption:

\setbeamerfont{caption}{size=\small}
\setbeamerfont{caption name}{parent={structure,caption}}

(base/themes/font/beamerfontthemedefault.sty).

@ghost
Copy link
Author

ghost commented May 1, 2018

Ok, and is there a clean/documented way to apply the "caption name" settings without applying the "caption" (and "structure") settings, i.e. disabling the "parent=" feature?

Currently I take over the "caption" and "caption name" settings to my caption package when \usepackage{caption} is used with beamer. Unfortunately there is a bug in my implementation I would like to fix. (If there is no proper way to do so I would be forced to remove that feature from my caption package.) See also: https://github.com/axelsommerfeldt/caption/issues/4

@ghost
Copy link

ghost commented May 1, 2018

@ghost
Copy link
Author

ghost commented May 1, 2018

@samcarter8 Your solution is sub-optimal since this would drop user settings of \setbeamerfont{caption name}{parent=...} as well. But since this is better than the old behavior (and better than dropping this feature altogether) I could live with it.

However, IMHO a solution which drops "parent=caption" only would be ideal.

And one follow-up question to #476 (comment):

Why is it pre-defined as

\setbeamerfont{caption}{size=\small}
\setbeamerfont{caption name}{parent={structure,caption}}

and not as

\setbeamerfont{caption}{parent=structure,size=\small}
\setbeamerfont{caption name}{parent=caption}

?

@ghost
Copy link

ghost commented May 1, 2018

This questions can probably only be answered by the author, but I imagine the reason is

  • be symmetric to the colour definition. Only the label and not the caption text inherits the blue colour
  • structure in beamer is traditionally something to structure things, a bit like a headline (since sections etc are not allowed within the frame). If someone decided to make these structural elements more prominent, e.g. by using bold or bigger font, the caption label should also be bold/bigger, but not the caption text. Similar for itemize/enumeration/description where the label inherits from structure, but not the body text.

@ghost
Copy link

ghost commented May 1, 2018

And yes, setting the caption name font to empty is really suboptimal.

@ghost
Copy link
Author

ghost commented May 1, 2018

Thanks for your explanation, this makes sense to me now. But it leaves me with a dilemma:

If I use \setbeamerfont{caption name}{parent=structure}\usebeamerfont{caption name} within my caption package, I would overwrite a potential \setbeamerfont{caption name}{parent=caption} set by the user who would like to drop the structure settings for the caption labels.

So it seems I need some kind of \clearbeamerfont{caption} (which clears all "caption" settings) instead so parent=caption does not make any harm to the/additional caption package options.

BTW: I have found:

\setbeamercolor{caption}{}
\setbeamercolor{caption name}{parent=structure}

But I would had expected:

\setbeamercolor{caption}{}
\setbeamercolor{caption name}{parent={structure,caption}}

This does not seem to be consistent to me.

@ghost
Copy link

ghost commented May 1, 2018

First the easy answer: \setbeamercolor{caption name}{parent={structure,caption}} is the same as \setbeamercolor{caption name}{parent={structure}}, because caption colour is empty by default. My guess: it should really be \setbeamercolor{caption name}{parent={caption,structure}} but up to know It made big difference.

@ghost
Copy link
Author

ghost commented May 1, 2018

I just found \clearbeamerfont, it's spelled \setbeamerfont*.

So the only question left is why the "caption" and "caption name" color is pre-defined inconsistently with the "caption" and "caption name" font.

@ghost
Copy link

ghost commented May 1, 2018

Concerning the font dilemma: I have to admit I don't fully understand what the caption/subcaption packages are doing, but would it be possible to simply format the subcaption in the same way as the caption? If I understand the caption package correctly, it actually used the beamer template for captions, thus using the caption name and caption font for the label and the text respectively. Can't the subsection package do the same?

Or would help to define separate beamer templates for the subcaption and two new font templates?

@ghost
Copy link

ghost commented May 1, 2018

Besides the fact that the caption colour is not set per default, \setbeamercolor{caption name}{parent={caption,structure}} would in reality basically always be the same as \setbeamercolor{caption name}{parent={structure}} because structure is such a key colour to every beamer presentation that I have yet to see one where the colour is not set, thus it would always overwrite the caption colour.

@ghost
Copy link
Author

ghost commented May 1, 2018

The same LaTeX code is used for typesetting the captions and sub-captions. The problem is that the sub-caption package was adding font+=small (and is now adding font+=smaller instead) to typeset the sub-captions smaller than the main captions by default. So the sub-caption was typeset with beamer settings plus \small. And the label was typeset with beamer settings as well, but because of parent=caption the \small was overwritten for the caption label by \setbeamerfont{caption}{size=\tiny}, so the sub-caption label and the sub-caption text were typeset with different font sizes (label=tiny but text=small).

But maybe we should discuss this at https://github.com/axelsommerfeldt/caption/issues/4

@louisstuart96 louisstuart96 added question Further information is requested and removed bug Something isn't working labels Sep 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants