Debian Codegraph @

texmf-dist/tex/latex/oberdiek/settobox.sty

raw
1 %%
2 %% This is file `settobox.sty',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% settobox.dtx (with options: `package')
8 %%
9 %% This is a generated file.
10 %%
11 %% Project: settobox
12 %% Version: 2016/05/16 v1.5
13 %%
14 %% Copyright (C)
15 %% 2000, 2006-2008 Heiko Oberdiek
16 %% 2016-2019 Oberdiek Package Support Group
17 %%
18 %% This work may be distributed and/or modified under the
19 %% conditions of the LaTeX Project Public License, either
20 %% version 1.3c of this license or (at your option) any later
21 %% version. This version of this license is in
22 %% https://www.latex-project.org/lppl/lppl-1-3c.txt
23 %% and the latest version of this license is in
24 %% https://www.latex-project.org/lppl.txt
25 %% and version 1.3 or later is part of all distributions of
26 %% LaTeX version 2005/12/01 or later.
27 %%
28 %% This work has the LPPL maintenance status "maintained".
29 %%
30 %% The Current Maintainers of this work are
31 %% Heiko Oberdiek and the Oberdiek Package Support Group
32 %% https://github.com/ho-tex/oberdiek/issues
33 %%
34 %%
35 %% This work consists of the main source file settobox.dtx
36 %% and the derived files
37 %% settobox.sty, settobox.pdf, settobox.ins, settobox.drv,
38 %% settobox-example.tex.
39 %%
40 \NeedsTeXFormat{LaTeX2e}
41 \ProvidesPackage{settobox}%
42 [2016/05/16 v1.5 Assign box dimensions to length registers (HO)]
43 \newcommand*{\settoboxwidth}[2]{\setlength{#1}{\wd#2}}
44 \newcommand*{\settoboxheight}[2]{\setlength{#1}{\ht#2}}
45 \newcommand*{\settoboxdepth}[2]{\setlength{#1}{\dp#2}}
46 \newcommand*{\settoboxtotalheight}[2]{%
47 \setlength{#1}{\ht#2}%
48 \addtolength{#1}{\dp#2}%
49 }
50 \newcommand*{\setboxwidth}[2]{%
51 \settobox@length\wd{#1}{#2}%
52 }
53 \newcommand*{\setboxheight}[2]{%
54 \settobox@length\ht{#1}{#2}%
55 }
56 \newcommand*{\setboxdepth}[2]{%
57 \settobox@length\dp{#1}{#2}%
58 }
59 \newcommand*{\setboxmoveleft}[2]{%
60 \settobox@horiz{-}{#1}{#2}%
61 }
62 \newcommand*{\setboxmoveright}[2]{%
63 \settobox@horiz{}{#1}{#2}%
64 }
65 \newcommand*{\setboxlower}[2]{%
66 \settobox@vert\lower{#1}{#2}%
67 }
68 \newcommand*{\setboxraise}[2]{%
69 \settobox@vert\raise{#1}{#2}%
70 }
71 \def\settobox@length#1#2#3{%
72 \settobox@calc{#2}{#3}{#1#2=##1sp\relax}%
73 }
74 \def\settobox@horiz#1#2#3{%
75 \settobox@calc{#2}{#3}{\setbox#2=\hbox{\kern#1##1sp\copy#2}}%
76 }
77 \def\settobox@vert#1#2#3{%
78 \settobox@calc{#2}{#3}{\setbox#2=\hbox{#1##1sp\copy#2}}%
79 }
80 \def\settobox@calc#1#2#3{%
81 \begingroup
82 \def\width{\wd#1}%
83 \def\height{\ht#1}%
84 \def\depth{\dp#1}%
85 \dimen@\ht#1\relax
86 \advance\dimen@\dp#1\relax
87 \def\totalheight{\dimen@}%
88 \setlength{\dimen@}{#2}%
89 \count@\dimen@
90 \def\x##1{\endgroup
91 #3%
92 }%
93 \expandafter\x\expandafter{\the\count@}%
94 }
95 \endinput
96 %%
97 %% End of file `settobox.sty'.