# Broken pgfornaments with eso-pic

I really like the ornaments that this block of code makes for me:

\usepackage{eso-pic}
\makeatletter
\begingroup
\setlength{\@tempdima}{2mm}%
\setlength{\@tempdimb}{\paperwidth-\@tempdima-2cm}%
\setlength{\@tempdimc}{\paperheight-\@tempdima}%
\put(\LenToUnit{\@tempdima},\LenToUnit{\@tempdimc}){%
\pgfornament[anchor=north west,width=2cm]{63}}
\put(\LenToUnit{\@tempdima},\LenToUnit{\@tempdima}){%
\pgfornament[anchor=south west,width=2cm,symmetry=h]{63}}
\put(\LenToUnit{\@tempdimb},\LenToUnit{\@tempdimc}){%
\pgfornament[anchor=north east,width=2cm,symmetry=v]{63}}
\put(\LenToUnit{\@tempdimb},\LenToUnit{\@tempdima}){%
\pgfornament[anchor=south east,width=2cm,symmetry=c]{63}}
\endgroup
}
\makeatother


It comes from page 11 of pgfornament and it makes all four corners have these pretty ornaments that you see in the linked PDF.

Last year I used it myself for several of my documents and achieved identical results as what you see in the linked PDF, but this year it seems to be breaking with no informative error message. Instead of all four corners getting these nice ornaments, now only the two left corners get the ornaments and the typesetting process halts with this error message for every decorated page:

Missing number, treated as zero.
\relax


I think I must have upgraded one or more packages since I last used this code successfully and that's probably why it's breaking, but I'm mystified by the error message and clueless as to how to fix the problem. I've confirmed (by commenting out the block of code) that this code is definitely what is throwing the error message, and even though I can continue compiling with "s", the PDF output no longer has all 4 corners decorated, so I'd like to fix it.

Any suggestions on how to fix this?

• Are you loading the calc package? Otherwise, you'll receive the error you mention. Jul 16, 2014 at 14:55
• Please add a full MWE which results in this error! Jul 16, 2014 at 14:55

Since you are performing some additions/subtractions with lengths, you need to either load the calc package:

\documentclass{article}
\usepackage[a6paper]{geometry}% just for the exmaple
\usepackage{pgfornament}
\usepackage{eso-pic}
\usepackage{calc}

\makeatletter
\begingroup
\setlength{\@tempdima}{2mm}%
\setlength{\@tempdimb}{\paperwidth-\@tempdima-2cm}%
\setlength{\@tempdimc}{\paperheight-\@tempdima}%
\put(\LenToUnit{\@tempdima},\LenToUnit{\@tempdimc}){%
\pgfornament[anchor=north west,width=2cm]{63}}
\put(\LenToUnit{\@tempdima},\LenToUnit{\@tempdima}){%
\pgfornament[anchor=south west,width=2cm,symmetry=h]{63}}
\put(\LenToUnit{\@tempdimb},\LenToUnit{\@tempdimc}){%
\pgfornament[anchor=north east,width=2cm,symmetry=v]{63}}
\put(\LenToUnit{\@tempdimb},\LenToUnit{\@tempdima}){%
\pgfornament[anchor=south east,width=2cm,symmetry=c]{63}}
\endgroup
}
\makeatother

\begin{document}

Test

\end{document}


or to use \dimexpr:

\documentclass{article}
\usepackage[a6paper]{geometry}% just for the exmaple
\usepackage{pgfornament}
\usepackage{eso-pic}

\makeatletter
\begingroup
\setlength{\@tempdima}{2mm}%
\setlength{\@tempdimb}{\dimexpr\paperwidth-\@tempdima-2cm\relax}%
\setlength{\@tempdimc}{\dimexpr\paperheight-\@tempdima\relax}%
\put(\LenToUnit{\@tempdima},\LenToUnit{\@tempdimc}){%
\pgfornament[anchor=north west,width=2cm]{63}}
\put(\LenToUnit{\@tempdima},\LenToUnit{\@tempdima}){%
\pgfornament[anchor=south west,width=2cm,symmetry=h]{63}}
\put(\LenToUnit{\@tempdimb},\LenToUnit{\@tempdimc}){%
\pgfornament[anchor=north east,width=2cm,symmetry=v]{63}}
\put(\LenToUnit{\@tempdimb},\LenToUnit{\@tempdima}){%
\pgfornament[anchor=south east,width=2cm,symmetry=c]{63}}
\endgroup
}
\makeatother

\begin{document}

Test

\end{document}


The result in both cases:

• That fixed it. That's so interesting! Curious: what changed in the last 6-12 months for this code to require the calc package? I definitely was not using it before, and it worked fine then. Thanks for your help! Jul 16, 2014 at 22:21
• @TeXnewbie The code has always required one of my two solutions. Perhaps you were loading some package which internally loaded calc and then you stop loading it? Jul 16, 2014 at 23:30
• Note you should not use \@tempdimc here with newer latex implementations, see tex.stackexchange.com/a/632509/1090 Feb 3 at 10:22