% \iffalse %<*internal> \iffalse % %<*readme> _______________________ The showcharinbox package v0.1 Show charcters inside a box display its height, depth, and width information. If you want to report any bugs or typos and corrections in the documentation, or ask for any new features, or suggest any improvements, or ask any questions about the package, then please do not send any direct emails to us; we will not answer any direct emails. Instead please use the issue tracker: In doing so, please always explain your issue well enough, always include a minimal working examples showing the issue, and always choose the appropriate label for your query (i.e. if you are reporting any bugs, choose `bug' label). Current version release date: 2013/04/04 ______________ Persian TeX Group persian-tex@tug.org Copyright © 2012–2013 Distributed under the LaTeX Project Public License 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. % %<*internal> \fi \begingroup % %<*batchfile> \input docstrip.tex \keepsilent \preamble ______________________________________ Copyright © 2012–2013 Persian TeX Group License information appended. \endpreamble \postamble Copyright © 2012–2013 Persian TeX Group 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. \endpostamble \askforoverwritefalse \generate{\file{showcharinbox.sty}{\from{\jobname.dtx}{showcharinbox.sty}}} % %\endbatchfile %<*internal> \generate{\file{\jobname.ins}{\from{\jobname.dtx}{batchfile}}} \nopreamble\nopostamble \generate{\file{README.txt}{\from{\jobname.dtx}{readme}}} \endgroup \immediate\write18{mv README.txt README} \immediate\write18{makeindex -s gind.ist -o \jobname.ind \jobname.idx} \immediate\write18{makeindex -s gglo.ist -o \jobname.gls \jobname.glo} % % %<*driver> \documentclass{ltxdoc} \usepackage{bidicode,fontspec} \usepackage{calc} \usepackage{pifont} \usepackage{bbding} \setlength\columnseprule{.4pt} \newfontfamily\testfont{XB Yas} \usepackage[numbered]{hypdoc} \usepackage{showcharinbox} \definecolor{myblue}{rgb}{0.1,0.2,0.8} \hypersetup{linkcolor=myblue,urlcolor=myblue,citecolor=myblue} \makeatletter \renewcommand\tableofcontents{\relax \begin{multicols}{2}[\section*{\contentsname}]\small \@starttoc{toc}\relax \end{multicols}} \makeatother \newcounter{local} \renewcommand\theenumi{\protect\setcounter{local}% {201+\the\value{enumi}}\protect\ding{\value{local}}} \renewcommand\labelenumi{\theenumi} \renewcommand\labelitemi{\HandRight} \renewcommand\labelitemii{\HandRightUp} \renewcommand\labelitemiii{\HandCuffRight} \renewcommand\labelitemiv{\HandPencilLeft} \EnableCrossrefs \CodelineIndex \RecordChanges %\OnlyDescription \begin{document} \DocInput{\jobname.dtx} \PrintIndex \PrintChanges \end{document} % % % % \fi % % \GetFileInfo{\jobname.cls} % \CheckSum{0} % \makeatletter %\title{The \textsf{showcharinbox} package\\ %\href{https://github.com/persian-tex/showcharinbox}{\texttt{https://github.com/persian-tex/showcharinbox}}} %\author{Persian TeX Group\\ \href{mailto:persian-tex@tug.org}{\texttt{persian-tex@tug.org}}} %\date{Version 0.1\qquad\today} %\maketitle %\tableofcontents %\section{What does the \textsf{showcharinbox} package do?} % This package defines the command \Lcs{ShowCharInBox} which has the following syntax: %\begin{BDef} %\Lcs{ShowCharInBox}\Largb{\Larga{charcter}} %\end{BDef} % This will show \Larga{charcter} inside a box showing its height, depth, and width information. %\begin{LTXexample}[morekeywords={ShowCharInBox,testfont,newfontfamily},pos=b] %\documentclass{article} %\usepackage{fontspec} %\newfontfamily\testfont{XB Yas} %\usepackage{showcharinbox} %\begin{document} %\begin{center} %\ShowCharInBox{\fontsize{200}{210}\testfont \char"FEA5} %\end{center} %\end{document} %\end{LTXexample} % \StopEventually{} % % \section{Implementation of \textsf{showcharinbox} package} %\iffalse %<*showcharinbox.sty> %\fi % % \begin{macrocode} \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 % \end{macrocode} % Macros for drawing figures: % \begin{macrocode} \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 } % \end{macrocode} % \Lcs{showcharinbox@makeblankbox} puts rules at the edges of a blank box % whose dimensions are those of \Lcs{box0} (assuming nonnegative wdith, height, and depth). % Argument 1 is rule thickness outside, and argument 2 is rule thickness inside: % \begin{macrocode} \newcommand*{\showcharinbox@makeblankbox}[2]{\hbox{\lower\dp0\vbox{\showcharinbox@hidehrule{#1}{#2}% % \end{macrocode} %overlap the rules at the corners: % \begin{macrocode} \kern-#1% \hbox to\wd0{\showcharinbox@hidevrule{#1}{#2}% % \end{macrocode} %set the vrule height: % \begin{macrocode} \raise\ht0\vbox to #1{}% % \end{macrocode} %set the vrule depth: % \begin{macrocode} \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}} % \end{macrocode} % \Lcs{box}\Lcs{showcharinbox@bigdot} is a null box with a bullet at its reference point. \Lcs{ht0} is the axis height: % \begin{macrocode} \setbox0=\hbox{$\vcenter{}$} % % \end{macrocode} %bullet is centered on the axis: % \begin{macrocode} \setbox1=\hbox to\z@{$\hss\bullet\hss$} % \setbox\showcharinbox@bigdot=\vbox to\z@{\kern-\ht1 \kern\ht0 \box1 \vss} % \end{macrocode} %\Lcs{cdot} is centered on the axis: % \begin{macrocode} \setbox1=\hbox to\z@{$\hss\cdot\hss$} % \setbox\showcharinbox@smalldot=\vbox to\z@{\kern-\ht1 \kern\ht0 \box1 \vss} % \end{macrocode} % \Lcs{showcharinbox@arrows} makes things like $\leftarrow\hbox{ text }\rightarrow$: % \begin{macrocode} \newcommand*{\showcharinbox@arrows}[2]{% % \end{macrocode} %Argument 1 is width and argument 2 is text: % \begin{macrocode} {\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}}} % \end{macrocode} % \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: % \begin{macrocode} \newcommand*{\showcharinbox@samplebox}[4]{% {\setbox0=\vtop{\vbox to #1{\hbox to #3{}\vss} \nointerlineskip % \end{macrocode} %Now \Lcs{box0} has the desired height, depth, and width: % \begin{macrocode} \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$} % \end{macrocode} % With luck, they'll line up: % \begin{macrocode} \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} % \end{macrocode} %This cancels the null text above the \Lcs{showcharinbox@samplebox}: % \begin{macrocode} \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 % \end{macrocode} %\Lcs{ht0} is the axis height: % \begin{macrocode} \setbox0=\hbox{$\vcenter{}$}% \lower\ht0\hbox{Reference point$-$\kern-.2em$\rightarrow$\kern2pt}% \raise\ht2\box4 \kern1.5em \raise\ht2\vtop{\kern0pt\box2\nointerlineskip\box3}} % \end{macrocode} % \iffalse % %\fi % % % \typeout{*************************************************************} % \typeout{*} % \typeout{* To finish the installation you have to move the following} % \typeout{* file into a directory searched by TeX:} % \typeout{*} % \typeout{* \space\space\space showcharinbox.sty file} % \typeout{*} % \typeout{*************************************************************} % \endinput