There are many ways for detecting "color" in PDF pages. Without the knowledge of the exact method of the printer, guessing and experimenting remain.
It would help to have a PDF file for analyzing, whose pages are correctly classified by the printer as black and colored pages.
If you want to experiment (and spend some money), a guess with experiment follows.
LaTeX test
Usually the gray color model is used for black in LaTeX:
\definecolor{black}{gray}{0}
If the printer has problems with this color model and thinks, this is color (maybe because of an odd translation to CMYK), then the following file for pdfTeX could be used to test the theory:
\documentclass{article}
\pagestyle{empty}
\usepackage{color}
\definecolor{black}{cmyk}{0,0,0,1}
\makeatletter
\expandafter\let\expandafter\current@color
\csname\string\color @black\endcsname
\chardef\main@pdfcolorstack
\pdfcolorstackinit page direct\expandafter{\current@color}\relax
\makeatother
\begin{document}
CMYK-Black
\newpage
Gray: \textcolor[gray]{.5}{Gray}
\newpage
CMYK-Gray: \textcolor[cmyk]{0,0,0,.5}{Gray}
\end{document}
It changes the definition for black to the CMYK color model.
The first page only contains black in CMYK ([cmyk]{0,0,0,1}
).
The second page adds gray in the gray colormodel ([gray]{.5}
) and the third page uses the same gray in CMYK ([cmyk]{0,0,0,.5}
).
Plain TeX test
The following test file tests black in different color models:
\pdfobjcompresslevel=0
\pdfcompresslevel=0
\nopagenumbers
\bf
Pure black
\par\vfill\eject
\pdfliteral direct{0 g 0 G}Gray black
\par\vfill\eject
\pdfliteral direct{0 0 0 rg 0 0 0 RG}RGB black
\par\vfill\eject
\pdfliteral direct{0 0 0 1 k 0 0 0 1 K}CMYK black
\bye
It is has to be compiled with pdftex
, not pdflatex
. Except for the first page, there is one color instruction on the page exactly. The color is given as LaTeX color expression:
- Page 1: no color instructions (the printer should report as black page).
- Page 2:
\color[gray]{0}
- Page 3:
\color[rgb]{0,0,0}
- Page 4:
\color[cmyk]{0,0,0,1}
In theory, color is not used at all in all pages, the text is always "black".
It would give some hints, if the printer classifies one or some of the pages as "colored".
Use sectsty
(or, with some more work, titlesec
):
\documentclass{article}
\usepackage{fontspec}
\usepackage{xcolor}
\usepackage{sectsty}
\colorlet{headercolor}{gray}
\newcounter{colorCounter}
\newcommand\sectioncolor{%
\color{%
\ifcase\value{colorCounter}%
blue\or
red\or
orange\or
green\or
purple\or
brown\else
headercolor\fi
}%
\stepcounter{colorCounter}%
% Remove the following line if you don't want to cycle
\ifnum\value{colorCounter}=7 \setcounter{colorCounter}{0}\fi
}
% in section titles \sectioncolor will be executed
\sectionfont{\sectioncolor}
% don't number sections
\setcounter{secnumdepth}{0}
\begin{document}
\section{aaaaaa}
\section{bbbbbb}
\section{cccccc}
\section{dddddd}
\section{eeeeee}
\section{ffffff}
\section{gggggg}
\section{hhhhhh}
\end{document}
Best Answer
You can load the
dvipsnames
option:Since
beamer
already loadsxcolor
with thesvgnames
option, you can't say\usepackage[dvipsnames]{xcolor}
(orcolor
); in order to overcome this limitation, one can specify that option to the class.If you still want to use different colors based on the compiler, then
will work.