# Package color Error: Argument 1.01125' no in range [0,1]

I have been writing a paper and used tikz for some of my figures. Then when we decided to submit to a particular conference, and used the style file they provided, the figure broke (failed to compile). I dissected their style file and found that the line "\p@=1bp" is responsible for the problem, but I do not know what that line is and how to work around it. Simply removing the line is not a solution since I have no control over the style file they will use for the final publishable version.

This version works correctly:

\documentclass{minimal}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\fill [blue!25] (1,1) rectangle (2,2);
\end{tikzpicture}
\end{document}


This version generates the error mentioned in the title:

\documentclass{minimal}
\makeatletter
\p@=1bp
\makeatother
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\fill [blue!25] (1,1) rectangle (2,2);
\end{tikzpicture}
\end{document}


Curiously, it works again when I remove the "!25" after "blue":

\documentclass{minimal}
\makeatletter
\p@=1bp
\makeatother
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\fill [blue] (1,1) rectangle (2,2);
\end{tikzpicture}
\end{document}


I am using pdflatex: pdfTeX 3.14159265-2.6-1.40.17 (TeX Live 2016/MacPorts 2016_4).

I am looking for a way to specify the color "blue!25" without modifying the style file. That is, with the following snippet present in the preamable:

\makeatletter
\p@=1bp
\makeatother


Thank you.

• For the interested, the style file is dgruyter_NEW.sty: [2013/10/15 v0.87 Walter de Gruyter layout]. – M. Alaggan Feb 7 '17 at 18:07
• \makeatletter \p@=1bp \makeatother will completely break latex arithmetic and lead to errors such as the one you show. – David Carlisle Feb 7 '17 at 18:13
• @pschulz Latex does not have floating point numbers so to work with (for example) 0.5 typical thing is to use \dimen@=0.5\p@ which is 0.5pt then to get back to 0.5 you can use \the\dimen@ but if you change the value of \p@ all the values are multiplied by 72.27/27 .... – David Carlisle Feb 7 '17 at 18:20
• @M.Alaggan Write to De Gruyter and tell them they can do better than breaking everything in LaTeX. – egreg Feb 7 '17 at 18:26
• I have reported this to the feedback email addressees given for dgruyter and le-tex who maintain this package, so hopefully it will get fixed. – David Carlisle Feb 8 '17 at 9:42

\p@ is originally defined as 1.0pt. After \p@=1bp it has the value 1.00374pt. I suggest to add the lines

\makeatletter
\p@=1pt
\makeatother


to the preamble after loading dgruyter_NEW.sty.

Edit: The issue is still present in the most recent version of de Gruyter's LaTeX package. One of the first lines in dgruyter.sty (identifying itself as 2016/09/28 v1.82 De Gruyter layout) still reads \p@=1bp\relax, which leads to the error described in the original post.

• @M.Alaggan You should accept this (which is what you should do). In my answer I rather concentrated on why the class is wrong Hopefully the maintainers of the class will see this question and fix it... – David Carlisle Feb 7 '17 at 19:51
• Just as info: 2017/09/19 v2.00 De Gruyter layout still has this wonderful feature... – campa Jan 23 '18 at 14:42

Actually I get no error on the supplied test file however

\makeatletter
\p@=1bp
\makeatother


is spectacularly wrong and will break almost all latex arithmetic, not only color, but the graphics package, arithmetic by the calc package, tabularx, .....

To see why note that latex has no floating point registers, only lengths or integers so if for example you are mixing colours and need to multiply .3 by 2 the usual way is to go via lengths

\dimen@=.3\p@


now \dimen@ is .3pt

\dimen@=2\dimen@


now it is .6pt

\edef\result{\strip@pt\dimen@}
\show\result


removes the pt

> \result=macro:
->0.6.


But now redefine \p@ to be 1bp the same calculation ends up with

> \result=macro:
->0.60223.


so even the simplest arithmetic operation gives an incorrect result.

• To complete the story: One might wonder why the packages use 0.3\p@ instead of 0.3pt. LaTeX defines several macros like \p@ and \z@ (see lines 465ff of latex.ltx) as abbreviations for 1pt and 0pt`, for efficiency reasons. Redefining these macros is equivalent to changing the semantics of LaTeX. – gernot Feb 7 '17 at 21:01
• @gernot where "changing the semantics of" is polite for "utterly completely breaking" :-) – David Carlisle Feb 7 '17 at 21:05