blob: 33342f7cc92a570a8ef21f936087f318ad250006 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
%%
%% This is file 'bxcalcize.sty'.
%%
%% Copyright (c) 2018 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}[2018/01/28 v1.0a]
\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
|