ieeecolor 文件類別和 tikz 的顏色問題

ieeecolor 文件類別和 tikz 的顏色問題

我在文檔類別中遇到了一個非常奇怪的行為ieeecolor.cls!使用此類和tikz套件編譯乳膠文件會觸發一些顏色警告:Warning Incompatible color definition,但產生的 pdf 似乎符合預期(即參見下面的 MWE)。

然而,當以下部分加入 tex 檔案時,會發生非常奇怪的事情:

%%%% Inverse PDF page and text color
\definecolor{pagcol}{rgb}{0.1255,0.1255,0.1255}
\definecolor{txtcol}{rgb}{0.85,0.85,0.85}
\pagecolor{pagcol}
\color{txtcol}

在這種情況下,乳膠的行為相當出乎意料,而且顏色不再是應有的顏色。這似乎來自新ieeecolor類別和一些包(例如tikz.

以前有人遇到過這個問題嗎?有人找到解決這個問題的方法嗎?

該類別ieeecolor可以在IEEE 作者中心網站,它需要文件ieeecolor.cls和“generic.sty”。


帶有頁面和文字顏色程式碼註解的最小工作範例:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%2345678901234567890123456789012345678901234567890123456789012345678901234567890
%       1       2       3       4       5       6       7       8
%\documentclass[letterpaper,10pt,conference]{ieeeconf}  % Comment this line out
                                                        % if you need a4paper
%\documentclass[a4paper, 10pt, conference]{ieeeconf}    % Use this line for a4
                                                        % paper
\documentclass[journal,twoside,web]{ieeecolor}          % %% NEW ieeecolor class %%
% \IEEEoverridecommandlockouts                          % This command is only
                                                        % needed if you want to
                                                        % use the \thanks command
% \overrideIEEEmargins
% See the \addtolength command later in the file to balance the column lengths
% on the last page of the document

% The following packages can be found on http:\\www.ctan.org
\usepackage{generic}
\usepackage{lipsum}
\usepackage{tikz}
\usepackage{pagecolor}

%%%%% Inverse PDF page and text color
%\definecolor{pagcol}{rgb}{0.1255,0.1255,0.1255}
%\definecolor{txtcol}{rgb}{0.85,0.85,0.85}
%\pagecolor{pagcol}
%\color{txtcol}


\title{My Dummy Article}

\author{Julius~Caesar~\IEEEmembership{Fellow~Member,~IEEE}
\thanks{J.~Caesar is with the Senate House, Rome}
}

\begin{document}

\maketitle
\thispagestyle{empty}
\pagestyle{empty}

\begin{abstract}
\lipsum[1]
\end{abstract}

\begin{IEEEkeywords}
Key word 1, Key word 2.
\end{IEEEkeywords}

\section{Dummy Section 1}

\lipsum

\section{Dummy Section 2}

\lipsum

\begin{figure}[!htbp]
\centering
\begin{tikzpicture}
\draw (0,0) -- (4,0) -- (4,4) -- (0,4) -- (0,0);
\end{tikzpicture}
\caption{A Dummy Square figure}
\end{figure}

\lipsum

\end{document}

通用麥粒腫

\def\logoname{LOGO-generic-web}
\definecolor{subsectioncolor}{rgb}{0,0.541,0.855}
\setlength{\firstpagerule}{39pc}
\setlength{\logowidth}{4pc}
\def\journalname{Generic Colorized Journal}

答案1

ieeecolor.sty就是後背有點痛。順便說一句,有人知道可以聯繫誰來發布補丁嗎?

這裡有兩個技術問題,還有一個哲學問題。

哲學問題是:值得關心嗎?當他們接受你的論文時,他們會用根本不是 LaTeX 的東西重新格式化它,而且他們無論如何都想要單獨的圖形,最好用standalone.但是,如果您希望您的文件供內部使用或提交到某個存檔,那麼是的,也許值得關心。

技術問題有兩個:

  1. 第一個相當大:顏色會漏。連結的答案為此提供了一個很好的答案。
  2. 包加載color,而不是xcolor(2021 年!),這就是為什麼你遇到 Ti 的所有問題kZ,這需要xcolor.

可能的解決方案。

  1. 修補ieeecolor.cls
--- ieeecolor.cls.orig  2021-06-04 11:51:15.355826034 +0200
+++ ieeecolor.cls   2021-06-04 12:11:40.354385057 +0200
@@ -667,12 +667,13 @@
 %
 %
 %
-%
+
 \ProvidesClass{IEEEtran}[2002/11/18 revision V1.6b by Michael Shell]
 \typeout{-- See the "IEEEtran_HOWTO" manual for usage information.}
 \typeout{-- The source comments contain changelog notes.}
 \NeedsTeXFormat{LaTeX2e}
-\RequirePackage{color}
+% \RequirePackage{color}
+\RequirePackage[table]{xcolor}
 
 %%%%%%%%%%%
 \DeclareOldFontCommand{\sf}{\normalfont\sffamily}{\mathsf}
@@ -2255,16 +2256,16 @@
 \else
 \@IEEEfigurecaptionsepspace% V1.6 was a hard coded 5pt
 % 3/2001 use footnotesize, not small; use two nonbreaking spaces, not one
-\setbox\@tempboxa\hbox{\footnotesize #1.\color{black}\normalcolor~~\sf\boldmath #2}%
+\setbox\@tempboxa\hbox{{\footnotesize #1.\color{black}\normalcolor~~\sf\boldmath #2}}%
 \ifdim \wd\@tempboxa >\hsize%
 % if caption is longer than a line, let it wrap around
-\setbox\@tempboxa\hbox{\footnotesize #1.\color{black}\normalcolor~~ }%
+\setbox\@tempboxa\hbox{{\footnotesize #1.\color{black}\normalcolor~~ }}%
 \parbox[t]{\hsize}{\footnotesize \noindent\unhbox\@tempboxa\sf\boldmath #2}%
 % if caption is shorter than a line,
 % allow user to control short figure caption justification (left or center)
 \else%
-\ifcenterfigcaptions \hbox to\hsize{\footnotesize\hfil\box\@tempboxa\hfil}%
-\else \hbox to\hsize{\footnotesize\box\@tempboxa\hfil}%
+\ifcenterfigcaptions \hbox to\hsize{{\footnotesize\hfil\box\@tempboxa\hfil}}%
+\else \hbox to\hsize{{\footnotesize\box\@tempboxa\hfil}}%
 \fi\fi\fi\color{black}}

我認為這應該可以解決這兩個問題。

  1. 如果你不想觸及原來的類,讓我們嘗試在類之前ieeecolor 載入;xcolor解決其他問題與 Phelype Oleinik 修復:只需更改對 with 的呼叫\documentclass(使用今天早上下載的測試ieeecolor.cls!):
\RequirePackage{xcolor}
\documentclass[journal,twoside,web]{ieeecolor}          % %% NEW ieeecolor class %%
% \IEEEoverridecommandlockouts                          % This command is only
                                                        % needed if you want to
% Fix ieeecolor's \caption
\usepackage{etoolbox}
\makeatletter
\@ifundefined{color@begingroup}%
  {\let\color@begingroup\relax
   \let\color@endgroup\relax}{}%
\def\fix@ieeecolor@hbox#1{%
  \hbox{\color@begingroup#1\color@endgroup}}
\patchcmd\@makecaption{\hbox}{\fix@ieeecolor@hbox}{}{\FAILED}
\patchcmd\@makecaption{\hbox}{\fix@ieeecolor@hbox}{}{\FAILED}

兩者似乎都對我有用,但我沒有時間深入檢查。

相關內容