Farbprobleme mit der Dokumentklasse IEEEColor und Tikz

Farbprobleme mit der Dokumentklasse IEEEColor und Tikz

Ich habe ein sehr merkwürdiges Verhalten bei der ieeecolor.clsDokumentklasse festgestellt! Das Kompilieren eines Latex-Dokuments unter Verwendung dieser Klasse mit dem tikzPaket löst einige Farbwarnungen aus:, Warning Incompatible color definitionaber das generierte PDF scheint wie erwartet zu sein (siehe MWE unten).

Es passieren jedoch sehr merkwürdige Dinge, wenn der Tex-Datei der folgende Abschnitt hinzugefügt wird:

%%%% 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}

In diesem Fall ist das Verhalten von Latex ziemlich unerwartet und die Farben sind nicht mehr so, wie sie sollten. Dies scheint auf einen Konflikt zwischen der neuen ieeecolorKlasse und einigen Paketen wie zurückzuführen zu sein tikz.

Ist dieses Problem schon einmal bei jemandem aufgetreten? Hat jemand eine Lösung dafür gefunden?

Die ieeecolorKlasse finden Sie auf derIEEE Author Centre Website, es erfordert die Dateien ieeecolor.clsund „generic.sty“.


Minimales funktionierendes Beispiel mit kommentiertem Seiten- und Textfarbcode:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%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}

generic.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}

Antwort1

ieeecolor.styist ein bisschen nervig. Übrigens, weiß jemand, wen man kontaktieren kann, um Patches zu posten?

Hier gibt es zwei technische Probleme und eine philosophische Sache.

Die philosophische Frage ist: Ist es das wert? Wenn sie Ihr Papier annehmen, werden sie es mit etwas neu formatieren, das überhaupt nicht LaTeX ist, und sie wollen sowieso separate Abbildungen, die sich besser mit erstellen lassen standalone. Aber wenn Sie Ihre Datei für den internen Gebrauch oder die Übermittlung an ein Archiv verwenden möchten, dann ist es vielleicht das wert, sich darum zu kümmern.

Es gibt zwei technische Probleme:

  1. der erste ist ziemlich groß:Farbe wird auslaufen. Die verlinkte Antwort bietet eine nette Antwort darauf.
  2. Das Paket wird colornicht geladen xcolor(im Jahr 2021!), weshalb Sie alle Probleme mit Ti habenkZ, was erfordert xcolor.

Mögliche Lösungen.

  1. Patchieeecolor.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}}

Ich denke, dies sollte beide Probleme beheben.

  1. Wenn Sie die ursprüngliche Klasse nicht berühren möchten, versuchen wir einen Trick, ieeecolor indem wir xcolorvor der Klasse laden. Beheben Sie das andere Problemmit Phelype Oleinik fix: ändern Sie einfach Ihren Aufruf \documentclassmit (getestet mit dem ieeecolor.clsheute Morgen heruntergeladenen!):
\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}

Beide scheinen bei mir zu funktionieren, aber ich hatte keine Zeit, es gründlich zu prüfen.

verwandte Informationen