TeX - LaTeX Asked by KlemenD on April 19, 2021
I am using beamer
with metropolis
theme.
According to manual (page 6) metropolis
offers option for background, namely dark
and light
, which can be set anytime, i.e. even mid-presentation, with the metroset
macro.
As expected, setting metroset{background=dark}
in preamble results in dark background and light normal text
.
However, using metroset{background=dark}
in mid-document does not work as expected. The metroset{background=dark}
indeed sets the background of next slide to dark, but does not change the color of the normal text
from dark
to light
. Hence, the text on dark background is invisible.
documentclass{beamer}
usetheme[progressbar=frametitle,block=fill]{metropolis}
begin{document}
begin{frame}{Light Theme}
Hello, world!
end{frame}
metroset{background=dark} % change background theme according to manual
begin{frame}{Dark Theme}
Hello, world! % invisible
end{frame}
end{document}
The theme doesn't take sufficient account of the way Beamer's colours work. In particular, when you change the colour, the code uses setbeamercolor
but not usebeamercolor
, which is necessary for the change to take effect.
For example, the following works.
documentclass{beamer}
usetheme[progressbar=frametitle,block=fill]{metropolis}
begin{document}
begin{frame}{Light Theme}
Hello, world!
end{frame}
metroset{background=dark} % change background theme according to manual
usebeamercolor[fg]{normal text}
begin{frame}{Dark Theme}
Hello, world! % invisible
end{frame}
end{document}
Should you run into any weird spacing issues when using this theme, consider the possibility that it is introducing spurious spaces as the code suggests it may be quite keen to do so.
For things to work as expected, you could redefine the commands as follows.
documentclass{beamer}
usetheme[progressbar=frametitle,block=fill]{metropolis}
makeatletter
renewcommand{metropolis@colors@dark}{%
setbeamercolor{normal text}{%
fg=black!2,
bg=mDarkTeal
}%
usebeamercolor[fg]{normal text}%
}
renewcommand{metropolis@colors@light}{%
setbeamercolor{normal text}{%
fg=mDarkTeal,
bg=black!2
}%
usebeamercolor[fg]{normal text}%
}
makeatother
begin{document}
begin{frame}{Light Theme}
Hello, world!
end{frame}
metroset{background=dark} % change background theme according to manual
begin{frame}{Dark Theme}
Hello, world! % invisible
end{frame}
metroset{background=light} % change background theme according to manual
begin{frame}{Light Again}
Hello, world! % invisible
end{frame}
end{document}
Correct answer by cfr on April 19, 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