rrthomas / crop Goto Github PK
View Code? Open in Web Editor NEWThis project forked from drehscheibe/crop
LaTeX package "crop" for adding crop marks
This project forked from drehscheibe/crop
LaTeX package "crop" for adding crop marks
crop ==== This package provides different forms of cropmarks for trimming paper stacks, for camera alignment and for visualizing the page dimensions. There are options for centering the page with respect to some physical paper size, for marking the vertical and horizontal middle axis, for mounting pages on a physical sheet, for reflecting and inverting the whole document or printing it upside-down, and for suppressing either text or graphics output. COPYRIGHT NOTICE ================ This package is free software that can be redistributed and/or modified under the terms of the LaTeX Project Public License as specified in the file macros/latex/base/lppl.txt on any CTAN archive server. Extracting the package & processing the documentation ===================================================== Run "make" to get the style file and the documentation, then install crop.sty and crop.pdf in appropriate directories.
\documentclass{article}
\usepackage[mirror]{crop}
\begin{document}
Some text
\end{document}
If compiled with pdflatex gives the warning
Misplaced \pdfrestore by (40258437sp, 0sp)
with lualatex one gets
warning (pdf backend): misplaced 'restore' by (40258437sp, 0sp)
The problem is that \rlap
is robust since texlive 2018, but the reflection code is executed in a place where \protect
has the meaning \noexpand
and so it doesn't expand. The following seems to correct the problem:
\documentclass{article}
\usepackage[mirror]{crop}
\makeatletter
\renewcommand*\CROP@genreflect[1]{%
\leavevmode
\dimen0\CROP@horigin
\kern2\dimen0
\begingroup \set@typeset@protect %change protect
\reflectbox{%
\hb@xt@\paperwidth{%
\vbox to\paperheight{%
#1%
\vss
}%
\hss
}%
}%
\endgroup
}
\makeatother
\begin{document}
Some text
\end{document}
crop.sty uses in various places \stockwidth
and \stockheight
to set the mediabox. It sets it to paperwidth/paperheight at the begin, but only if the dimen don't exist:
\expandafter\ifx\csname stockwidth\endcsname\relax
\newdimen\stockwidth
\stockwidth\paperwidth
\fi
\expandafter\ifx\csname stockheight\endcsname\relax
\newdimen\stockheight
\stockheight\paperheight
\fi
This fails in a current LaTeX 2022-11-01 as the kernel now defines \stockwidth
and \stockheight
too. As can be seen in this example
\documentclass[10pt]{book}
\usepackage[center]{crop}
\begin{document}
abc
\end{document}
which produce a wrong mediabox:
I suggest to change the test and test for invalid values of the dimen too:
\ifcsname stockwidth\endcsname
\ifdim\stockwidth > 0pt
\else
\stockwidth\paperwidth
\fi
\else
\newdimen\stockwidth
\stockwidth\paperwidth
\fi
\ifcsname stockheight\endcsname
\ifdim\stockheight > 0pt
\else
\stockheight\paperheight
\fi
\else
\newdimen\stockheight
\stockheight\paperheight
\fi
We just released a new development version of the next LaTeX version,
In this dev release we implemented a new hook system and extended the existing set of hooks.
Details can be found in the announcement:
https://www.latex-project.org/news/2020/07/22/latex-dev-2020-10-1b/
Beside other we implemented a number of shipout hooks which were previously provided by various external packages.
As crop is redefining \shipout
it is possible that it clashes with this new implementation, so it would be nice if you could test and (if possible) change the code to use the provided hooks instead. In case you have questions, comments or problems, open please an issue at the LaTeX 2e github.
Ulrike Fischer, LaTeX team
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.