Debian Codegraph @

texmf-dist/doc/latex/adjustbox/box.tex

raw
1 \begin{tikzpicture}[font=\sffamily,>=latex]
2 \newcommand\Cs[1]{\texttt{\scriptsize\textbackslash #1}}
3 \sbox\mybox{\pgfinterruptpicture\sffamily\color{black!25}\scalebox{10}{Xy}\endpgfinterruptpicture}
4 \def\HEIGHT{\ht\mybox}
5 \def\WIDTH{\wd\mybox}
6 \def\DEPTH{\dp\mybox}
7 \draw [gray,thin]
8 (0,0) -- +(-3.5ex,0)
9 (0,\HEIGHT) -- +(-3.5ex,0)
10 (0,-\DEPTH) -- +(-3.5ex,0)
11 (\WIDTH,\HEIGHT) -- +(3.5ex,0)
12 (\WIDTH,-\DEPTH) -- +(3.5ex,0)
13 (0,-\DEPTH) -- +(0,-3.5ex)
14 (\WIDTH,-\DEPTH) -- +(0,-3.5ex)
15 ;
16 \node [inner sep=0pt,anchor=base west] {\usebox\mybox};
17 \draw (0,0) -- (\WIDTH,0) node [above,midway] {baseline};
18 \draw [thick] (0,-\DEPTH) rectangle (\WIDTH,\HEIGHT);
19 \path [fill=white,draw=black] (0,0) circle (1pt);
20 \draw [<-,shorten <=2pt] (0,0) -- (2ex,-2ex) -- +(.5ex,0) node [right=-0.5ex] {origin};
21 \tikzset{inner sep=5pt}
22 \draw [->] (-2.5ex,0) -- +(0,-\DEPTH) node [pos=1.1,left,align=left]
23 {depth\\\Cs{depth}\\\Cs{dp}\Cs{br}};
24 \draw [->] (-2.5ex,0) -- +(0, \HEIGHT) node [pos=.4,left,align=left]
25 {height\\\Cs{height}\\\Cs{ht}\Cs{br}};
26 \draw [<->] (\WIDTH,-\DEPTH) ++(2.5ex,0) -- +(0,\DEPTH+\HEIGHT) node [midway,right,align=left]
27 {totalheight\\\Cs{totalheight}};
28 \draw [<->] (0,-\DEPTH) ++(0,-2.5ex) -- +(\WIDTH,0) node [midway,below,align=left]
29 {width\\\Cs{width}\\\Cs{wd}\Cs{br}};
30 \fill (-2.5ex,0) circle (.5pt);
31 \path let
32 \p1 = (current bounding box.south west),
33 \p2 = (current bounding box.north east),
34 \p3 = (0,-\DEPTH),
35 \p4 = (\WIDTH,\HEIGHT)
36 in
37 (\x3-\x2+\x4,\y3) rectangle (\x4+\x3-\x1,\y4);
38 \end{tikzpicture}