diff options
author | Karl Berry <karl@freefriends.org> | 2018-08-08 21:05:58 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-08-08 21:05:58 +0000 |
commit | 9b57e6101d0ce5e78a61572e72d8476e0ddf9272 (patch) | |
tree | b927eb9f4803d83ad0a8ca0014fe87dd4204868a /Master/texmf-dist/tex/latex/jlreq/jlreq-trimmarks.sty | |
parent | cdafe3eb63fd3a1ad8e465a60127ae57a575c5a5 (diff) |
jlreq (8aug18)
git-svn-id: svn://tug.org/texlive/trunk@48376 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/jlreq/jlreq-trimmarks.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/jlreq/jlreq-trimmarks.sty | 73 |
1 files changed, 51 insertions, 22 deletions
diff --git a/Master/texmf-dist/tex/latex/jlreq/jlreq-trimmarks.sty b/Master/texmf-dist/tex/latex/jlreq/jlreq-trimmarks.sty index 73d9bed7603..d6242c6c56d 100644 --- a/Master/texmf-dist/tex/latex/jlreq/jlreq-trimmarks.sty +++ b/Master/texmf-dist/tex/latex/jlreq/jlreq-trimmarks.sty @@ -1,5 +1,5 @@ \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{jlreq-trimmarks}[2018/06/17 jlreq-trimmarks] +\ProvidesPackage{jlreq-trimmarks}[2018/08/08 jlreq-trimmarks] \RequirePackage{xkeyval,etoolbox} \RequirePackage{jlreq-helpers} @@ -52,7 +52,7 @@ } \newcommand*{\jlreq@trimmarks@addpapersize@@}[3]{% \@for\@tempa:=#1\do{% - \eappto\jlreq@trimmarks@switchpapersize{{\expandonce{\@tempa}}{\unexpanded{\def\jlreq@trimmarks@paperwidth{#2}\def\jlreq@trimmarks@paperheight{#3}}}}% + \eappto\jlreq@trimmarks@switchpapersize{{\expandonce{\@tempa}}{\unexpanded{\def\jlreq@resulta{#2}\def\jlreq@resultb{#3}}}}% }% } \jlreq@trimmarks@afterpkg@addtodeletecs{\jlreq@trimmarks@switchpapersize} @@ -100,21 +100,24 @@ \jlreq@trimmarks@addpapersize{executive}[executive] \jlreq@trimmarks@addpapersize{hagaki}[hagaki] -\DeclareOptionX{trimmarks_paper}{ - \edef\jlreq@do{% - \unexpanded{\jlreq@switch{#1}}{\expandonce{\jlreq@trimmarks@switchpapersize}}% - [\unexpanded{% - \jlreq@helper@dividebycomma{#1}% - \ifjlreq@result - \edef\jlreq@trimmarks@paperwidth{\jlreq@resulta} - \edef\jlreq@trimmarks@paperheight{\jlreq@resultb} - \else - \PackageError{jlreq}{The paper #1 is unknown}{\@ehc}% - \fi - }]% - }% - \jlreq@do +% width -> \jlreq@resulta, height -> \jlreq@resultb +\edef\jlreq@trimmarks@analyzepapersize#1{% + \noexpand\jlreq@switch{#1}{% + \expandonce{\jlreq@trimmarks@switchpapersize}% + {% + \noexpand\jlreq@helper@dividebycomma{#1} + \unexpanded{\ifjlreq@result\else} + \unexpanded{\def\jlreq@resulta}{#1} + \unexpanded{\def\jlreq@resultb}{#1} + \noexpand\fi + }% + }\noexpand\relax% } +\jlreq@trimmarks@afterpkg@addtodeletecs{\jlreq@trimmarks@analyzepapersize} + +\def\jlreq@trimmarks@option@papersize{+2in} +\DeclareOptionX{trimmarks_paper}{\def\jlreq@trimmarks@option@papersize{#1}} +\jlreq@trimmarks@afterpkg@addtodeletecs{\jlreq@trimmarks@option@papersize} \newif\ifjlreq@trimmarks@digital \jlreq@trimmarks@digitaltrue \newif\ifjlreq@trimmarks@show \jlreq@trimmarks@showtrue @@ -136,6 +139,9 @@ } } } +\newif\ifjlreq@trimmarks@landscape \jlreq@trimmarks@landscapefalse +\jlreq@trimmarks@DeclareOption{landscape}{\jlreq@trimmarks@landscapetrue} +\jlreq@trimmarks@afterpkg@addtodeleteif{\ifjlreq@trimmarks@landscape} \let\jlreq@temporary@original@@removeelement=\@removeelement \let\@removeelement=\jlreq@helper@removeelement @@ -143,9 +149,37 @@ \let\@removeelement=\jlreq@temporary@original@@removeelement \let\jlreq@temporary@original@@removeelement=\@undefined +\def\jlreq@trimmarks@setpapersize#1{% + \jlreq@ifcontains{#1}{+}{ + \def\@tempa##1+##2\jlreq@endmark{% + \jlreq@ifempty{##1}{ + \let\jlreq@tempa=\paperwidth + \let\jlreq@tempb=\paperheight + }{ + \jlreq@trimmarks@analyzepapersize{##1} + \let\jlreq@tempa=\jlreq@resulta + \let\jlreq@tempb=\jlreq@resultb + \ifjlreq@trimmarks@landscape\jlreq@swap{\jlreq@tempa}{\jlreq@tempb}\fi + } + \jlreq@trimmarks@analyzepapersize{##2} + \ifjlreq@trimmarks@landscape\jlreq@swap{\jlreq@resulta}{\jlreq@resultb}\fi + \edef\jlreq@trimmarks@paperwidth{\the\dimexpr\jlreq@tempa + \jlreq@resulta\relax} + \edef\jlreq@trimmarks@paperheight{\the\dimexpr\jlreq@tempb + \jlreq@resultb\relax} + } + \@tempa#1\jlreq@endmark + }{ + \jlreq@trimmarks@analyzepapersize{#1} + \ifjlreq@trimmarks@landscape\jlreq@swap{\jlreq@resulta}{\jlreq@resultb}\fi + \edef\jlreq@trimmarks@paperwidth{\jlreq@resulta} + \edef\jlreq@trimmarks@paperheight{\jlreq@resultb} + } +} +\jlreq@trimmarks@afterpkg@addtodeletecs{\jlreq@trimmarks@setpapersize} +\expandafter\jlreq@trimmarks@setpapersize\expandafter{\jlreq@trimmarks@option@papersize} + \ifx o\jlreq@trimmarks@driver \ifjlreq@trimmarks@digital - \ClassError{jlreq}{`show=digital' can't be used with the driver `dviout'}{\@ehc} + \PackageError{jlreq-trimmarks}{`show=digital' can't be used with the driver `dviout'}{\@ehc} \fi \fi @@ -215,11 +249,6 @@ \fi \fi -\ifx\jlreq@trimmarks@paperwidth\@undefined - \edef\jlreq@trimmarks@paperwidth{\the\dimexpr\paperwidth + 2in\relax} - \edef\jlreq@trimmarks@paperheight{\the\dimexpr\paperheight + 2in\relax} -\fi - \ifx l\jlreq@engine \setlength{\pagewidth}{\dimexpr\jlreq@trimmarks@paperwidth\relax} \setlength{\pageheight}{\dimexpr\jlreq@trimmarks@paperheight\relax} |