# How can I adjust the distance from the trimmed page to the logical page with package crop?

The crop package offers an excellent way to add crop marks and other elements to a page, so it gets print ready. One of those elements is an info text, that contains information about the job name, the current time, etc.

This text is printed with a certain distance to the actual page to be trimmed, but for technical reasons, this might be too close, to the actual page. Of course you can easily deactivate this text, but maybe you just want to move it further away.

This is where we are starting:

\documentclass[paper=155mm:230mm]{scrbook}
\usepackage[frame,width=169.8truemm,height=247.4truemm,cam,pdftex]{crop}
\setlength{\voffset}{7.4mm}
\setlength{\hoffset}{7.4mm}

\begin{document}
Test
\end{document}


And the result is:

Now to move the text upward, we unfortunately have to redefine an internal macro of crop, namely \CROP@@info, even if we only adjust the line with \vskip3mm. But maybe you also want to add something into this line as well and not overwrite it with the available features of crop?

The simple approach provided by @UlrikeFischer in the comments below is:

\newcommand\raiseinfo[1]{\raisebox{3mm}[0pt][0pt]{#1}}
\makeatletter
\def\CROP@font{raiseinfo}
\makeatother


Based on this, you can also add additional content into the line of text, preferably maybe in a smaller fontsize, e.g. \footnotesize:

\makeatletter
\def\CROP@font{raiseinfo}
\makeatother


Well what could be the additional information? If you are using git, it could e.g. be the information which commit this PDF is based on:

\makeatletter
\immediate\write18{git log -1 --format="\@percentchar h from \@percentchar cr" > currentVersion}
\newcommand\raiseinfo[1]{\raisebox{3mm}[0pt][0pt]{\footnotesize#1\x\IfFileExists{currentVersion}{\input{currentVersion}}{No commit info}}}
\def\CROP@font{raiseinfo}
\makeatother


However if you need to modify the command alltogether, you can also hack the basics under the hood:

\documentclass[paper=155mm:230mm]{scrbook}
\usepackage[frame,width=169.8truemm,height=247.4truemm,cam,pdftex]{crop}
\setlength{\voffset}{7.4mm}
\setlength{\hoffset}{7.4mm}

\makeatletter
\renewcommand*\CROP@@info{{%
\def\x{\discretionary{}{}{\hbox{\kern.5em---\kern.5em}}}%
\dimen@4pt
\ifx\CROP@pagecolor\@empty
\else
\fi
\hb@xt@\z@{%
\hss
\vbox to\z@{%
\centering
\hsize\paperwidth
\vss
\normalfont
\normalsize
\expandafter\csname\CROP@font\endcsname{%
\jobname''\x
\the\year/\the\month/\the\day\x
\CROP@time\x
page\kern.5em\thepage\x
\#\the\CROP@index
\strut
}%
\vskip3mm
}%
\hss
}%
}}
\makeatother

\begin{document}
Test
\end{document}


In our result, the top line is moved upward:

I hope this is of help to someone besides me, I was short before asking here on StackExchange. Maybe this is also worth an improvement at https://github.com/rrthomas/crop/tree/master to make this parameter adjustable?

• A shorter way would be \newcommand\raiseinfo[1]{\raisebox{0.3cm}[0pt][0pt]{#1}} \makeatletter\def\CROP@font{raiseinfo}\makeatother. Beside this: if you have a feature request open an issue at the github. – Ulrike Fischer Jun 6 '20 at 9:23
• Thanks @UlrikeFischer, I didn't think about this trick to abuse the font command. This way you can also add additional information to the line without getting rid of the rest, e.g. if you have your file in git you can do a write18 call and write here: \makeatletter \immediate\write18{git log -1 --format="\@percentchar h from \@percentchar cr" > currentVersion} \newcommand\raiseinfo[1]{\raisebox{3mm}[0pt][0pt]{\footnotesize#1\x\IfFileExists{currentVersion}{\input{currentVersion}}{No commit info}}} \def\CROP@font{raiseinfo} \makeatother – TobiBS Jun 6 '20 at 16:55
• @UlrikeFischer, I included your comment into the answer, hope this is of value to others and I think it is not necessary to include it into the crop package, what do you think? – TobiBS Jun 6 '20 at 17:23