summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/bxcalc/bxcalcize.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/bxcalc/bxcalcize.sty')
-rw-r--r--Master/texmf-dist/tex/latex/bxcalc/bxcalcize.sty81
1 files changed, 81 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/bxcalc/bxcalcize.sty b/Master/texmf-dist/tex/latex/bxcalc/bxcalcize.sty
new file mode 100644
index 00000000000..1c913e53e2c
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/bxcalc/bxcalcize.sty
@@ -0,0 +1,81 @@
+%%
+%% This is file 'bxcalcize.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{bxcalcize}[2017/05/21 v1.0]
+\def\bxcy@pkgname{bxcalcize}
+
+%% code guards
+\edef\bxcy@restore@codes{%
+\catcode45=\the\catcode45%
+\catcode46=\the\catcode46%
+\catcode47=\the\catcode47%
+\endlinechar=\the\endlinechar%
+\relax}
+\catcode45=12 % <->
+\catcode46=12 % <.>
+\catcode47=12 % </>
+\endlinechar\m@ne
+\AtEndOfPackage{
+\bxcy@restore@codes
+\let\bxcy@restore@codes\relax}
+
+
+%--------------------------------------- general
+
+%% packages
+\RequirePackage{calc}[]
+\RequirePackage{etoolbox}[]
+\ifx\numdef\@undefined\endinput\fi
+
+%% variables
+\newdimen\bxcy@resdim
+
+%--------------------------------------- patches to standard commands
+
+%% to \hspace / \vspace
+\csdef{hspace }{
+ \@ifstar{\bxcy@with@calc\@hspacer}
+ {\bxcy@with@calc\@hspace}
+}
+\csdef{vspace }{
+ \@ifstar{\bxcy@with@calc\@vspacer}
+ {\bxcy@with@calc\@vspace}
+}
+
+%% to \addvspace
+\let\bxcy@org@addvspace\addvspace
+\def\addvspace{
+ \bxcy@with@calc\bxcy@org@addvspace
+}
+
+%% to \\[<len>] (\@newline)
+\patchcmd{\@newline}{
+ \@gnewline{\vskip#1}
+}{
+ \setlength\bxcy@resdim{#1}
+ \edef\bxcy@tmpa{{\vskip\the\bxcy@resdim}}
+ \expandafter\@gnewline\bxcy@tmpa
+}{}{% failure
+ \PackageWarningNoLine\bxcy@pkgname
+ {Patch to \string\@newline\space failed.}
+}
+
+%% \bxcy@with@calc
+\def\bxcy@with@calc#1#2{
+ \setlength\bxcy@resdim{#2}
+ \edef\bxcy@tmpa{{\the\bxcy@resdim}}
+ \expandafter#1\bxcy@tmpa
+}
+
+%--------------------------------------- all done
+\endinput
+%% EOF