After a recent upgrade of my system (to Ubuntu 22.04), many of my previous files are failing to compile with undefined colors.
Please see the following self-contained examples for clarification.
The following works fine.
% 1
% Base colors (always available)
\documentclass{article}
\usepackage{xcolor}
\begin{document}
\LaTeX
{\color{blue}\LaTeX}
\end{document}
Conclusion: The xcolor
package is working fine for the base colors.
The following works fine as well.
% 2
% Colors via dvipsnames option
\documentclass{article}
\usepackage[dvipsnames]{xcolor}
\begin{document}
\LaTeX
{\color{Blue}\LaTeX}
\end{document}
Conclusion: The xcolor
package is working fine for the colors via option.
The following is also good.
% 3
% Base colors (always available)
\documentclass{beamer}
\begin{document}
\begin{frame}
\LaTeX
{\color{blue}\LaTeX}
\end{frame}
\end{document}
Conclusion: beamer
properly handles the base colors in the
xcolor
package.
This is where the problem starts.
% 4
% Colors via dvipsnames option
\documentclass[xcolor=dvipsnames]{beamer}
\begin{document}
\begin{frame}
\LaTeX
{\color{Blue}\LaTeX}
\end{frame}
\end{document}
We get the following error message.
! Package xcolor Error: Undefined color `Blue'.
Conclusion: beamer
fails to handle the colors via option in
xcolor
package.
The following is likely to generate an option clash, naturally.
% 5
% Colors via dvipsnames option
\documentclass{beamer}
\usepackage[dvipsnames]{xcolor}
\begin{document}
\begin{frame}
\LaTeX
{\color{Blue}\LaTeX}
\end{frame}
\end{document}
We get the following error message.
! LaTeX Error: Option clash for package xcolor.
Even the following does not work when we pass the option explicitly.
% 6
% Colors via dvipsnames option
\documentclass{beamer}
\PassOptionsToPackage{dvipsnames}{xcolor}
\begin{document}
\begin{frame}
\LaTeX
{\color{Blue}\LaTeX}
\end{frame}
\end{document}
We get the following error message.
! Package xcolor Error: Undefined color `Blue'.
Final Conclusion: Something is wrong with beamer
making it to fail to
handle the xcolor
package options.
\PassOptionsToPackage{...}
macro must be used before\documentclass{...}
.