texlive[44174] Master/texmf-dist: bxpapersize (3may17)
commits+karl at tug.org
commits+karl at tug.org
Wed May 3 23:29:13 CEST 2017
Revision: 44174
http://tug.org/svn/texlive?view=revision&revision=44174
Author: karl
Date: 2017-05-03 23:29:13 +0200 (Wed, 03 May 2017)
Log Message:
-----------
bxpapersize (3may17)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/bxpapersize/README.md
trunk/Master/texmf-dist/tex/latex/bxpapersize/bxpapersize.sty
Modified: trunk/Master/texmf-dist/doc/latex/bxpapersize/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/bxpapersize/README.md 2017-05-03 21:29:00 UTC (rev 44173)
+++ trunk/Master/texmf-dist/doc/latex/bxpapersize/README.md 2017-05-03 21:29:13 UTC (rev 44174)
@@ -103,6 +103,9 @@
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 @@
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.
Modified: trunk/Master/texmf-dist/tex/latex/bxpapersize/bxpapersize.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/bxpapersize/bxpapersize.sty 2017-05-03 21:29:00 UTC (rev 44173)
+++ trunk/Master/texmf-dist/tex/latex/bxpapersize/bxpapersize.sty 2017-05-03 21:29:13 UTC (rev 44174)
@@ -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 at pkgname{bxpapersize}
@@ -51,6 +59,9 @@
\chardef\bxpr at mode@@dvimode=0
\chardef\bxpr at mode@@pdfmode=1
+%% unique tokens
+\def\bxpr at end{\bxpr at end@}
+
%% \bxpr at pagewidth / \bxpr at pageheight
%% \bxpr at horigin / \bxpr at vorigin
\ifluatex % LuaTeX
@@ -140,7 +151,7 @@
%% 'active'
\define at boolkey+[bxpr]{prm}{active}[true]{}%
- {\bxpr at ivval{active}{#1}}
+ {\bxpr at err@ivval{active}{#1}}
\bxpr at prm@activetrue
%% 'priority'
@@ -147,7 +158,7 @@
\define at choicekey*+[bxpr]{prm}{priority}%
{low,middle,default,high}%
{\bxpr at set@priority{#1}}%
- {\bxpr at ivval{priority}{#1}}
+ {\bxpr at err@ivval{priority}{#1}}
\def\bxpr at set@priority#1{%
\bxpr at csletcs{bxpr at priority}{bxpr at priority@@#1}}
\AtBeginDocument{%
@@ -157,12 +168,12 @@
%% 'truedimen'
\define at boolkey+[bxpr]{prm}{truedimen}[true]%
{\bxpr at needs@reset at sizetrue}%
- {\bxpr at ivval{truedimen}{#1}}
+ {\bxpr at err@ivval{truedimen}{#1}}
%% 'landscape'
\define at boolkey+[bxpr]{prm}{landscape}[true]%
{\bxpr at needs@reset at sizetrue}%
- {\bxpr at ivval{landscape}{#1}}
+ {\bxpr at err@ivval{landscape}{#1}}
%% 'size'
\define at choicekey*+[bxpr]{prm}{size}[\bxpr at tmpa\bxpr at tmpb]%
@@ -227,7 +238,9 @@
\def\noexpand\bxpr at cs@width{\the\@tempdima}%
\def\noexpand\bxpr at cs@height{\the\@tempdimb}}}%
\endgroup\bxpr at g@next}%
- \bxpr at tmpa#1,,\@nil
+ \def\bxpr at tmpb{#1}%
+ \bxpr at set@size at star
+ \expandafter\bxpr at tmpa\bxpr at tmpb,,\@nil
\let\bxpr at size\bxpr at size@@custom}
\def\bxpr at set@size at a(#1,#2)#3{%
\edef\bxpr at tmpa##1##2{%
@@ -236,6 +249,10 @@
\bxpr at dima=\bxpr at tmpa{#1}{#2}\edef\bxpr at cs@width{\the\bxpr at dima}%
\bxpr at dima=\bxpr at tmpa{#2}{#1}\edef\bxpr at cs@height{\the\bxpr at dima}%
\let\bxpr at size\bxpr at size@@custom}
+\def\bxpr at set@size at star{%
+ \expandafter\bxpr at set@size at star@a\bxpr at tmpb**\bxpr at end}
+\def\bxpr at set@size at star@a#1*#2*#3\bxpr at end{%
+ \ifx*#2*\else \def\bxpr at tmpb{#1,#2}\fi}
%--------------------------------------- user interface
@@ -304,7 +321,7 @@
\bxpr at page@process
\bxpr at modify@output at box\relax\bxpr at special@chunk}%
\AtBeginShipout{\bxpr at every@page at hook}%
- \or % higih
+ \or % high
\AtBeginShipoutInit
\def\bxpr at every@page at hook{%
\bxpr at page@process
@@ -437,6 +454,79 @@
\advance\bxpr at dima\dp\AtBeginShipoutBox
\edef\bxpr at height{\the\bxpr at 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 at priority=\bxpr at priority@@default
+\expandafter\endinput\fi\relax
+
+% check in advance
+\ifx\AtBegShi at Output\@undefined
+ \PackageWarningNoLine\bxpr at pkgname
+ {The patch to atbegshi failed, so\MessageBreak
+ the package might not work well}
+\expandafter\endinput\fi\relax
+
+%% \ifbxpr at ddir
+\begingroup\expandafter\expandafter\expandafter\endgroup
+\expandafter\ifx\csname ifddir\endcsname\relax
+ \bxpr at csletcs{ifbxpr at ddir}{iffalse}
+\else
+ \bxpr at csletcs{ifbxpr at ddir}{ifddir}
+\fi
+
+%% \bxpr at patch
+% Patches the internal macro \AtBegShi at 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 at patch
+\def\bxpr at patch{%
+ \expandafter\bxpr at patch@a\AtBegShi at Output\bxpr at end}
+\@onlypreamble\bxpr at patch@a
+\def\bxpr at patch@a{%
+ \futurelet\bxpr at tok\bxpr at patch@b}
+\@onlypreamble\bxpr at patch@b
+\def\bxpr at patch@b{%
+ \ifx\bxpr at tok\egroup \expandafter\@firstoftwo
+ \else \expandafter\@secondoftwo
+ \fi{\bxpr at patch@c}{\bxpr at patch@d{}}}
+\@onlypreamble\bxpr at patch@c
+\def\bxpr at patch@c#1#2{%
+ \bxpr at patch@d{#1#2}}
+\@onlypreamble\bxpr at patch@d
+\def\bxpr at patch@d#1#2\bxpr at end{%
+ \def\AtBegShi at Output{#1\bxpr at ABS@prehook#2\bxpr at ABS@posthook}}
+% do patch
+\bxpr at patch
+
+%% \bxpr at restore@dir
+\let\bxpr at restore@dir\relax
+
+%% \bxpr at ABS@prehook
+\def\bxpr at ABS@prehook{%
+ \iftdir \yoko \let\bxpr at restore@dir\tate
+ \else\ifbxpr at ddir \yoko \let\bxpr at restore@dir\dtou
+ \else \let\bxpr at restore@dir\relax
+ \fi\fi
+ \ifx\bxpr at restore@dir\relax\else
+ \bxDebug{Temporarily switching \meaning\bxpr at restore@dir
+ \space to \string\yoko}%
+ \fi}
+%% \bxpr at ABS@posthook
+\def\bxpr at ABS@posthook{%
+ \bxpr at restore@dir}
+
%--------------------------------------- all done
\endinput
%% EOF
More information about the tex-live-commits
mailing list