嘗試使用 pdflatex 編譯 TeX 文件時出現此錯誤:
包 xcolor 錯誤:未定義顏色“lightblue2”
這是我的文件:
\documentclass{article}
\usepackage[x11names, rgb]{xcolor}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{snakes,arrows,shapes}
\usepackage{amsmath}
%
%
%
%
\begin{document}
\pagestyle{empty}
%
%
%
\enlargethispage{100cm}
% Start of code
\begin{tikzpicture}[>=latex',line join=bevel,]
%%
\node (Wollongong) at (487bp,594bp) [draw=lightblue2,fill=lightblue2,ellipse] {Wollongong};
\node (PDP-11 Sys V) at (884bp,306bp) [draw=lightblue2,fill=lightblue2,ellipse] {PDP-11 Sys V};
\node (Interdata) at (258bp,594bp) [draw=lightblue2,fill=lightblue2,ellipse] {Interdata};
\node (2*8 BSD) at (221bp,162bp) [draw=lightblue2,fill=lightblue2,ellipse] {2.8 BSD};
% CODE REMOVED TO SAVE SPACE
%
\end{tikzpicture}
% End of code
%
\end{document}
%
答案1
你正在尋找顏色LightBlue2
,而不是lightblue2
。
在內部,所有顏色都表示為宏,並且宏區分大小寫。也就是說,\latex
不同於\Latex
and\LaTeX
和\LATEX
and...實際上顏色X
儲存在巨集中\\color@X
:
\documentclass{article}
\usepackage[x11names]{xcolor}
\begin{document}
\textcolor{LightBlue2}{something}
\makeatletter
\ttfamily\verb|\\color@LightBlue2|:
\expandafter\expandafter\expandafter\strip@prefix\expandafter\meaning\csname \string\color@LightBlue2\endcsname
\end{document}
答案2
xcolor
有關正確的顏色名稱 (x11names),請參閱文件第 39 頁。您將透過運行獲得文檔texdoc xcolor