6

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.

8
  • 2
    show the log-file of the failing example 4 Apr 24, 2022 at 17:15
  • 6
    This was a bug in beamer v3.65 which was fixed in beamer v3.66; see the changelog here; "fixed regression of class options not being passed to packages like xcolor (see #759)". Your log file shows you're still using 3.65. I'm using 3.66 and don't get that error. Not sure how easy it is to upgrade using the Debian packages, but try.
    – frabjous
    Apr 24, 2022 at 17:39
  • 2
    See also the original bug report which gives a workaround, in case you can't easily upgrade.
    – frabjous
    Apr 24, 2022 at 17:42
  • 1
    More generally, the \PassOptionsToPackage{...} macro must be used before \documentclass{...}. Apr 24, 2022 at 23:47
  • 2
    @ Masroor please remove the solution from the question and copy it to the answer box and then (after 24 hours when it is allowed by the system) accept your own answer. This will properly mark the question as answered in the various lists, it will improve search results snippets and prevent the question from being deleted automatically.
    – Marijn
    Apr 25, 2022 at 10:48

1 Answer 1

6

This is due to a bug in beamer v3.65 which was fixed in beamer v3.66. Those who are forced to use this version (upgrades may be difficult when you install the complete system), you can use the following workaround.

Load xcolor or use the macro \PassOptionsToPackage{...} before \documentclass{...}.

Use either of the following before \documentclass{...} in your file,

\RequirePackage[dvipsnames]{xcolor}

\PassOptionsToPackage{dvipsnames}{xcolor}

The second one is more modular.

4
  • What exactly do you mean by upgrades may be difficult when you install the complete system?
    – daleif
    Apr 26, 2022 at 13:26
  • @daleif, The texlive systems come pre-packaged in Ubuntu. Unless one knows what one is doing, it may be difficult to install the new packages and point to the correct path.
    – Masroor
    Apr 26, 2022 at 14:04
  • 2
    That is formulated incorrectly. If you installed texlive via your Linux dist and have noticed that the provided beamer version is buggy. Then it the Linux package is already installed and will be automatically updated once the Linux dist opdates the Linux package that contains beamer. Problem here is that the Linux dists seldomly (if ever) update their texlive Linux packages. Even if they know there are bugs in them that has been fixed.
    – daleif
    Apr 26, 2022 at 14:21
  • 1
    @daleif, Rightly put.
    – Masroor
    Apr 26, 2022 at 14:26

You must log in to answer this question.

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