summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/showcharinbox/showcharinbox.sty
blob: 9310221fac304a66f6fd3a7e64959bfb1c49a1f7 (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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
%%
%% This is file `showcharinbox.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% showcharinbox.dtx  (with options: `showcharinbox.sty')
%% 
%%   ______________________________________
%%   Copyright © 2012–2013  Persian TeX Group
%% 
%%   License information appended.
%% 
\NeedsTeXFormat{LaTeX2e}
\newcommand*{\showcharinbox@date}{2013/04/04}
\newcommand*{\showcharinbox@version}{v0.1}
\ProvidesPackage{showcharinbox}
          [\showcharinbox@date\space \showcharinbox@version\space
          Showing characters inside a box]
\newdimen\showcharinbox@charwidth
\newdimen\showcharinbox@charheight
\newdimen\showcharinbox@chardepth
\newbox\showcharinbox@bigdot
\newbox\showcharinbox@smalldot
\newcommand*{\showcharinbox@hidehrule}[2]{%
\kern-#1\hrule height#1 depth#2 \kern-#2 }
\newcommand*{\showcharinbox@hidevrule}[2]{\kern-#1{\dimen0=#1
    \advance\dimen0 by#2\vrule width\dimen0}\kern-#2 }
\newcommand*{\showcharinbox@makeblankbox}[2]{\hbox{\lower\dp0\vbox{\showcharinbox@hidehrule{#1}{#2}%
    \kern-#1%
    \hbox to\wd0{\showcharinbox@hidevrule{#1}{#2}%
      \raise\ht0\vbox to #1{}%
      \lower\dp0\vtop to #1{}%
      \hfil\showcharinbox@hidevrule{#2}{#1}}%
    \kern-#1\showcharinbox@hidehrule{#2}{#1}}}}
\newcommand*{\showcharinbox@maketypebox}{\showcharinbox@makeblankbox{0pt}{1pt}}
\newcommand*{\showcharinbox@makelightbox}{\showcharinbox@makeblankbox{.2pt}{.2pt}}
\setbox0=\hbox{$\vcenter{}$} %
\setbox1=\hbox to\z@{$\hss\bullet\hss$} %
\setbox\showcharinbox@bigdot=\vbox to\z@{\kern-\ht1 \kern\ht0 \box1 \vss}
\setbox1=\hbox to\z@{$\hss\cdot\hss$} %
\setbox\showcharinbox@smalldot=\vbox to\z@{\kern-\ht1 \kern\ht0 \box1 \vss}
\newcommand*{\showcharinbox@arrows}[2]{%
  {\setbox0=\hbox{$\mkern-2mu\mathord-\mkern-2mu$}
    \hbox to #1{\kern-.055556em$\leftarrow\mkern-6mu$%
      \cleaders\copy0\hfil
      \kern.4em #2\kern.4em
      \cleaders\copy0\hfil
      $\mkern-6mu\rightarrow$\kern-.055556em}}}
\newcommand*{\showcharinbox@samplebox}[4]{%
  {\setbox0=\vtop{\vbox to #1{\hbox to #3{}\vss}
      \nointerlineskip
      \vbox to #2{}}%
    \hbox{\copy\showcharinbox@bigdot
      \vrule height.2pt depth.2pt width#3%
      \kern-#3%
      \showcharinbox@makelightbox
      \kern-#3%
      \raise#1\vbox{\hbox to #3{\hss#4\hss}
        \kern 3pt}}}}

\newcommand{\ShowCharInBox}[1]{%
\setbox9=\hbox{#1}
\setlength{\showcharinbox@chardepth}{\dp9}
\setlength{\showcharinbox@charheight}{\ht9}
\setlength{\showcharinbox@charwidth}{\wd9}
\setbox0=\hbox{$\uparrow$}
\setbox1=\hbox to \wd0{$\hss\mid\hss$} %
\setbox2=\vbox to \showcharinbox@charheight{\copy0
  \nointerlineskip \kern-.5pt \copy1
  \nointerlineskip \kern-.5pt \copy1
  \vfil
  \moveleft 1em\hbox{height$=$\the\showcharinbox@charheight}
  \vfil
  \copy1 \nointerlineskip \kern-.5pt
  \copy1 \nointerlineskip \kern-.5pt
  \hbox{$\downarrow$}
  \kern.2pt}
\setbox3=\vbox to \showcharinbox@chardepth{\kern.2pt\copy0
  \vfil
  \moveleft 1em\hbox{depth$=$\the\showcharinbox@chardepth}
  \vfil
  \hbox{$\downarrow$}
  \kern0pt}
\setbox4=\vtop{\kern-3pt %
  \hbox{\showcharinbox@samplebox{\showcharinbox@charheight}{\showcharinbox@chardepth}{\showcharinbox@charwidth}{}%
    \kern-\showcharinbox@charwidth
 \hbox to \showcharinbox@charwidth{\hss \unhbox9\hss}}
  \kern3pt
  \showcharinbox@arrows{\showcharinbox@charwidth}{width$=$\the\showcharinbox@charwidth}}
\medskip\indent
\setbox0=\hbox{$\vcenter{}$}%
\lower\ht0\hbox{Reference point$-$\kern-.2em$\rightarrow$\kern2pt}%
\raise\ht2\box4
\kern1.5em
\raise\ht2\vtop{\kern0pt\box2\nointerlineskip\box3}}
%% 
%% Copyright © 2012–2013  Persian TeX Group <persian-tex@tug.org>
%% 
%% It may be distributed and/or modified under the LaTeX Project Public License,
%% version 1.3c or higher (your choice). The latest version of
%% this license is at: http://www.latex-project.org/lppl.txt
%% 
%% This work is “maintained” (as per LPPL maintenance status)
%% by Persian TeX Group.
%% 
%%
%% End of file `showcharinbox.sty'.