From 6ba99b0be35fc29b019e51bf281b2fb7ffb028c6 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 14 Jul 2012 23:05:16 +0000 Subject: new latex package showcharinbox (14jul12) git-svn-id: svn://tug.org/texlive/trunk@27052 c570f23f-e606-0410-a88d-b1316a301751 --- .../tex/latex/showcharinbox/showcharinbox.sty | 111 +++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 Master/texmf-dist/tex/latex/showcharinbox/showcharinbox.sty (limited to 'Master/texmf-dist/tex/latex/showcharinbox') diff --git a/Master/texmf-dist/tex/latex/showcharinbox/showcharinbox.sty b/Master/texmf-dist/tex/latex/showcharinbox/showcharinbox.sty new file mode 100644 index 00000000000..31360b43ba1 --- /dev/null +++ b/Master/texmf-dist/tex/latex/showcharinbox/showcharinbox.sty @@ -0,0 +1,111 @@ +%% +%% This is file `showcharinbox.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% showcharinbox.dtx (with options: `showcharinbox.sty') +%% +%% ______________________________________ +%% Copyright © 2012 Vafa Khalighi +%% +%% License information appended. +%% +%% +\NeedsTeXFormat{LaTeX2e} +\newcommand*{\showcharinbox@date}{2012/07/25} +\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 Vafa Khalighi +%% +%% 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 “author-maintained” (as per LPPL maintenance status) +%% by Vafa Khalighi. +%% +%% +%% +%% +%% End of file `showcharinbox.sty'. -- cgit v1.2.3