summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-03-26 22:57:34 +0000
committerKarl Berry <karl@freefriends.org>2016-03-26 22:57:34 +0000
commit9fb1a6c3b6f3b49db9c3f5a959dc2cc5ec663ecf (patch)
treec0af2de6d7959e615f20394a819b6b275f978c03 /Master/texmf-dist
parentdb21d9213462b72292fcd4ebd457a6420770f4cd (diff)
bxdvidriver (26mar16)
git-svn-id: svn://tug.org/texlive/trunk@40148 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r--Master/texmf-dist/doc/latex/bxdvidriver/LICENSE27
-rw-r--r--Master/texmf-dist/doc/latex/bxdvidriver/README.md102
-rw-r--r--Master/texmf-dist/tex/latex/bxdvidriver/bxdvidriver.sty258
3 files changed, 387 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/bxdvidriver/LICENSE b/Master/texmf-dist/doc/latex/bxdvidriver/LICENSE
new file mode 100644
index 00000000000..49f803e083e
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/bxdvidriver/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/bxdvidriver/README.md b/Master/texmf-dist/doc/latex/bxdvidriver/README.md
new file mode 100644
index 00000000000..3e85864b83e
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/bxdvidriver/README.md
@@ -0,0 +1,102 @@
+BXdvidriver Package
+===================
+
+LaTeX: To specify a driver option effective only in DVI output
+
+This single-function package enables authors to specify a global
+driver option (dvips, dvipdfmx, etc) which is applied only when the
+engine outputs a DVI file. It is useful to create special document-
+templates that can be compiled in both PDF-mode and DVI-mode.
+
+### System requirement
+
+ * TeX format: LaTeX.
+ * TeX engine: Anything.
+ * Dependent packages:
+ - ifpdf, ifluatex, ifxetex, ifvtex
+ - pdftexcmds
+
+### Installation
+
+ - `*.sty` → $TEXMF/tex/latex/BXdvidriver
+
+### License
+
+This package is distributed under the MIT License.
+
+The bxdvidriver Package
+-----------------------
+
+### Package Loading
+
+ \usepackage[<option>,...]{bxdvidriver}
+
+The available options are described hereafter.
+
+#### Driver options
+
+The following driver options are available:
+
+ dvips,xdvi,dvipdf,dvipdfm,dvipdfmx,dvipsone
+ dviwindo,oztex,textures,pctexps,pctex32
+
+Suppose the document begins with:
+
+ \documentclass[a4paper]{article}
+ \usepackage[dvipdfmx]{bxdvidriver}
+ \usepackage{graphicx,color}
+
+If the document is compiled with pdflatex (or xelatex, lualatex), then
+the package does nothing and the driver option `dvipdfmx` is simply
+ignored.
+
+However, if the document is compiled with latex (or any other engine
+that outputs DVI files), then the package adds the given driver option
+`dvipdfmx` to the global option list, and makes the settings effectively
+the same as the following:
+
+ \documentclass[a4paper,dvipdfmx]{article}
+ \usepackage{graphicx,color}
+
+The driver option is globally in effect, and thus the packages graphicx
+and color will choose the driver for dvipdfmx.
+
+*Note.* Some care must be taken when the document class itself has some
+driver-dependent behavior. In that case, simply loading bxdvidriver
+after `\documentclass` would leave its driver option unapplied to the
+document class. Instead, you must load the bxdvidriver package *before*
+`\documentclass` with `\RequirePackage` command.
+
+ \RequirePackage[dvipdfmx]{bxdvidriver}
+ \documentclass[a4paper]{some-fancy-class}
+ \usepackage{graphicx,color}
+
+#### Other options
+
+This package is essentially single-function, but as side effect it also
+checks some integrity on driver settings:
+
+ * whether (at most) one driver option is given;
+ * whether the driver matches the (PDF-output) engine;
+ * whether (at most) one graphics driver is loaded.
+
+By default, an error is issued when any check fails. But the behavior
+can be changed by options.
+
+ * `check` (default): Check failure issues an error.
+ * `nocheck`: Check failure does not issue an error.
+
+### Usage
+
+This package offers no user commands or environments. All the settings
+are done by package options.
+
+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/bxdvidriver/bxdvidriver.sty b/Master/texmf-dist/tex/latex/bxdvidriver/bxdvidriver.sty
new file mode 100644
index 00000000000..a8ea0748acf
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/bxdvidriver/bxdvidriver.sty
@@ -0,0 +1,258 @@
+% bxdvidriver.sty
+
+%% package declaration
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{bxdvidriver}[2016/03/26 v0.2]
+
+%% preparation
+\def\bxdd@pkgname{bxdvidriver}
+\providecommand\bxDebug[1]{}
+
+%--------------------------------------- general
+
+%% \bxdd@dvi@driver@list
+% List of dvi-driver names.
+\@onlypreamble\bxdd@dvi@driver@list
+\def\bxdd@dvi@driver@list{%
+ dvips,xdvi,dvipdf,dvipdfm,dvipdfmx,dvipsone,%
+ dviwindo,oztex,textures,pctexps,pctex32}
+%% \bxdd@pdf@driver@list
+% List of pdf-driver names.
+\@onlypreamble\bxdd@pdf@driver@list
+\def\bxdd@pdf@driver@list{%
+ pdftex,xetex,luatex,vtex}
+
+%% packages
+\RequirePackage{ifpdf,ifxetex,ifluatex,ifvtex}
+\RequirePackage{pdftexcmds}
+
+%% variables
+\newif\ifbxdd@ok
+\@onlypreamble\bxdd@driver
+\let\bxdd@driver\relax
+\@onlypreamble\bxdd@pdf@driver
+\let\bxdd@pdf@driver\relax
+
+%% \[bxdd@T/<driver>]
+\@for\bxdd@x:=\bxdd@dvi@driver@list\do{%
+ \expandafter\let\csname bxdd@T/\bxdd@x\endcsname=d}
+\@for\bxdd@x:=\bxdd@pdf@driver@list\do{%
+ \expandafter\let\csname bxdd@T/\bxdd@x\endcsname=p}
+
+%% \bxdd@detokenize\CS
+\def\bxdd@detokenize#1{%
+ \expandafter\bxdd@detokenize@a\meaning#1\relax#1}
+\def\bxdd@detokenize@a#1>#2\relax#3{%
+ \def#3{#2}}
+
+%--------------------------------------- options
+
+%% 'check'/'nocheck'
+\newif\ifbxdd@check \bxdd@checktrue
+\DeclareOption{check}{%
+ \bxdd@checktrue}
+\DeclareOption{nocheck}{%
+ \bxdd@checkfalse}
+%% drivers
+\DeclareOption*{%
+ \expandafter\let\expandafter\bxdd@tmpa
+ \csname bxdd@T/\CurrentOption\endcsname
+ \ifx\bxdd@tmpa\relax
+ \PackageError\bxdd@pkgname
+ {Unknown driver name '\CurrentOption' found}%
+ {The invalid option is ignored.\MessageBreak\@ehc}
+ \else\ifx\bxdd@driver\relax
+ \let\bxdd@driver\CurrentOption
+ \else\ifx\bxdd@driver\CurrentOption
+ \PackageInfo\bxdd@pkgname
+ {Redundant driver option '\CurrentOption',\MessageBreak
+ found}%
+ \else
+ \PackageError\bxdd@pkgname
+ {Multiple driver options are given\MessageBreak
+ ('\bxdd@driver' and '\CurrentOption')}%
+ {The extra option '\CurrentOption' is ignored.\MessageBreak\@ehc}
+ \fi\fi\fi}
+%%
+\ProcessOptions*
+
+%% check consistency
+\ifx\bxdd@driver\relax
+ \PackageInfo\bxdd@pkgname
+ {No driver option given,}
+\else\expandafter\ifx\csname bxdd@T/\bxdd@driver\endcsname p%
+ \PackageWarning\bxdd@pkgname
+ {The driver '\bxdd@driver' is a pdf-mode driver and\MessageBreak
+ inappropriate for this package,}
+\else\bxDebug{driver=\bxdd@driver}
+\fi\fi
+
+%--------------------------------------- pdf-mode detection
+
+%% check 'pdfmode'
+\bxdd@oktrue
+\ifluatex
+ \let\bxdd@tmpa\m@ne
+ \pdf@isprimitive\outputmode\outputmode{\let\bxdd@tmpa\outputmode}{}
+ \pdf@isprimitive\pdfoutput\pdfoutput{\let\bxdd@tmpa\pdfoutput}{}
+ \ifnum\bxdd@tmpa>\z@
+ \def\bxdd@pdf@driver{luatex}%
+ \else\ifnum\bxdd@tmpa<\z@
+ \PackageError\bxdd@pkgname
+ {INTERNAL ERROR (1)}
+ {Package loading is aborted.\MessageBreak\@ehc}
+ \bxdd@okfalse
+ \fi\fi
+\else\ifxetex
+ \def\bxdd@pdf@driver{xetex}
+\else\ifvtex
+ \def\bxdd@pdf@driver{vtex}
+\else\ifpdf
+ \def\bxdd@pdf@driver{pdftex}
+\fi\fi\fi\fi
+\ifbxdd@ok\else
+\expandafter\endinput\fi\relax
+
+\ifx\bxdd@pdf@driver\relax\else
+ \PackageInfo\bxdd@pkgname
+ {Driver option '\bxdd@driver' is ignored, because\MessageBreak
+ the engine is in pdf-mode,}
+ \let\bxdd@driver\relax
+\fi
+
+%---------------------------------------
+
+%% variables
+\let\bxdd@gopt\relax
+\let\bxdd@godrv\relax
+\let\bxdd@godrv@multiple=M% flag value
+
+%% \bxdd@scan@global@options
+\@onlypreamble\bxdd@scan@global@options
+\def\bxdd@scan@global@options{%
+ \begingroup
+ \@for\bxdd@gopt:=\@classoptionslist\do{%
+ \let\bxdd@tmpa\bxdd@gopt \bxdd@detokenize\bxdd@tmpa
+ \expandafter\ifx\csname bxdd@T/\bxdd@tmpa\endcsname\relax\else
+ \ifx\bxdd@godrv\bxdd@gopt % just redundant
+ \else\ifx\bxdd@godrv\relax % first
+ \let\bxdd@godrv\bxdd@gopt
+ \else\ifx\bxdd@godrv\bxdd@godrv@multiple % more
+ \PackageInfo\bxdd@pkgname
+ {Extra driver option in global option list\MessageBreak
+ ('\bxdd@gopt'),}%
+ \else % second
+ \PackageInfo\bxdd@pkgname
+ {Multiple driver options in global option list\MessageBreak
+ ('\bxdd@godrv' and '\bxdd@gopt'),}%
+ \let\bxdd@godrv\bxdd@godrv@multiple
+ \fi\fi\fi
+ \fi}
+ \aftergroup\bxdd@okfalse
+ \ifx\bxdd@godrv\relax
+ \ifx\bxdd@driver\relax\else
+ \PackageInfo\bxdd@pkgname
+ {Driver option '\bxdd@driver' is appended to the\MessageBreak
+ global option list,}
+ \aftergroup\bxdd@oktrue
+ \fi
+ \else\ifx\bxdd@godrv\bxdd@driver
+ \PackageInfo\bxdd@pkgname
+ {Driver option '\bxdd@driver' is already contained\MessageBreak
+ in the global option list,}
+ \else\ifx\bxdd@godrv\bxdd@godrv@multiple
+ \ifbxdd@check
+ \PackageError\bxdd@pkgname
+ {Multiple driver options in global option list\MessageBreak
+ (see log for detail)}%
+ {\@ehd}%
+ \fi
+ \else % inconsistent
+ \ifbxdd@check
+ \PackageError\bxdd@pkgname
+ {The driver specified is '\bxdd@driver',\MessageBreak
+ but the global list contains '\bxdd@godrv'}%
+ {\@ehd}%
+ \else
+ \PackageInfo\bxdd@pkgname
+ {Driver option '\bxdd@driver' is discarded,\MessageBreak
+ because the global option list contains another driver\MessageBreak
+ '\bxdd@godrv',}
+ \fi
+ \fi\fi\fi
+ \endgroup}
+
+%% append the specified driver option
+\ifx\documentclass\@twoclasseserror% in preamble
+ \bxdd@scan@global@options
+ \ifbxdd@ok
+ \edef\bxdd@tmpa{%
+ \noexpand\g@addto@macro\noexpand\@classoptionslist{%
+ ,\bxdd@driver}%
+ }\bxdd@tmpa
+ \fi
+\else % 'before-preamble'
+ \let\bxdd@org@fileswith@pti@ns\@fileswith@pti@ns
+ \def\@fileswith@pti@ns#1{%
+ \ifx#1\@clsextension
+ \let\@fileswith@pti@ns\bxdd@org@fileswith@pti@ns
+ \let\bxdd@org@fileswith@pti@ns\@undefined
+ \g@addto@macro\@documentclasshook{%
+ \bxdd@scan@global@options}%
+ \ifx\bxdd@driver\relax
+ \def\bxdd@tmpa{\@fileswith@pti@ns#1}%
+ \else
+ \edef\bxdd@tmpa{\noexpand\bxdd@tmpb{\bxdd@driver}}%
+ \def\bxdd@tmpb##1[##2]{\@fileswith@pti@ns#1[{##2,##1}]}%
+ \fi
+ \else
+ \def\bxdd@tmpa{\bxdd@org@fileswith@pti@ns#1}%
+ \fi
+ \bxdd@tmpa}
+\fi
+
+%---------------------------------------
+
+%% \bxdd@scan@graphics@drivers
+\@onlypreamble\bxdd@scan@graphics@drivers
+\def\bxdd@scan@graphics@drivers{%
+ \begingroup
+ \edef\bxdd@tmpa{\bxdd@dvi@driver@list,\bxdd@pdf@driver@list}%
+ \@for\bxdd@gopt:=\bxdd@tmpa\do{%
+ \expandafter\ifx\csname ver@\bxdd@gopt.def\endcsname\relax\else
+ \ifx\bxdd@godrv\relax % first
+ \let\bxdd@godrv\bxdd@gopt
+ \else\ifx\bxdd@godrv\bxdd@godrv@multiple % more
+ \PackageInfo\bxdd@pkgname
+ {Extra graphics driver is loaded\MessageBreak
+ ('\bxdd@gopt'),}%
+ \else % second
+ \PackageInfo\bxdd@pkgname
+ {Multiple graphics driver is loaded\MessageBreak
+ ('\bxdd@godrv' and '\bxdd@gopt'),}%
+ \let\bxdd@godrv\bxdd@godrv@multiple
+ \fi\fi
+ \fi}
+ \ifx\bxdd@godrv\relax
+ \PackageInfo\bxdd@pkgname
+ {No graphics driver used,}
+ \else\ifx\bxdd@godrv\bxdd@godrv@multiple
+ \ifbxdd@check
+ \PackageError\bxdd@pkgname
+ {Multiple graphics drivers are loaded\MessageBreak
+ (see log for detail)}%
+ {\@ehd}%
+ \fi
+ \else
+ \PackageInfo\bxdd@pkgname
+ {Graphics driver is '\bxdd@godrv',}
+ \fi\fi
+ \endgroup}
+
+%% add hook
+\AtBeginDocument{%
+ \bxdd@scan@graphics@drivers}
+
+%--------------------------------------- all done
+\endinput
+%% EOF