latex beamer xcolor:未定义颜色 Yellow3

latex beamer xcolor:未定义颜色 Yellow3

我继承了这个文件并且正在尝试让它工作。

当我尝试编译它时出现此错误:

! Package xcolor Error: Undefined color `Yellow3'.
See the xcolor package documentation for explanation.
l.88 \begin{document}

按下后,H我没有得到任何输出。我查了一下软件包选项(用于 xcolor)在 beamer 中未得到正确使用我尝试实施已接受的答案,但没有成功。以下是我的文档的相关部分:

\documentclass[xcolor=x11names,compress]{beamer}

%% General document %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\usepackage{graphicx}
\usepackage{tikz}
\usepackage{verbatim}
\usetikzlibrary{decorations.fractals}
\usepackage{amssymb}
\usepackage{listings}
\usepackage{dirtytalk}
%\usepackage{fontawesome}

\usetikzlibrary{arrows,shapes,backgrounds}
\tikzstyle{every picture}+=[remember picture]
\tikzstyle{na} = [baseline=-.5ex]


%% Beamer Layout %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\useoutertheme[subsection=false,shadow]{miniframes}
\useinnertheme{default}

%% Font Settings

\usepackage[english]{babel}
\usepackage{xcolor}
\renewcommand*\familydefault{\sfdefault}  %% Only if the base font of the document is to be sans serif
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{listings}
\usepackage{lipsum}

\setbeamerfont{title like}{shape=\scshape, series=\bfseries}
\setbeamerfont{frametitle}{shape=\scshape, series=\bfseries}

\lstdefinestyle{base}{
  language=python,
  emptylines=1,
  breaklines=true,
  showstringspaces=false
  basicstyle=\ttfamily\color{black},
  moredelim=**[is][\color{red}]{@}{@},
  moredelim=**[is][\color{brown}]{?}{?},
}
%% Color Settings

\setbeamercolor*{title}{bg=Yellow3} 
\setbeamercolor*{lower separation line head}{bg=Yellow3} 
\setbeamercolor*{normal text}{fg=black,bg=white} 
\setbeamercolor*{alerted text}{fg=red} 
\setbeamercolor*{example text}{fg=black} 
\setbeamercolor*{structure}{fg=black} 
 
\setbeamercolor*{palette tertiary}{fg=black,bg=black!10} 
\setbeamercolor*{palette quaternary}{fg=black,bg=black!10} 


%% Create a table

\renewcommand{\(}{\begin{columns}}
\renewcommand{\)}{\end{columns}}
\newcommand{\<}[1]{\begin{column}{#1}}
\renewcommand{\>}{\end{column}}


%% Item and enumerate style 

\setbeamertemplate{enumerate item}[square]
\setbeamercolor{item projected}{bg=Yellow3,fg=white}

\usepackage{marvosym}
\newcommand{\myitem}{\item[\color{Yellow3} \Neutral]}
%\setbeamercolor{itemize item}{fg=Yellow3}

\newcommand{\mybullet}{\item[\textbullet]}

\usepackage{pifont}
\newcommand{\mypen}{\item[\color{Yellow3} \ding{46}]}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}


%% FRAME 0 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%\setbeamercolor{background canvas}{bg=Yellow3!40!Khaki1}



\begin{frame}[plain] % to remove the navigation bar



\title{Title}
%\subtitle{}
\ \\[10pt]
\author{Name}
\date{\scriptsize \vspace{-0.5cm}\today}

\titlepage


\(\<{0.5\textwidth}
\scriptsize Left \\[5pt]  
\>
\<{0.3\textwidth}
\scriptsize Right\\[5pt]  
\>\)



\end{frame}
\end{document}


编辑1

根据接受的答案(参见上面的链接),我\RequirePackage[dvipsnames]{xcolor}之前尝试添加此行\documentclass[xcolor=x11names,compress]{beamer},但得到了完全相同的错误


编辑2

当我运行时latex --version我得到以下输出:

❯ latex --version
pdfTeX 3.141592653-2.6-1.40.22 (TeX Live 2022/dev/Debian)
kpathsea version 6.3.4/dev
Copyright 2021 Han The Thanh (pdfTeX) et al.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the pdfTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the pdfTeX source.
Primary author of pdfTeX: Han The Thanh (pdfTeX) et al.
Compiled with libpng 1.6.37; using libpng 1.6.37
Compiled with zlib 1.2.11; using zlib 1.2.11
Compiled with xpdf version 4.03

答案1

好的,根据接受的这个问题的答案:软件包选项(用于 xcolor)在 beamer 中未得到正确使用并且对于@Marijin 的评论,我可以使用\PassOptionsToPackage{x11names}{xcolor}之前这一行来运行该示例\documentclass

但是链接中接受的答案提供了两个选项。另一个,即添加\RequirePackage[dvipsnames]{xcolor}之前,对我来说\documentclass[xcolor=x11names,compress]{beamer}确实会产生相同的错误 ! Package xcolor Error: Undefined colorYellow3'`,因此它对我的情况不起作用。

相关内容