| 1 |
% \iffalse |
| 2 |
%<*internal> |
| 3 |
\iffalse |
| 4 |
%</internal> |
| 5 |
%<*readme> |
| 6 |
_______________________ |
| 7 |
The showcharinbox package |
| 8 |
v0.1 |
| 9 |
|
| 10 |
Show charcters inside a box display its height, depth, and width information. |
| 11 |
|
| 12 |
If you want to report any bugs or typos and corrections in the documentation, |
| 13 |
or ask for any new features, or suggest any improvements, or ask any questions |
| 14 |
about the package, then please do not send any direct emails to us; we will not |
| 15 |
answer any direct emails. Instead please use the issue tracker: |
| 16 |
<https://github.com/persian-tex/showcharinbox/issues> |
| 17 |
In doing so, please always explain your issue well enough, always include |
| 18 |
a minimal working examples showing the issue, and always choose the appropriate |
| 19 |
label for your query (i.e. if you are reporting any bugs, choose `bug' label). |
| 20 |
|
| 21 |
Current version release date: 2013/04/04 |
| 22 |
|
| 23 |
______________ |
| 24 |
Persian TeX Group |
| 25 |
[email protected] |
| 26 |
|
| 27 |
Copyright © 2012–2013 |
| 28 |
Distributed under the LaTeX Project Public License |
| 29 |
It may be distributed and/or modified under the LaTeX Project Public License, |
| 30 |
version 1.3c or higher (your choice). The latest version of |
| 31 |
this license is at: http://www.latex-project.org/lppl.txt |
| 32 |
|
| 33 |
This work is “maintained” (as per LPPL maintenance status) |
| 34 |
by Persian TeX Group. |
| 35 |
%</readme> |
| 36 |
%<*internal> |
| 37 |
\fi |
| 38 |
\begingroup |
| 39 |
%</internal> |
| 40 |
%<*batchfile> |
| 41 |
\input docstrip.tex |
| 42 |
\keepsilent |
| 43 |
\preamble |
| 44 |
|
| 45 |
______________________________________ |
| 46 |
Copyright © 2012–2013 Persian TeX Group |
| 47 |
|
| 48 |
License information appended. |
| 49 |
|
| 50 |
|
| 51 |
\endpreamble |
| 52 |
\postamble |
| 53 |
|
| 54 |
Copyright © 2012–2013 Persian TeX Group <[email protected]> |
| 55 |
|
| 56 |
It may be distributed and/or modified under the LaTeX Project Public License, |
| 57 |
version 1.3c or higher (your choice). The latest version of |
| 58 |
this license is at: http://www.latex-project.org/lppl.txt |
| 59 |
|
| 60 |
This work is “maintained” (as per LPPL maintenance status) |
| 61 |
by Persian TeX Group. |
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
\endpostamble |
| 66 |
\askforoverwritefalse |
| 67 |
\generate{\file{showcharinbox.sty}{\from{\jobname.dtx}{showcharinbox.sty}}} |
| 68 |
%</batchfile> |
| 69 |
%<batchfile>\endbatchfile |
| 70 |
%<*internal> |
| 71 |
\generate{\file{\jobname.ins}{\from{\jobname.dtx}{batchfile}}} |
| 72 |
\nopreamble\nopostamble |
| 73 |
\generate{\file{README.txt}{\from{\jobname.dtx}{readme}}} |
| 74 |
\endgroup |
| 75 |
\immediate\write18{mv README.txt README} |
| 76 |
\immediate\write18{makeindex -s gind.ist -o \jobname.ind \jobname.idx} |
| 77 |
\immediate\write18{makeindex -s gglo.ist -o \jobname.gls \jobname.glo} |
| 78 |
%</internal> |
| 79 |
% |
| 80 |
%<*driver> |
| 81 |
\documentclass{ltxdoc} |
| 82 |
\usepackage{bidicode,fontspec} |
| 83 |
\usepackage{calc} |
| 84 |
\usepackage{pifont} |
| 85 |
\usepackage{bbding} |
| 86 |
\setlength\columnseprule{.4pt} |
| 87 |
\newfontfamily\testfont{XB Yas} |
| 88 |
\usepackage[numbered]{hypdoc} |
| 89 |
\usepackage{showcharinbox} |
| 90 |
\definecolor{myblue}{rgb}{0.1,0.2,0.8} |
| 91 |
\hypersetup{linkcolor=myblue,urlcolor=myblue,citecolor=myblue} |
| 92 |
\makeatletter |
| 93 |
\renewcommand\tableofcontents{\relax |
| 94 |
\begin{multicols}{2}[\section*{\contentsname}]\small |
| 95 |
\@starttoc{toc}\relax |
| 96 |
\end{multicols}} |
| 97 |
\makeatother |
| 98 |
\newcounter{local} |
| 99 |
\renewcommand\theenumi{\protect\setcounter{local}% |
| 100 |
{201+\the\value{enumi}}\protect\ding{\value{local}}} |
| 101 |
\renewcommand\labelenumi{\theenumi} |
| 102 |
\renewcommand\labelitemi{\HandRight} |
| 103 |
\renewcommand\labelitemii{\HandRightUp} |
| 104 |
\renewcommand\labelitemiii{\HandCuffRight} |
| 105 |
\renewcommand\labelitemiv{\HandPencilLeft} |
| 106 |
\EnableCrossrefs |
| 107 |
\CodelineIndex |
| 108 |
\RecordChanges |
| 109 |
%\OnlyDescription |
| 110 |
\begin{document} |
| 111 |
\DocInput{\jobname.dtx} |
| 112 |
\PrintIndex |
| 113 |
\PrintChanges |
| 114 |
\end{document} |
| 115 |
%</driver> |
| 116 |
% |
| 117 |
% |
| 118 |
% \fi |
| 119 |
% |
| 120 |
% \GetFileInfo{\jobname.cls} |
| 121 |
% \CheckSum{0} |
| 122 |
% \makeatletter |
| 123 |
%\title{The \textsf{showcharinbox} package\\ |
| 124 |
%\href{https://github.com/persian-tex/showcharinbox}{\texttt{https://github.com/persian-tex/showcharinbox}}} |
| 125 |
%\author{Persian TeX Group\\ \href{mailto:[email protected]}{\texttt{[email protected]}}} |
| 126 |
%\date{Version 0.1\qquad\today} |
| 127 |
%\maketitle |
| 128 |
%\tableofcontents |
| 129 |
%\section{What does the \textsf{showcharinbox} package do?} |
| 130 |
% This package defines the command \Lcs{ShowCharInBox} which has the following syntax: |
| 131 |
%\begin{BDef} |
| 132 |
%\Lcs{ShowCharInBox}\Largb{\Larga{charcter}} |
| 133 |
%\end{BDef} |
| 134 |
% This will show \Larga{charcter} inside a box showing its height, depth, and width information. |
| 135 |
%\begin{LTXexample}[morekeywords={ShowCharInBox,testfont,newfontfamily},pos=b] |
| 136 |
%\documentclass{article} |
| 137 |
%\usepackage{fontspec} |
| 138 |
%\newfontfamily\testfont{XB Yas} |
| 139 |
%\usepackage{showcharinbox} |
| 140 |
%\begin{document} |
| 141 |
%\begin{center} |
| 142 |
%\ShowCharInBox{\fontsize{200}{210}\testfont \char"FEA5} |
| 143 |
%\end{center} |
| 144 |
%\end{document} |
| 145 |
%\end{LTXexample} |
| 146 |
% \StopEventually{} |
| 147 |
% |
| 148 |
% \section{Implementation of \textsf{showcharinbox} package} |
| 149 |
%\iffalse |
| 150 |
%<*showcharinbox.sty> |
| 151 |
%\fi |
| 152 |
% |
| 153 |
% \begin{macrocode} |
| 154 |
\NeedsTeXFormat{LaTeX2e} |
| 155 |
\newcommand*{\showcharinbox@date}{2013/04/04} |
| 156 |
\newcommand*{\showcharinbox@version}{v0.1} |
| 157 |
\ProvidesPackage{showcharinbox} |
| 158 |
[\showcharinbox@date\space \showcharinbox@version\space |
| 159 |
Showing characters inside a box] |
| 160 |
\newdimen\showcharinbox@charwidth |
| 161 |
\newdimen\showcharinbox@charheight |
| 162 |
\newdimen\showcharinbox@chardepth |
| 163 |
\newbox\showcharinbox@bigdot |
| 164 |
\newbox\showcharinbox@smalldot |
| 165 |
% \end{macrocode} |
| 166 |
% Macros for drawing figures: |
| 167 |
% \begin{macrocode} |
| 168 |
\newcommand*{\showcharinbox@hidehrule}[2]{% |
| 169 |
\kern-#1\hrule height#1 depth#2 \kern-#2 } |
| 170 |
\newcommand*{\showcharinbox@hidevrule}[2]{\kern-#1{\dimen0=#1 |
| 171 |
\advance\dimen0 by#2\vrule width\dimen0}\kern-#2 } |
| 172 |
% \end{macrocode} |
| 173 |
% \Lcs{showcharinbox@makeblankbox} puts rules at the edges of a blank box |
| 174 |
% whose dimensions are those of \Lcs{box0} (assuming nonnegative wdith, height, and depth). |
| 175 |
% Argument 1 is rule thickness outside, and argument 2 is rule thickness inside: |
| 176 |
% \begin{macrocode} |
| 177 |
\newcommand*{\showcharinbox@makeblankbox}[2]{\hbox{\lower\dp0\vbox{\showcharinbox@hidehrule{#1}{#2}% |
| 178 |
% \end{macrocode} |
| 179 |
%overlap the rules at the corners: |
| 180 |
% \begin{macrocode} |
| 181 |
\kern-#1% |
| 182 |
\hbox to\wd0{\showcharinbox@hidevrule{#1}{#2}% |
| 183 |
% \end{macrocode} |
| 184 |
%set the vrule height: |
| 185 |
% \begin{macrocode} |
| 186 |
\raise\ht0\vbox to #1{}% |
| 187 |
% \end{macrocode} |
| 188 |
%set the vrule depth: |
| 189 |
% \begin{macrocode} |
| 190 |
\lower\dp0\vtop to #1{}% |
| 191 |
\hfil\showcharinbox@hidevrule{#2}{#1}}% |
| 192 |
\kern-#1\showcharinbox@hidehrule{#2}{#1}}}} |
| 193 |
\newcommand*{\showcharinbox@maketypebox}{\showcharinbox@makeblankbox{0pt}{1pt}} |
| 194 |
\newcommand*{\showcharinbox@makelightbox}{\showcharinbox@makeblankbox{.2pt}{.2pt}} |
| 195 |
% \end{macrocode} |
| 196 |
% \Lcs{box}\Lcs{showcharinbox@bigdot} is a null box with a bullet at its reference point. \Lcs{ht0} is the axis height: |
| 197 |
% \begin{macrocode} |
| 198 |
\setbox0=\hbox{$\vcenter{}$} % |
| 199 |
% \end{macrocode} |
| 200 |
%bullet is centered on the axis: |
| 201 |
% \begin{macrocode} |
| 202 |
\setbox1=\hbox to\z@{$\hss\bullet\hss$} % |
| 203 |
\setbox\showcharinbox@bigdot=\vbox to\z@{\kern-\ht1 \kern\ht0 \box1 \vss} |
| 204 |
% \end{macrocode} |
| 205 |
%\Lcs{cdot} is centered on the axis: |
| 206 |
% \begin{macrocode} |
| 207 |
\setbox1=\hbox to\z@{$\hss\cdot\hss$} % |
| 208 |
\setbox\showcharinbox@smalldot=\vbox to\z@{\kern-\ht1 \kern\ht0 \box1 \vss} |
| 209 |
% \end{macrocode} |
| 210 |
% \Lcs{showcharinbox@arrows} makes things like $\leftarrow\hbox{ text }\rightarrow$: |
| 211 |
% \begin{macrocode} |
| 212 |
\newcommand*{\showcharinbox@arrows}[2]{% |
| 213 |
% \end{macrocode} |
| 214 |
%Argument 1 is width and argument 2 is text: |
| 215 |
% \begin{macrocode} |
| 216 |
{\setbox0=\hbox{$\mkern-2mu\mathord-\mkern-2mu$} |
| 217 |
\hbox to #1{\kern-.055556em$\leftarrow\mkern-6mu$% |
| 218 |
\cleaders\copy0\hfil |
| 219 |
\kern.4em #2\kern.4em |
| 220 |
\cleaders\copy0\hfil |
| 221 |
$\mkern-6mu\rightarrow$\kern-.055556em}}} |
| 222 |
% \end{macrocode} |
| 223 |
% \Lcs{showcharinbox@samplebox} makes the outline of a box, with big dot at reference point. Argument 1 is height, argument 2 is depth, argument 3 is width, and argument4 is text: |
| 224 |
% \begin{macrocode} |
| 225 |
\newcommand*{\showcharinbox@samplebox}[4]{% |
| 226 |
{\setbox0=\vtop{\vbox to #1{\hbox to #3{}\vss} |
| 227 |
\nointerlineskip |
| 228 |
% \end{macrocode} |
| 229 |
%Now \Lcs{box0} has the desired height, depth, and width: |
| 230 |
% \begin{macrocode} |
| 231 |
\vbox to #2{}}% |
| 232 |
\hbox{\copy\showcharinbox@bigdot |
| 233 |
\vrule height.2pt depth.2pt width#3% |
| 234 |
\kern-#3% |
| 235 |
\showcharinbox@makelightbox |
| 236 |
\kern-#3% |
| 237 |
\raise#1\vbox{\hbox to #3{\hss#4\hss} |
| 238 |
\kern 3pt}}}} |
| 239 |
|
| 240 |
\newcommand{\ShowCharInBox}[1]{% |
| 241 |
\setbox9=\hbox{#1} |
| 242 |
\setlength{\showcharinbox@chardepth}{\dp9} |
| 243 |
\setlength{\showcharinbox@charheight}{\ht9} |
| 244 |
\setlength{\showcharinbox@charwidth}{\wd9} |
| 245 |
\setbox0=\hbox{$\uparrow$} |
| 246 |
% \end{macrocode} |
| 247 |
% With luck, they'll line up: |
| 248 |
% \begin{macrocode} |
| 249 |
\setbox1=\hbox to \wd0{$\hss\mid\hss$} % |
| 250 |
\setbox2=\vbox to \showcharinbox@charheight{\copy0 |
| 251 |
\nointerlineskip \kern-.5pt \copy1 |
| 252 |
\nointerlineskip \kern-.5pt \copy1 |
| 253 |
\vfil |
| 254 |
\moveleft 1em\hbox{height$=$\the\showcharinbox@charheight} |
| 255 |
\vfil |
| 256 |
\copy1 \nointerlineskip \kern-.5pt |
| 257 |
\copy1 \nointerlineskip \kern-.5pt |
| 258 |
\hbox{$\downarrow$} |
| 259 |
\kern.2pt} |
| 260 |
\setbox3=\vbox to \showcharinbox@chardepth{\kern.2pt\copy0 |
| 261 |
\vfil |
| 262 |
\moveleft 1em\hbox{depth$=$\the\showcharinbox@chardepth} |
| 263 |
\vfil |
| 264 |
\hbox{$\downarrow$} |
| 265 |
\kern0pt} |
| 266 |
% \end{macrocode} |
| 267 |
%This cancels the null text above the \Lcs{showcharinbox@samplebox}: |
| 268 |
% \begin{macrocode} |
| 269 |
\setbox4=\vtop{\kern-3pt % |
| 270 |
\hbox{\showcharinbox@samplebox{\showcharinbox@charheight}{\showcharinbox@chardepth}{\showcharinbox@charwidth}{}% |
| 271 |
\kern-\showcharinbox@charwidth |
| 272 |
\hbox to \showcharinbox@charwidth{\hss \unhbox9\hss}} |
| 273 |
\kern3pt |
| 274 |
\showcharinbox@arrows{\showcharinbox@charwidth}{width$=$\the\showcharinbox@charwidth}} |
| 275 |
\medskip\indent |
| 276 |
% \end{macrocode} |
| 277 |
%\Lcs{ht0} is the axis height: |
| 278 |
% \begin{macrocode} |
| 279 |
\setbox0=\hbox{$\vcenter{}$}% |
| 280 |
\lower\ht0\hbox{Reference point$-$\kern-.2em$\rightarrow$\kern2pt}% |
| 281 |
\raise\ht2\box4 |
| 282 |
\kern1.5em |
| 283 |
\raise\ht2\vtop{\kern0pt\box2\nointerlineskip\box3}} |
| 284 |
% \end{macrocode} |
| 285 |
% \iffalse |
| 286 |
%</showcharinbox.sty> |
| 287 |
%\fi |
| 288 |
% |
| 289 |
% |
| 290 |
% \typeout{*************************************************************} |
| 291 |
% \typeout{*} |
| 292 |
% \typeout{* To finish the installation you have to move the following} |
| 293 |
% \typeout{* file into a directory searched by TeX:} |
| 294 |
% \typeout{*} |
| 295 |
% \typeout{* \space\space\space showcharinbox.sty file} |
| 296 |
% \typeout{*} |
| 297 |
% \typeout{*************************************************************} |
| 298 |
% |
| 299 |
\endinput |