0

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: enter image description here

0

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
\newcommand\raiseinfo[1]{\raisebox{3mm}[0pt][0pt]{\footnotesize#1\x My additional information}}
\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{{%
        \global\advance\CROP@index\@ne
        \def\x{\discretionary{}{}{\hbox{\kern.5em---\kern.5em}}}%
        \advance\paperwidth-20\p@
        \dimen@4pt
        \ifx\CROP@pagecolor\@empty
        \else
        \advance\dimen@\CROP@overlap
        \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: enter image description here

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?

3
  • 1
    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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.