From 119c85f0884038993a1e14ff427e4abc96308f98 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 17 Dec 2017 22:57:56 +0000 Subject: platex-tools (17dec17) git-svn-id: svn://tug.org/texlive/trunk@46083 c570f23f-e606-0410-a88d-b1316a301751 --- .../tex/latex/platex-tools/gentombow.sty | 159 +++++++++++++++++++++ .../tex/latex/platex-tools/pxatbegshi.sty | 76 ++++++++++ .../tex/latex/platex-tools/pxgentombow.sty | 34 ++++- 3 files changed, 262 insertions(+), 7 deletions(-) create mode 100644 Master/texmf-dist/tex/latex/platex-tools/gentombow.sty create mode 100644 Master/texmf-dist/tex/latex/platex-tools/pxatbegshi.sty (limited to 'Master/texmf-dist/tex/latex/platex-tools') diff --git a/Master/texmf-dist/tex/latex/platex-tools/gentombow.sty b/Master/texmf-dist/tex/latex/platex-tools/gentombow.sty new file mode 100644 index 00000000000..4318d9871d6 --- /dev/null +++ b/Master/texmf-dist/tex/latex/platex-tools/gentombow.sty @@ -0,0 +1,159 @@ +% +% gentombow.sty +% written by Hironobu Yamashita (@aminophen) +% +% This package is part of the platex-tools bundle. +% https://github.com/aminophen/platex-tools +% + +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{gentombow} + [2017/12/17 v0.9 Generate crop mark 'tombow'] +\def\pxgtmb@emu@pkgname{gentombow} + +%% error status (shared with pxgentombow.sty) +\ifx\pxgtmb@errlevel\@undefined + \chardef\pxgtmb@errlevel=\z@ +\fi + +%% supported engines +\ifx\pfmtversion\@undefined + \@ifpackageloaded{luatexja}{}{\chardef\pxgtmb@errlevel=\@ne} +\fi +\ifnum\pxgtmb@errlevel>\z@\else + \PackageInfo{\pxgtmb@emu@pkgname}{% + pLaTeX, upLaTeX and LuaTeX-ja are natively\MessageBreak + supported by `pxgentombow' package;\MessageBreak + there is no need for this package.} + \RequirePackageWithOptions{pxgentombow} + \expandafter\endinput +\fi + +%%%%% EMULATION BEGIN + +% required for patching \@outputpage +\RequirePackage{etoolbox} + +% patch \@outputpage +\begingroup +\def\pxgtmb@emu@status{0} +\let\pxgtmb@emu@outputpage\@outputpage +\patchcmd\pxgtmb@emu@outputpage % try first patch + {\reset@font\normalsize\normalsfcodes}% + {% + \@@topmargin\topmargin + \iftombow + \@@paperwidth\paperwidth \advance\@@paperwidth 6mm\relax + \@@paperheight\paperheight \advance\@@paperheight 16mm\relax + \advance\@@topmargin 1in\relax \advance\@themargin 1in\relax + \fi + \reset@font\normalsize\normalsfcodes} + {}{\def\pxgtmb@emu@status{1}} +\patchcmd\pxgtmb@emu@outputpage % try second patch + {\@begindvi \vskip \topmargin}% + {\@begindvi \@outputtombow \vskip \@@topmargin}% + {}{\def\pxgtmb@emu@status{1}} +% commit the change only when successful; otherwise +% tombow feature is never enabled, exit right away +\if 0\pxgtmb@emu@status\relax + \global\let\@outputpage\pxgtmb@emu@outputpage +\else + \PackageError{\pxgtmb@emu@pkgname}{% + Failed in patching \string\@outputpage!\MessageBreak + Sorry, I can't proceed anymore...}\@ehc + \expandafter\expandafter\expandafter\endinput\expandafter +\fi +\endgroup +% + +% provides equivalent for plcore.ltx +\newif\iftombow \tombowfalse +\newif\iftombowdate \tombowdatetrue +\newdimen\@tombowwidth +\setlength{\@tombowwidth}{.1\p@} +\newbox\@TL\newbox\@Tl +\newbox\@TC +\newbox\@TR\newbox\@Tr +\newbox\@BL\newbox\@Bl +\newbox\@BC +\newbox\@BR\newbox\@Br +\newbox\@CL +\newbox\@CR +\font\@bannerfont=cmtt9 +\newtoks\@bannertoken +\@bannertoken{} +\def\maketombowbox{% removed \yoko from all boxes + \setbox\@TL\hbox to\z@{\hss + \vrule width13mm height\@tombowwidth depth\z@ + \vrule height10mm width\@tombowwidth depth\z@ + \iftombowdate + \raise4pt\hbox to\z@{\hskip5mm\@bannerfont\the\@bannertoken\hss}% + \fi}% + \setbox\@Tl\hbox to\z@{\hss + \vrule width10mm height\@tombowwidth depth\z@ + \vrule height13mm width\@tombowwidth depth\z@}% + \setbox\@TC\hbox{% + \vrule width10mm height\@tombowwidth depth\z@ + \vrule height10mm width\@tombowwidth depth\z@ + \vrule width10mm height\@tombowwidth depth\z@}% + \setbox\@TR\hbox to\z@{% + \vrule height10mm width\@tombowwidth depth\z@ + \vrule width13mm height\@tombowwidth depth\z@\hss}% + \setbox\@Tr\hbox to\z@{% + \vrule height13mm width\@tombowwidth depth\z@ + \vrule width10mm height\@tombowwidth depth\z@\hss}% + \setbox\@BL\hbox to\z@{\hss + \vrule width13mm depth\@tombowwidth height\z@ + \vrule depth10mm width\@tombowwidth height\z@}% + \setbox\@Bl\hbox to\z@{\hss + \vrule width10mm depth\@tombowwidth height\z@ + \vrule depth13mm width\@tombowwidth height\z@}% + \setbox\@BC\hbox{% + \vrule width10mm depth\@tombowwidth height\z@ + \vrule depth10mm width\@tombowwidth height\z@ + \vrule width10mm depth\@tombowwidth height\z@}% + \setbox\@BR\hbox to\z@{% + \vrule depth10mm width\@tombowwidth height\z@ + \vrule width13mm depth\@tombowwidth height\z@\hss}% + \setbox\@Br\hbox to\z@{% + \vrule depth13mm width\@tombowwidth height\z@ + \vrule width10mm depth\@tombowwidth height\z@\hss}% + \setbox\@CL\hbox to\z@{\hss + \vrule width10mm height.5\@tombowwidth depth.5\@tombowwidth + \vrule height10mm depth10mm width\@tombowwidth}% + \setbox\@CR\hbox to\z@{% + \vrule height10mm depth10mm width\@tombowwidth + \vrule height.5\@tombowwidth depth.5\@tombowwidth width10mm\hss}% +} +\def\@outputtombow{% + \iftombow + \vbox to\z@{\kern-13mm\relax + \boxmaxdepth\maxdimen + \moveleft3mm\vbox to\@@paperheight{% + \hbox to\@@paperwidth{\hskip3mm\relax + \copy\@TL\hfill\copy\@TC\hfill\copy\@TR\hskip3mm}% + \kern-10mm + \hbox to\@@paperwidth{\copy\@Tl\hfill\copy\@Tr}% + \vfill + \hbox to\@@paperwidth{\copy\@CL\hfill\copy\@CR}% + \vfill + \hbox to\@@paperwidth{\copy\@Bl\hfill\copy\@Br}% + \kern-10mm + \hbox to\@@paperwidth{\hskip3mm\relax + \copy\@BL\hfill\copy\@BC\hfill\copy\@BR\hskip3mm}% + }\vss + }% + \fi +} +\newdimen\@@paperheight +\newdimen\@@paperwidth +\newdimen\@@topmargin +\newcount\hour +\newcount\minute + +%%%%% EMULATION END + +%% load it +\RequirePackageWithOptions{pxgentombow} + +\endinput diff --git a/Master/texmf-dist/tex/latex/platex-tools/pxatbegshi.sty b/Master/texmf-dist/tex/latex/platex-tools/pxatbegshi.sty new file mode 100644 index 00000000000..91e107dc790 --- /dev/null +++ b/Master/texmf-dist/tex/latex/platex-tools/pxatbegshi.sty @@ -0,0 +1,76 @@ +% +% pxatbegshi.sty +% based on H. Kitagawa's code on GitHub:texjporg/tex-jp-build#21 +% and modified by Hironobu Yamashita +% +% This package is distributed as part of the platex-tools bundle +% maintained by Hironobu Yamashita +% https://github.com/aminophen/platex-tools +% + +%% package declaration +\NeedsTeXFormat{pLaTeX2e} +\ProvidesPackage{pxatbegshi} + [2017/11/04 v0.2 Patch to atbegshi for (u)pLaTeX] + +%% preparations +\def\pxabgs@pkgname{pxatbegshi} +\def\pxabgs@warn{\PackageWarningNoLine\pxabgs@pkgname} + +%% load it +\RequirePackage{atbegshi} + +%% internal macros are locally effective +\begingroup + +%--------------------------------------- helpers + +%% unique tokens +\def\pxabgs@mark{\pxabgs@mark@} +\def\pxabgs@fin{\pxabgs@fin@} + +%% \pxabgs@patch@cmd\CMD{}{} +\@onlypreamble\pxabgs@patch@cmd +\def\pxabgs@patch@cmd#1#2#3{% + \def\pxabgs@next##1#2##2\pxabgs@mark##3\pxabgs@fin{% + \ifx\pxabgs@mark##3\pxabgs@mark + \let\pxabgs@fragment\relax + \else + \def\pxabgs@fragment{##2}% + \def#1{##1#3##2}% + \fi}% + \expandafter\pxabgs@next#1\pxabgs@mark#2\pxabgs@mark\pxabgs@fin} + +%--------------------------------------- + +% concept: execute all hooks inside yoko direction \vbox + +% prepare +\let\pxabgs@AtBegShi@Output\AtBegShi@Output +% try first patch +\pxabgs@patch@cmd\pxabgs@AtBegShi@Output + {\let\AtBegShi@OrgProtect\protect}% + {\setbox8\vbox\bgroup\yoko\let\AtBegShi@OrgProtect\protect} +\ifx\pxabgs@fragment\relax % failure + \let\pxabgs@AtBegShi@Output\relax +\else % success, try second patch + \pxabgs@patch@cmd\pxabgs@AtBegShi@Output + {\AtBeginShipoutOriginalShipout\box\AtBeginShipoutBox}% + {\AtBeginShipoutOriginalShipout\box\AtBeginShipoutBox\egroup} + \ifx\pxabgs@fragment\relax % failure + \let\pxabgs@AtBegShi@Output\relax + \fi +\fi +% commit the change only when successful +\ifx\pxabgs@AtBegShi@Output\relax + \pxabgs@warn{Failed in patching \string\AtBegShi@Output} +\else + \global\let\AtBegShi@Output\pxabgs@AtBegShi@Output +\fi + +\endgroup +%% internal macros are no longer effective + +%--------------------------------------- done +\endinput +%% EOF diff --git a/Master/texmf-dist/tex/latex/platex-tools/pxgentombow.sty b/Master/texmf-dist/tex/latex/platex-tools/pxgentombow.sty index 834510c55b1..99eff83f22f 100644 --- a/Master/texmf-dist/tex/latex/platex-tools/pxgentombow.sty +++ b/Master/texmf-dist/tex/latex/platex-tools/pxgentombow.sty @@ -8,20 +8,27 @@ \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{pxgentombow} - [2017/07/23 v0.7 Generate crop mark 'tombow'] + [2017/12/17 v0.9 Generate crop mark 'tombow'] \def\pxgtmb@pkgname{pxgentombow} -%% error status -\chardef\pxgtmb@errlevel=\z@ +%% error status (shared with gentombow.sty) +\ifx\pxgtmb@errlevel\@undefined + \chardef\pxgtmb@errlevel=\z@ +\fi %% supported engines \ifx\pfmtversion\@undefined \@ifpackageloaded{luatexja}{}{\chardef\pxgtmb@errlevel=\@ne} \fi \ifnum\pxgtmb@errlevel>\z@ - \PackageError{\pxgtmb@pkgname}{% - Only pLaTeX, upLaTeX and LuaTeX-ja are supported now}\@ehc - \expandafter\endinput + \ifx\pxgtmb@emu@pkgname\@undefined % gentombow.sty not loaded + \PackageError{\pxgtmb@pkgname}{% + Only pLaTeX, upLaTeX and LuaTeX-ja are supported!\MessageBreak + Please use `gentombow' package instead}\@ehc + \expandafter\expandafter\expandafter\endinput\expandafter + \fi +\else + \@namedef{ver@gentombow.sty}{}% fake \fi %% import from jsclasses @@ -29,11 +36,23 @@ \@tempcnta\hour \multiply\@tempcnta 60\relax \minute\time \advance\minute-\@tempcnta +\ifnum\mag=\@m\else + % if BXjscls is detected and \mag != 1000, + % the layout will be definitely broken + \ifx\bxjs@param@mag\@undefined\else + \PackageError{\pxgtmb@pkgname}{% + It seems you are using Japanese `BXjscls'\MessageBreak + (bxjsarticle, bxjsbook, bxjsreport, etc.) or\MessageBreak + some derived class. Try adding `nomag' or\MessageBreak + `nomag*' to the class option list}\@ehc + \fi +\fi + %% this package will use tombo feature in pLaTeX kernel % if tombow-related option is not included in class option list, % show info and enable it now \iftombow\else - % if jsclasses is detected, it's too late + % if jsclasses is detected and \mag != 1000, it's too late % -- When a size option other than `10pt' is specified, % jsclasses uses \mag and calculates \oddsidemargin and \topmargin % differently, depending on tombow status. @@ -47,6 +66,7 @@ derived class. Please add `tombow' or `tombo'\MessageBreak to the class option list}\@ehc \fi \fi + % BXjscls is already checked above, no check here \PackageInfo\pxgtmb@pkgname{tombow feature enabled by \pxgtmb@pkgname} \fi \tombowtrue %\tombowdatetrue %% enabled by tombowdate option -- cgit v1.2.3