
¡Me he encontrado con un comportamiento muy extraño con la ieeecolor.cls
clase de documento! La compilación de un documento de látex usando esta clase con el tikz
paquete activa algunas advertencias de color: Warning Incompatible color definition
, pero el pdf generado parece ser el esperado (es decir, consulte MWE a continuación).
Sin embargo, suceden cosas muy extrañas cuando se agrega la siguiente sección al archivo 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}
En este caso, el comportamiento del látex es bastante inesperado y los colores ya no son como deberían. Esto parece provenir de un choque entre la nueva ieeecolor
clase y algunos paquetes como tikz
.
¿Alguien ha encontrado este problema antes? ¿Alguien ha encontrado una solución para esto?
La ieeecolor
clase se puede encontrar en elSitio web del Centro de autores IEEE, requiere los archivos ieeecolor.cls
y 'generic.sty'.
Ejemplo de trabajo mínimo con código de color de página y texto comentado:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%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}
generico.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}
Respuesta1
ieeecolor.sty
Es un poco doloroso en la espalda. Por cierto, ¿alguien sabe con quién se puede contactar para publicar parches?
Hay aquí dos problemas técnicos y uno filosófico.
La cuestión filosófica es: ¿vale la pena preocuparse? Cuando acepten su documento, lo reformatearán con algo que no sea LaTeX en absoluto y, de todos modos, quieren figuras separadas, que es mejor construir con standalone
. Pero si desea que su archivo funcione para uso interno o para enviarlo a algún archivo, entonces sí, tal vez valga la pena preocuparse.
Los problemas técnicos son dos:
- el primero es bastante grande:el color se filtrará. La respuesta vinculada proporciona una buena respuesta.
- El paquete se carga
color
, noxcolor
(¡en 2021!), por eso tienes todos los problemas con TikZ, que requierexcolor
.
Soluciones posibles.
- parche
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}}
Creo que esto debería solucionar ambos problemas.
- Si no desea tocar la clase original, intentemos engañar
ieeecolor
cargándolaxcolor
antes de la clase; arreglar el otro problemacon solución de Phelype Oleinik: simplemente cambie su invocación\documentclass
con (¡probado usando elieeecolor.cls
descargado esta mañana!):
\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}
Ambos parecen funcionar para mí, pero no tuve tiempo de comprobarlo en profundidad.