ieeecolor ドキュメント クラスと tikz の色の問題

ieeecolor ドキュメント クラスと tikz の色の問題

私はドキュメントクラスで非常に奇妙な動作に遭遇しましたieeecolor.cls!このクラスを使用してLaTeXドキュメントをコンパイルすると、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

この問題に遭遇した人はいますか? この問題の解決策を見つけた人はいますか?

ieeecolorIEEE 著者センターのウェブサイト、ファイル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}

ジェネリック.sty

\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ちょっと面倒です。ところで、パッチを投稿するには誰に連絡すればよいか知っている人はいませんか?

ここには 2 つの技術的な問題と 1 つの哲学的な問題があります。

哲学的なことは、気にする価値があるかどうかです。論文が受理されると、LaTeX ではない何かで再フォーマットされ、いずれにしても別々の図が求められますが、これは で作成した方がよいでしょうstandalone。しかし、ファイルを社内で使用したり、アーカイブに送信したりする場合は、はい、気にする価値があるかもしれません。

技術的な問題は 2 つあります。

  1. 最初のものはかなり大きいです:色が漏れるリンクされた回答は、それに対する良い答えを提供します。
  2. パッケージはロードされますcolorが、xcolor(2021年現在!)。そのため、Tiにはさまざまな問題があります。Z が必要です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クラスの前にフェリペ・オレイニクの修正: の呼び出しを変更するだけです\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}

どちらも私には効果があるようですが、詳しく調べる時間がありませんでした。

関連情報