diff options
author | Karl Berry <karl@freefriends.org> | 2017-05-03 21:29:13 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-05-03 21:29:13 +0000 |
commit | 3ffb4c1426edf5831bcf0613d851e5e5eb734b79 (patch) | |
tree | 0b2cd2cfefc9907a4d1105c59e83a2cf86a2bcd2 /Master | |
parent | ae344469d5fb8eb60460be3f0769bb7b9bee7f0e (diff) |
bxpapersize (3may17)
git-svn-id: svn://tug.org/texlive/trunk@44174 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/latex/bxpapersize/README.md | 5 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/bxpapersize/bxpapersize.sty | 106 |
2 files changed, 103 insertions, 8 deletions
diff --git a/Master/texmf-dist/doc/latex/bxpapersize/README.md b/Master/texmf-dist/doc/latex/bxpapersize/README.md index cad12f7d8ed..197a407160d 100644 --- a/Master/texmf-dist/doc/latex/bxpapersize/README.md +++ b/Master/texmf-dist/doc/latex/bxpapersize/README.md @@ -103,6 +103,9 @@ The available keys are listed below: even if the stock paper size is available. - `{<width>,<height>}`: The output should be equal to the specified values. + - `<width>*<height>`: The alternative form of `{<width>,<height>}`. + It is provided because option strings including braces are not + permitted in the package option list. - `<papersize-name>`: The output should be equal to the given size. The set pf available paper-size names is the same as the [geometry package] and is listed below: @@ -130,6 +133,8 @@ but `\bxpapersizesetup` will be always provided. Revision History ---------------- + * Version 0.3a ‹2017/05/02› + - Support format `size=<width>*<height>` * Version 0.3 ‹2017/02/08› - As to `size=real`, the stock size becomes taken into account, and the new value `real*` is provided. diff --git a/Master/texmf-dist/tex/latex/bxpapersize/bxpapersize.sty b/Master/texmf-dist/tex/latex/bxpapersize/bxpapersize.sty index d5cd3b0d4b1..f765830dce3 100644 --- a/Master/texmf-dist/tex/latex/bxpapersize/bxpapersize.sty +++ b/Master/texmf-dist/tex/latex/bxpapersize/bxpapersize.sty @@ -1,8 +1,16 @@ -% bxpapersize.sty +%% +%% This is file 'bxpapersize.sty'. +%% +%% Copyright (c) 2017 Takayuki YATO (aka. "ZR") +%% GitHub: https://github.com/zr-tex8r +%% Twitter: @zr_tex8r +%% +%% This package is distributed under the MIT License. +%% %% package declaration \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{bxpapersize}[2017/02/08 v0.3] +\ProvidesPackage{bxpapersize}[2017/05/02 v0.3a] %% preparation \def\bxpr@pkgname{bxpapersize} @@ -51,6 +59,9 @@ \chardef\bxpr@mode@@dvimode=0 \chardef\bxpr@mode@@pdfmode=1 +%% unique tokens +\def\bxpr@end{\bxpr@end@} + %% \bxpr@pagewidth / \bxpr@pageheight %% \bxpr@horigin / \bxpr@vorigin \ifluatex % LuaTeX @@ -140,14 +151,14 @@ %% 'active' \define@boolkey+[bxpr]{prm}{active}[true]{}% - {\bxpr@ivval{active}{#1}} + {\bxpr@err@ivval{active}{#1}} \bxpr@prm@activetrue %% 'priority' \define@choicekey*+[bxpr]{prm}{priority}% {low,middle,default,high}% {\bxpr@set@priority{#1}}% - {\bxpr@ivval{priority}{#1}} + {\bxpr@err@ivval{priority}{#1}} \def\bxpr@set@priority#1{% \bxpr@csletcs{bxpr@priority}{bxpr@priority@@#1}} \AtBeginDocument{% @@ -157,12 +168,12 @@ %% 'truedimen' \define@boolkey+[bxpr]{prm}{truedimen}[true]% {\bxpr@needs@reset@sizetrue}% - {\bxpr@ivval{truedimen}{#1}} + {\bxpr@err@ivval{truedimen}{#1}} %% 'landscape' \define@boolkey+[bxpr]{prm}{landscape}[true]% {\bxpr@needs@reset@sizetrue}% - {\bxpr@ivval{landscape}{#1}} + {\bxpr@err@ivval{landscape}{#1}} %% 'size' \define@choicekey*+[bxpr]{prm}{size}[\bxpr@tmpa\bxpr@tmpb]% @@ -227,7 +238,9 @@ \def\noexpand\bxpr@cs@width{\the\@tempdima}% \def\noexpand\bxpr@cs@height{\the\@tempdimb}}}% \endgroup\bxpr@g@next}% - \bxpr@tmpa#1,,\@nil + \def\bxpr@tmpb{#1}% + \bxpr@set@size@star + \expandafter\bxpr@tmpa\bxpr@tmpb,,\@nil \let\bxpr@size\bxpr@size@@custom} \def\bxpr@set@size@a(#1,#2)#3{% \edef\bxpr@tmpa##1##2{% @@ -236,6 +249,10 @@ \bxpr@dima=\bxpr@tmpa{#1}{#2}\edef\bxpr@cs@width{\the\bxpr@dima}% \bxpr@dima=\bxpr@tmpa{#2}{#1}\edef\bxpr@cs@height{\the\bxpr@dima}% \let\bxpr@size\bxpr@size@@custom} +\def\bxpr@set@size@star{% + \expandafter\bxpr@set@size@star@a\bxpr@tmpb**\bxpr@end} +\def\bxpr@set@size@star@a#1*#2*#3\bxpr@end{% + \ifx*#2*\else \def\bxpr@tmpb{#1,#2}\fi} %--------------------------------------- user interface @@ -304,7 +321,7 @@ \bxpr@page@process \bxpr@modify@output@box\relax\bxpr@special@chunk}% \AtBeginShipout{\bxpr@every@page@hook}% - \or % higih + \or % high \AtBeginShipoutInit \def\bxpr@every@page@hook{% \bxpr@page@process @@ -437,6 +454,79 @@ \advance\bxpr@dima\dp\AtBeginShipoutBox \edef\bxpr@height{\the\bxpr@dima}} +%--------------------------------------- cope with tate-direction + +% In (u)pTeX engine, boxes and lists have the direction attribute, +% and yoko boxes cannot be unboxed in tate lists (and vice versa). +% This restriction can cause the atbegshi package to fail, and thus +% the 'priority=low' setting results in an error when used together +% with document classes of tate direction. + +% if '\tate' is invalid then quit now +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname tate\endcsname\relax +\expandafter\endinput\fi\relax + +% if priority is middle then quit +\ifnum\bxpr@priority=\bxpr@priority@@default +\expandafter\endinput\fi\relax + +% check in advance +\ifx\AtBegShi@Output\@undefined + \PackageWarningNoLine\bxpr@pkgname + {The patch to atbegshi failed, so\MessageBreak + the package might not work well} +\expandafter\endinput\fi\relax + +%% \ifbxpr@ddir +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname ifddir\endcsname\relax + \bxpr@csletcs{ifbxpr@ddir}{iffalse} +\else + \bxpr@csletcs{ifbxpr@ddir}{ifddir} +\fi + +%% \bxpr@patch +% Patches the internal macro \AtBegShi@Output of atbegshi package, +% so that the macro is prepended by a `\yoko` primitive and appended +% by a direction primitive to switch back to the original. +\@onlypreamble\bxpr@patch +\def\bxpr@patch{% + \expandafter\bxpr@patch@a\AtBegShi@Output\bxpr@end} +\@onlypreamble\bxpr@patch@a +\def\bxpr@patch@a{% + \futurelet\bxpr@tok\bxpr@patch@b} +\@onlypreamble\bxpr@patch@b +\def\bxpr@patch@b{% + \ifx\bxpr@tok\egroup \expandafter\@firstoftwo + \else \expandafter\@secondoftwo + \fi{\bxpr@patch@c}{\bxpr@patch@d{}}} +\@onlypreamble\bxpr@patch@c +\def\bxpr@patch@c#1#2{% + \bxpr@patch@d{#1#2}} +\@onlypreamble\bxpr@patch@d +\def\bxpr@patch@d#1#2\bxpr@end{% + \def\AtBegShi@Output{#1\bxpr@ABS@prehook#2\bxpr@ABS@posthook}} +% do patch +\bxpr@patch + +%% \bxpr@restore@dir +\let\bxpr@restore@dir\relax + +%% \bxpr@ABS@prehook +\def\bxpr@ABS@prehook{% + \iftdir \yoko \let\bxpr@restore@dir\tate + \else\ifbxpr@ddir \yoko \let\bxpr@restore@dir\dtou + \else \let\bxpr@restore@dir\relax + \fi\fi + \ifx\bxpr@restore@dir\relax\else + \bxDebug{Temporarily switching \meaning\bxpr@restore@dir + \space to \string\yoko}% + \fi} +%% \bxpr@ABS@posthook +\def\bxpr@ABS@posthook{% + \bxpr@restore@dir} + %--------------------------------------- all done \endinput %% EOF |