summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-03-26 22:58:03 +0000
committerKarl Berry <karl@freefriends.org>2016-03-26 22:58:03 +0000
commit2b56a74387e573d8a12780426359199e69265e5f (patch)
tree0b1d4cf6421d15ede4db24d04e9f4a630fec527b /Master/texmf-dist
parent9fb1a6c3b6f3b49db9c3f5a959dc2cc5ec663ecf (diff)
bxpapersize (26mar16)
git-svn-id: svn://tug.org/texlive/trunk@40149 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r--Master/texmf-dist/doc/latex/bxpapersize/LICENSE27
-rw-r--r--Master/texmf-dist/doc/latex/bxpapersize/README.md89
-rw-r--r--Master/texmf-dist/tex/latex/bxpapersize/bxpapersize.sty313
3 files changed, 429 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/bxpapersize/LICENSE b/Master/texmf-dist/doc/latex/bxpapersize/LICENSE
new file mode 100644
index 00000000000..49f803e083e
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/bxpapersize/LICENSE
@@ -0,0 +1,27 @@
+$BK\%=%U%H%&%'%"$O(B MIT $B%i%$%;%s%9$N2<$GG[I[$5$l$^$9!#(B
+$BCx:n8"$O:n<T$G$"$k!VH,EP(B $B?rG7!JJLL>(B ZR$B!K!W$KB0$7$^$9!#(B
+$B$^$?K\%=%U%H%&%'%"$OL5J]>Z$G$9!#(B
+
+This software is distributed under the MIT License.
+
+The MIT License
+
+Copyright (c) 2016 Takayuki YATO (aka. "ZR")
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/Master/texmf-dist/doc/latex/bxpapersize/README.md b/Master/texmf-dist/doc/latex/bxpapersize/README.md
new file mode 100644
index 00000000000..f884ec0f5fa
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/bxpapersize/README.md
@@ -0,0 +1,89 @@
+BXpapersize Package
+===================
+
+LaTeX: To synchronize output paper size with layout paper size
+
+As is well known, in LaTeX processing layout paper size specified by
+document class options is not automatically applied to output paper
+size. This package enables LaTeX authors to synchronize both kinds of
+paper sizes.
+
+### System requirement
+
+ * TeX format: LaTeX.
+ * TeX engine: Anything.
+ * DVI driver (in DVI mode): dvips, dvipdfmx, or whatever supports
+ ‘papersize’ special.
+ * Dependent packages:
+ - ifpdf, ifxetex, ifluatex, ifvtex
+ - xkeyval
+ - atbegshi
+
+### Installation
+
+ - `*.sty` → $TEXMF/tex/latex/BXpapersize
+
+### License
+
+This package is distributed under the MIT License.
+
+The bxpapersize Package
+-----------------------
+
+### Package Loading
+
+ \usepackage[<option>,...]{bxpapersize}
+
+The available options are described hereafter.
+
+#### Annihilation
+
+ * `disabled`: Disables all functionality of this package. It may be
+ useful to resolve conflict caused by some packages depending on
+ the bxpapersize package. Note that once `disabled` is used there
+ is no way to enable the functionality.
+
+
+#### Priority
+
+ * `priority=<value>`: In DVI mode, this decides the priority of the
+ ‘papersize’ specials issued by this package relative to the
+ ‘papersize’ specials issued by others.
+ The set of valid values is:
+ - `low`: Priotizes specials by others.
+ - `middle` (default): Does not care about priority.
+ - `high`: Priotizes specials by this package.
+
+#### Other options
+
+Any key-value pairs that are valid in `\bxpapersizesetup` can be used
+as package options.
+
+ % to begin with deactivated state
+ \usepackage[active=false]{bxpapersize}
+
+### Usage
+
+You can change the settings of this package using `\bxpapersizesetup`
+command, invoked as follows:
+
+ \bxpapersizesetup[<key>=<value>,...]
+
+The available keys are listed below:
+
+ * `active=true|false`: Temporarily activates/deactivates the function
+ of this package. Note that, however, what happens about paper size
+ synchronization when activation settings are changed in the midst
+ of documents differs among TeX engines and/or DVI drivers. Thus
+ this should be employed only by advanced users.
+
+
+Revision History
+----------------
+
+ * Version 0.2 ‹2016/03/26›
+ - The first public version.
+
+--------------------
+Takayuki YATO (aka. "ZR")
+http://zrbabbler.sp.land.to/
diff --git a/Master/texmf-dist/tex/latex/bxpapersize/bxpapersize.sty b/Master/texmf-dist/tex/latex/bxpapersize/bxpapersize.sty
new file mode 100644
index 00000000000..e15bf32cc84
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/bxpapersize/bxpapersize.sty
@@ -0,0 +1,313 @@
+% bxpapersize.sty
+
+%% package declaration
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{bxpapersize}[2016/03/26 v0.2]
+
+%% preparation
+\def\bxpr@pkgname{bxpapersize}
+\providecommand\bxDebug[1]{}
+
+%--------------------------------------- options
+
+%% 'disabled'
+\chardef\bxpr@disabled=0
+\DeclareOption{disabled}{%
+ \chardef\bxpr@disabled=1 }
+%% keyval
+\@onlypreamble\bxpr@kvopt
+\let\bxpr@kvopt\@empty
+\DeclareOption*{%
+ \edef\bxpr@kvopt{\bxpr@kvopt,\CurrentOption}}
+\ProcessOptions*
+
+%% If 'disabled' is given, quit now.
+\ifnum\bxpr@disabled>\z@
+ \newcommand*\bxpapersizesetup[1]{}%
+\expandafter\endinput\fi\relax
+
+%--------------------------------------- general
+
+%% load packages
+\RequirePackage{xkeyval}
+\RequirePackage{atbegshi}
+\RequirePackage{ifpdf,ifxetex,ifluatex,ifvtex}
+
+%% variables
+\newdimen\bxpr@dima
+\newif\ifbxpr@active
+\let\bxpr@width\relax
+\let\bxpr@height\relax
+
+%% constants
+\chardef\bxpr@mode@@dvimode=0
+\chardef\bxpr@mode@@pdfmode=1
+
+%% \bxpr@pagewidth / \bxpr@pageheight
+%% \bxpr@horigin / \bxpr@vorigin
+\ifluatex % LuaTeX
+ \ifx\pagewidth\@undefined % old version
+ \let\bxpr@pagewidth\pdfpagewidth
+ \let\bxpr@pageheight\pdfpageheight
+ \else % new version
+ \let\bxpr@pagewidth\pagewidth
+ \let\bxpr@pageheight\pageheight
+ \fi
+ \ifx\pdfvariable\@undefined % old version
+ \let\bxpr@horigin\pdfhorigin
+ \let\bxpr@vorigin\pdfvorigin
+ \else % new version
+ \edef\bxpr@horigin{\pdfvariable horigin}
+ \edef\bxpr@vorigin{\pdfvariable vorigin}
+ \fi
+\else\ifxetex % XeTeX
+ % treated as dvi-mode
+\else\ifvtex % VTeX
+ \let\bxpr@pagewidth\mediawidth
+ \let\bxpr@pageheight\mediaheight
+\else\ifpdf % pdfTeX in PDF mode
+ \let\bxpr@pagewidth\pdfpagewidth
+ \let\bxpr@pageheight\pdfpageheight
+ \let\bxpr@horigin\pdfhorigin
+ \let\bxpr@vorigin\pdfvorigin
+\fi\fi\fi\fi
+\ifx\bxpr@horigin\@undefined % fallback
+ \def\bxpr@horigin{1truein }
+ \def\bxpr@vorigin{1truein }
+\fi
+
+%% \bxpr@mode
+\ifx\bxpr@pagewidth\@undefined
+ \let\bxpr@mode\bxpr@mode@@dvimode
+\else
+ \let\bxpr@mode\bxpr@mode@@pdfmode
+\fi
+
+%--------------------------------------- parameters
+
+%% constants
+\chardef\bxpr@priority@@low=0
+\chardef\bxpr@priority@@middle=1
+\chardef\bxpr@priority@@high=2
+\chardef\bxpr@size@@real=0 %'real', use \paperwidth/height
+\chardef\bxpr@size@@box=1 %'box', use shipout box size
+\chardef\bxpr@size@@boxS=2 %'box*'
+\chardef\bxpr@size@@custom=3 % size explicitly given
+
+%% variables
+\let\bxpr@priority\bxpr@priority@@middle
+\let\bxpr@size\bxpr@size@@real
+\def\bxpr@cs@width{\z@}% custom page width
+\def\bxpr@cs@height{\z@}% custom page height
+
+%% error message
+\def\bxpr@err@nlprm#1{%
+ \PackageError\bxpr@pkgname
+ {You can set '#1' only in preamble}%
+ \@ehc}
+\def\bxpr@err@ivval#1#2{%
+ \PackageError\bxpr@pkgname
+ {Invalid value for '#1': #2}%
+ \@ehc}
+
+%% 'active'
+\define@boolkey+{bxpr}{active}%
+ {\@nameuse{bxpr@active#1}}%
+ {\bxpr@ivval{active}{#1}}
+\bxpr@activetrue
+
+%% 'priority'
+\define@choicekey*+{bxpr}{priority}[\bxpr@tmpa\bxpr@tmpb]%
+ {low,middle,high}%
+ {\bxpr@set@priority}%
+ {\bxpr@ivval{priority}{#1}}
+\def\bxpr@set@priority{%
+ \chardef\bxpr@priority\bxpr@tmpb\relax}
+\AtBeginDocument{%
+ \def\bxpr@set@priority{\bxpr@err@nlprm{priority}}}
+
+%% 'size'
+\define@choicekey*+{bxpr}{size}[\bxpr@tmpa\bxpr@tmpb]%
+ {real,box,box*}%
+ {\chardef\bxpr@size\bxpr@tmpb\relax}%
+ {% custom page size ('size={<width>,<height>}')
+ \def\bxpr@tmpa##1,##2,##3\@nil{%
+ \begingroup\setbox\z@\hbox{%
+ \@tempdima##1\relax \@tempdimb##2\relax
+ \xdef\bxpr@g@next{%
+ \def\noexpand\bxpr@cs@width{\the\@tempdima}%
+ \def\noexpand\bxpr@cs@height{\the\@tempdimb}}}%
+ \endgroup\bxpr@g@next}%
+ \bxpr@tmpa#1,,\@nil
+ \let\bxpr@size\bxpr@size@@custom}
+
+%% apply package options
+\edef\bxpr@tmpa{%
+ \noexpand\setkeys{bxpr}{\bxpr@kvopt}%
+}\bxpr@tmpa
+
+%--------------------------------------- user interface
+
+%%<*> \bxpapersizesetup{<key>=<value>,...}
+\newcommand*\bxpapersizesetup[1]{%
+ \setkeys{bxpr}{#1}}
+
+%--------------------------------------- page hook
+
+%% \bxpr@begindoc@first@hook
+% Placed at the head of the begin-docuemnt hook.
+\@onlypreamble\bxpr@begindoc@first@hook
+\let\bxpr@begindoc@first@hook\@empty
+\begingroup
+ \toks@\expandafter{\@begindocumenthook}
+ \xdef\@begindocumenthook{%
+ \noexpand\bxpr@begindoc@first@hook
+ \the\toks@}
+\endgroup
+
+%% \bxpr@begindoc@second@hook
+% Placed after the begin-docuemnt hook.
+\def\bxpr@begindoc@second@hook{%
+ \let\bxpr@begindoc@second@hook\@undefined}
+\g@addto@macro\document{%
+ \bxpr@begindoc@second@hook}
+
+%% add hook for every page
+\g@addto@macro\bxpr@begindoc@first@hook{%
+ \bxDebug{bxpapersize settings:^^J%
+ mode=\the\bxpr@mode^^J%
+ prioity=\the\bxpr@priority^^J%
+ size=\the\bxpr@size}%
+ \bxpr@geometry@hack
+ \ifcase\bxpr@mode % dvi
+ \ifcase\bxpr@priority % low
+ \AtBeginShipoutInit
+ \def\bxpr@every@page@hook{%
+ \bxpr@page@process
+ \bxpr@modify@output@box\bxpr@special@chunk\relax
+ \AtBeginShipoutNext{\bxpr@every@page@hook}}%
+ \AtBeginShipoutNext{%
+ \bxpr@page@process
+ \AtBeginShipoutNext{\bxpr@every@page@hook}}%
+ \AtBeginShipoutFirst{\bxpr@special@chunk}
+ \or % middle
+ \def\bxpr@every@page@hook{%
+ \bxpr@page@process
+ \bxpr@modify@output@box\relax\bxpr@special@chunk}%
+ \AtBeginShipout{\bxpr@every@page@hook}%
+ \or % higih
+ \AtBeginShipoutInit
+ \def\bxpr@every@page@hook{%
+ \bxpr@page@process
+ \bxpr@modify@output@box\relax\bxpr@special@chunk
+ \AtBeginShipoutNext{\bxpr@every@page@hook}}%
+ \AtBeginShipoutNext{\bxpr@every@page@hook}%
+ \fi
+ \else % pdf
+ \def\bxpr@every@page@hook{%
+ \bxpr@page@process
+ \bxpr@modify@output@box\relax\bxpr@special@chunk}%
+ \AtBeginShipout{\bxpr@every@page@hook}%
+ \fi}
+
+%% \bxpr@modify@output@box
+\def\bxpr@modify@output@box#1#2{%
+ \setbox\AtBeginShipoutBox\vbox{%
+ #1\box\AtBeginShipoutBox#2}}
+
+%--------------------------------------- geometry hack
+
+% The geometry package sets \paperwidth/height to incorrect
+% values after its begin-document hook when magnification is
+% in effect. For example, when \mag=2000 and the actual paper
+% width is 100pt (=200truept), geometry will set \paperwidth
+% to 200pt (=400truept), which is clearly incorrect.
+% This behavior seems intentional, but I don't know the reason.
+% At least it is harmful to the function of this package, so
+% that I fixed it by simply revoking the change by geometry.
+
+%% \bxpr@geometry@hack
+\@onlypreamble\bxpr@geometry@hack
+\def\bxpr@geometry@hack{%
+ \@ifpackageloaded{geometry}{%
+ \edef\bxpr@tmpa{%
+ \paperwidth=\the\paperwidth
+ \paperheight=\the\paperheight}%
+ \expandafter\g@addto@macro\expandafter\bxpr@begindoc@second@hook
+ \expandafter{\bxpr@tmpa}%
+ }{}}
+
+%--------------------------------------- per-page process
+
+%% \bxpr@special@chunk
+\let\bxpr@special@chunk\@empty
+
+%% \bxpr@set@page@size{<width>}{<height>}
+\ifcase\bxpr@mode %dvi
+ \def\bxpr@set@page@size#1#2{%
+ \bxpr@dima=#1\relax \edef\bxpr@tmpb{\the\bxpr@dima}%
+ \bxpr@dima=#2\relax \edef\bxpr@tmpb{\bxpr@tmpb,\the\bxpr@dima}%
+ \bxDebug{papersize=\bxpr@tmpb}%
+ \edef\bxpr@special@chunk{\special{papersize=\bxpr@tmpb}}}%
+\else %pdf
+ \def\bxpr@set@page@size#1#2{%
+ \bxpr@pagewidth=#1\relax \bxpr@pageheight=#2\relax
+ \bxDebug{papersize=\the\bxpr@pagewidth,\the\bxpr@pageheight}}%
+\fi
+
+%% \bxpr@page@process
+\def\bxpr@page@process{%
+ \ifbxpr@active
+ \bxpr@page@process@a
+ \fi}
+\def\bxpr@page@process@a{%
+ \ifcase\bxpr@size % real
+ \ifcase\bxpr@mode % dvi
+ \ifnum\mag=\@m
+ \bxpr@set@page@size{\paperwidth}{\paperheight}%
+ \else
+ \bxpr@apply@mag
+ \bxpr@set@page@size{\bxpr@width}{\bxpr@height}%
+ \fi
+ \or % pdf
+ \bxpr@set@page@size{\paperwidth}{\paperheight}%
+ \fi
+ \or % box
+ \bxpr@use@box@size
+ \setbox\AtBeginShipoutBox\vbox{%
+ \kern-\bxpr@vorigin
+ \moveleft\bxpr@horigin\box\AtBeginShipoutBox}%
+ \bxpr@set@page@size{\bxpr@width}{\bxpr@height}%
+ \or % box*
+ \bxpr@use@box@size
+ \bxpr@set@page@size{\bxpr@width}{\bxpr@height}%
+ \else % custom
+ \bxpr@set@page@size{\bxpr@cs@width}{\bxpr@cs@height}%
+ \fi}
+
+%% \bxpr@apply@mag
+\def\bxpr@apply@mag{%
+ \begingroup
+ \ifnum\mag=\@m\else
+ \@tempcnta=\mag \advance\@tempcnta100000
+ \def\bxpr@next1##1##2##3##4##5\relax{%
+ \def\bxpr@tmpa{##1##2.##3##4##5}}%
+ \expandafter\bxpr@next\the\@tempcnta\relax
+ \paperwidth=\bxpr@tmpa\paperwidth
+ \paperheight=\bxpr@tmpa\paperheight
+ \fi
+ \xdef\bxpr@g@next{%
+ \def\noexpand\bxpr@width{\the\paperwidth}%
+ \def\noexpand\bxpr@height{\the\paperheight}}%
+ \endgroup \bxpr@g@next}
+
+%% \bxpr@use@box@size
+\def\bxpr@use@box@size{%
+ \edef\bxpr@width{\the\wd\AtBeginShipoutBox}%
+ \bxpr@dima\ht\AtBeginShipoutBox
+ \advance\bxpr@dima\dp\AtBeginShipoutBox
+ \edef\bxpr@height{\the\bxpr@dima}}
+
+%--------------------------------------- all done
+\endinput
+%% EOF