-
-
Notifications
You must be signed in to change notification settings - Fork 249
/
test2eb.tex
85 lines (72 loc) · 2.01 KB
/
test2eb.tex
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
82
83
84
85
% =============================
% \TestEngine
% -
% \Show % non-stopping \show
% \ShowThe % non-stopping \show\the
% -
% \TestBox{htext} % box dimensions
% \TestWd{htext} % Only width - redundant, but one-liner
% \TestSavePos{label} % label only for reference - requires .aux
% (\TestAuxMessage - auxiliary for the previous - defined only if used)
% \TestNum{a=b} % or with < > - result is True o False
% \TestPdf{label}{text}
% \CHECKPDF{pattern|pattern} % in preample, with regex'es for resources
\chardef\TestEngine=%
\ifx\directlua\@undefined
\ifx\XeTeXinputencoding\@undefined
\z@
\else
\tw@
\fi
\else
\@ne
\fi
%----
\def\Show#1{{%
{\edef\Test@Temp{\meaning#1}% use csname ???
\message{^^J\string#1 \string= \Test@Temp^^J}}}}
%----
\def\ShowThe#1{\message{^^J\string#1 \string= \the#1^^J}}
%----
\def\TestBox#1{%
\def\Test@Temp{#1}%
\texttt{\expandafter\strip@prefix\meaning\Test@Temp} = {#1}%
\setbox0\hbox{#1}%
\message{^^J\expandafter\strip@prefix\meaning\Test@Temp
\space\string= \the\wd0, \the\ht0, \the\dp0}}
%----
\def\TestWd#1{\setbox0\hbox{#1}\ShowThe{\wd0}\relax#1}
%----
\def\TestPos#1{%
\def\TestAuxMessage##1{\message{^^JTIMO^^J##1^^JOMIT^^J}}%
\pdfsavepos
\protected@write\@mainaux{}%
{\protect\TestAuxMessage{#1 \string= \noexpand\the\pdflastxpos,
\noexpand\the\pdflastypos}}}
\def\TestAuxMessage#1{}
\let\TestSavePos\TestPos % Just a synon
\ifx\pdfsavepos\@undefined
\ifx\savepos\@undefined\else
\let\pdfsavepos\savepos
\let\pdflastxpos\lastxpos
\let\pdflastypos\lastypos
\fi
\fi
%----
\def\TestNum#1{%
\def\Test@Temp{#1}%
\message{^^J\expandafter\strip@prefix\meaning\Test@Temp
\space\string= \ifnum#1 True\else False\fi}}
%----
\def\TestPdf#1{%
\def\Test@Temp{== #1 ==}%
\pdfliteral direct {%
\@percentchar TIMO \expandafter\strip@prefix\meaning\Test@Temp}%
#1%
\pdfliteral direct {\@percentchar OMIT}}
% In preamble:
\def\CHECKPDF#1{%
\pdfcompresslevel=\z@
\pdfobjcompresslevel=\z@
\typeout{CHECKPDF #1}}
\endinput