| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
% File: settobox.dtx |
| 4 |
% Version: 2016/05/16 v1.5 |
| 5 |
% Info: Assign box dimensions to length registers |
| 6 |
% |
| 7 |
% Copyright (C) |
| 8 |
% 2000, 2006-2008 Heiko Oberdiek |
| 9 |
% 2016-2019 Oberdiek Package Support Group |
| 10 |
% https://github.com/ho-tex/oberdiek/issues |
| 11 |
% |
| 12 |
% This work may be distributed and/or modified under the |
| 13 |
% conditions of the LaTeX Project Public License, either |
| 14 |
% version 1.3c of this license or (at your option) any later |
| 15 |
% version. This version of this license is in |
| 16 |
% https://www.latex-project.org/lppl/lppl-1-3c.txt |
| 17 |
% and the latest version of this license is in |
| 18 |
% https://www.latex-project.org/lppl.txt |
| 19 |
% and version 1.3 or later is part of all distributions of |
| 20 |
% LaTeX version 2005/12/01 or later. |
| 21 |
% |
| 22 |
% This work has the LPPL maintenance status "maintained". |
| 23 |
% |
| 24 |
% The Current Maintainers of this work are |
| 25 |
% Heiko Oberdiek and the Oberdiek Package Support Group |
| 26 |
% https://github.com/ho-tex/oberdiek/issues |
| 27 |
% |
| 28 |
% This work consists of the main source file settobox.dtx |
| 29 |
% and the derived files |
| 30 |
% settobox.sty, settobox.pdf, settobox.ins, settobox.drv, |
| 31 |
% settobox-example.tex. |
| 32 |
% |
| 33 |
% Distribution: |
| 34 |
% CTAN:macros/latex/contrib/oberdiek/settobox.dtx |
| 35 |
% CTAN:macros/latex/contrib/oberdiek/settobox.pdf |
| 36 |
% |
| 37 |
% Unpacking: |
| 38 |
% (a) If settobox.ins is present: |
| 39 |
% tex settobox.ins |
| 40 |
% (b) Without settobox.ins: |
| 41 |
% tex settobox.dtx |
| 42 |
% (c) If you insist on using LaTeX |
| 43 |
% latex \let\install=y\input{settobox.dtx} |
| 44 |
% (quote the arguments according to the demands of your shell) |
| 45 |
% |
| 46 |
% Documentation: |
| 47 |
% (a) If settobox.drv is present: |
| 48 |
% latex settobox.drv |
| 49 |
% (b) Without settobox.drv: |
| 50 |
% latex settobox.dtx; ... |
| 51 |
% The class ltxdoc loads the configuration file ltxdoc.cfg |
| 52 |
% if available. Here you can specify further options, e.g. |
| 53 |
% use A4 as paper format: |
| 54 |
% \PassOptionsToClass{a4paper}{article} |
| 55 |
% |
| 56 |
% Program calls to get the documentation (example): |
| 57 |
% pdflatex settobox.dtx |
| 58 |
% makeindex -s gind.ist settobox.idx |
| 59 |
% pdflatex settobox.dtx |
| 60 |
% makeindex -s gind.ist settobox.idx |
| 61 |
% pdflatex settobox.dtx |
| 62 |
% |
| 63 |
% Installation: |
| 64 |
% TDS:tex/latex/oberdiek/settobox.sty |
| 65 |
% TDS:doc/latex/oberdiek/settobox.pdf |
| 66 |
% TDS:doc/latex/oberdiek/settobox-example.tex |
| 67 |
% TDS:source/latex/oberdiek/settobox.dtx |
| 68 |
% |
| 69 |
%<*ignore> |
| 70 |
\begingroup |
| 71 |
\catcode123=1 % |
| 72 |
\catcode125=2 % |
| 73 |
\def\x{LaTeX2e}% |
| 74 |
\expandafter\endgroup |
| 75 |
\ifcase 0\ifx\install y1\fi\expandafter |
| 76 |
\ifx\csname processbatchFile\endcsname\relax\else1\fi |
| 77 |
\ifx\fmtname\x\else 1\fi\relax |
| 78 |
\else\csname fi\endcsname |
| 79 |
%</ignore> |
| 80 |
%<*install> |
| 81 |
\input docstrip.tex |
| 82 |
\Msg{************************************************************************} |
| 83 |
\Msg{* Installation} |
| 84 |
\Msg{* Package: settobox 2016/05/16 v1.5 Assign box dimensions to length registers (HO)} |
| 85 |
\Msg{************************************************************************} |
| 86 |
|
| 87 |
\keepsilent |
| 88 |
\askforoverwritefalse |
| 89 |
|
| 90 |
\let\MetaPrefix\relax |
| 91 |
\preamble |
| 92 |
|
| 93 |
This is a generated file. |
| 94 |
|
| 95 |
Project: settobox |
| 96 |
Version: 2016/05/16 v1.5 |
| 97 |
|
| 98 |
Copyright (C) |
| 99 |
2000, 2006-2008 Heiko Oberdiek |
| 100 |
2016-2019 Oberdiek Package Support Group |
| 101 |
|
| 102 |
This work may be distributed and/or modified under the |
| 103 |
conditions of the LaTeX Project Public License, either |
| 104 |
version 1.3c of this license or (at your option) any later |
| 105 |
version. This version of this license is in |
| 106 |
https://www.latex-project.org/lppl/lppl-1-3c.txt |
| 107 |
and the latest version of this license is in |
| 108 |
https://www.latex-project.org/lppl.txt |
| 109 |
and version 1.3 or later is part of all distributions of |
| 110 |
LaTeX version 2005/12/01 or later. |
| 111 |
|
| 112 |
This work has the LPPL maintenance status "maintained". |
| 113 |
|
| 114 |
The Current Maintainers of this work are |
| 115 |
Heiko Oberdiek and the Oberdiek Package Support Group |
| 116 |
https://github.com/ho-tex/oberdiek/issues |
| 117 |
|
| 118 |
|
| 119 |
This work consists of the main source file settobox.dtx |
| 120 |
and the derived files |
| 121 |
settobox.sty, settobox.pdf, settobox.ins, settobox.drv, |
| 122 |
settobox-example.tex. |
| 123 |
|
| 124 |
\endpreamble |
| 125 |
\let\MetaPrefix\DoubleperCent |
| 126 |
|
| 127 |
\generate{% |
| 128 |
\file{settobox.ins}{\from{settobox.dtx}{install}}% |
| 129 |
\file{settobox.drv}{\from{settobox.dtx}{driver}}% |
| 130 |
\usedir{tex/latex/oberdiek}% |
| 131 |
\file{settobox.sty}{\from{settobox.dtx}{package}}% |
| 132 |
\usedir{doc/latex/oberdiek}% |
| 133 |
\file{settobox-example.tex}{\from{settobox.dtx}{example}}% |
| 134 |
} |
| 135 |
|
| 136 |
\catcode32=13\relax% active space |
| 137 |
\let =\space% |
| 138 |
\Msg{************************************************************************} |
| 139 |
\Msg{*} |
| 140 |
\Msg{* To finish the installation you have to move the following} |
| 141 |
\Msg{* file into a directory searched by TeX:} |
| 142 |
\Msg{*} |
| 143 |
\Msg{* settobox.sty} |
| 144 |
\Msg{*} |
| 145 |
\Msg{* To produce the documentation run the file `settobox.drv'} |
| 146 |
\Msg{* through LaTeX.} |
| 147 |
\Msg{*} |
| 148 |
\Msg{* Happy TeXing!} |
| 149 |
\Msg{*} |
| 150 |
\Msg{************************************************************************} |
| 151 |
|
| 152 |
\endbatchfile |
| 153 |
%</install> |
| 154 |
%<*ignore> |
| 155 |
\fi |
| 156 |
%</ignore> |
| 157 |
%<*driver> |
| 158 |
\NeedsTeXFormat{LaTeX2e} |
| 159 |
\ProvidesFile{settobox.drv}% |
| 160 |
[2016/05/16 v1.5 Assign box dimensions to length registers (HO)]% |
| 161 |
\documentclass{ltxdoc} |
| 162 |
\usepackage{holtxdoc}[2011/11/22] |
| 163 |
\usepackage{calc} |
| 164 |
\usepackage{settobox} |
| 165 |
\begin{document} |
| 166 |
\DocInput{settobox.dtx}% |
| 167 |
\end{document} |
| 168 |
%</driver> |
| 169 |
% \fi |
| 170 |
% |
| 171 |
% |
| 172 |
% |
| 173 |
% \GetFileInfo{settobox.drv} |
| 174 |
% |
| 175 |
% \title{The \xpackage{settobox} package} |
| 176 |
% \date{2016/05/16 v1.5} |
| 177 |
% \author{Heiko Oberdiek\thanks |
| 178 |
% {Please report any issues at \url{https://github.com/ho-tex/oberdiek/issues}}} |
| 179 |
% |
| 180 |
% \maketitle |
| 181 |
% |
| 182 |
% \begin{abstract} |
| 183 |
% Commands are defined for getting box sizes similar |
| 184 |
% to \LaTeX's \cs{settowidth} commands. |
| 185 |
% \end{abstract} |
| 186 |
% |
| 187 |
% \tableofcontents |
| 188 |
% |
| 189 |
% \section{Usage} |
| 190 |
% |
| 191 |
% \subsection{Get box dimensions} |
| 192 |
% |
| 193 |
% \begin{declcs}^^A |
| 194 |
% {settoboxwidth}\,\M{\LaTeX\ length}\,\M{\LaTeX\ box}\\ |
| 195 |
% \SpecialUsageIndex{\settoboxheight}^^A |
| 196 |
% \cs{settoboxheight}\,\M{\LaTeX\ length}\,\M{\LaTeX\ box}\\ |
| 197 |
% \SpecialUsageIndex{\settoboxdepth}^^A |
| 198 |
% \cs{settoboxdepth}\,\M{\LaTeX\ length}\,\M{\LaTeX\ box}\\ |
| 199 |
% \SpecialUsageIndex{\settoboxtotalheight}^^A |
| 200 |
% \cs{settoboxtotalheight}\,\M{\LaTeX\ length}\,\M{\LaTeX\ box} |
| 201 |
% \end{declcs} |
| 202 |
% A \meta{\LaTeX\ box} is allocated by \cs{newsavebox}. |
| 203 |
% It can be filled by \cs{sbox} or the environment \texttt{lrbox}. |
| 204 |
% The commands above extract then the desired lengths. |
| 205 |
% |
| 206 |
% \subsection{Set box dimensions} |
| 207 |
% |
| 208 |
% \begin{declcs}^^A |
| 209 |
% {setboxwidth}\,\M{\LaTeX\ box}\,\M{\LaTeX\ length expression}\\ |
| 210 |
% \SpecialUsageIndex{\setboxheight}^^A |
| 211 |
% \cs{setboxheight}\,\M{\LaTeX\ box}\,\M{\LaTeX\ length expression}\\ |
| 212 |
% \SpecialUsageIndex{\setboxdepth}^^A |
| 213 |
% \cs{setboxdepth}\,\M{\LaTeX\ box}\,\M{\LaTeX\ length expression} |
| 214 |
% \end{declcs} |
| 215 |
% These commands allow the manipulation of the box. Package \xpackage{calc} |
| 216 |
% is supported in the \meta{\LaTeX\ length expression}. |
| 217 |
% Also the following length are available in this expression: |
| 218 |
% \begin{quote} |
| 219 |
% \begin{tabular}{@{}ll@{}} |
| 220 |
% \cs{width}& width of the box\\ |
| 221 |
% \cs{height}& height of the box\\ |
| 222 |
% \cs{depth}& depth of the box\\ |
| 223 |
% \cs{totalheight}& totalheight of the box\\ |
| 224 |
% \end{tabular} |
| 225 |
% \end{quote} |
| 226 |
% Note, the base point (point at the left margin of the baseline) |
| 227 |
% always remain constant. |
| 228 |
% |
| 229 |
% \subsection{Move box} |
| 230 |
% |
| 231 |
% \begin{declcs}^^A |
| 232 |
% {setboxmoveleft}\,\M{\LaTeX\ box}\,\M{\LaTeX\ length expression}\\ |
| 233 |
% \SpecialUsageIndex{\setboxmoveright}^^A |
| 234 |
% \cs{setboxmoveright}\,\M{\LaTeX\ box}\,\M{\LaTeX\ length expression}\\ |
| 235 |
% \SpecialUsageIndex{\setboxlower}^^A |
| 236 |
% \cs{setboxlower}\,\M{\LaTeX\ box}\,\M{\LaTeX\ length expression}\\ |
| 237 |
% \SpecialUsageIndex{\setboxright}^^A |
| 238 |
% \cs{setboxright}\,\M{\LaTeX\ box}\,\M{\LaTeX\ length expression} |
| 239 |
% \end{declcs} |
| 240 |
% Note, the box is shifted relative to the base point. The base point |
| 241 |
% is always inside the box, however the width and height of the |
| 242 |
% box change along with the movement. |
| 243 |
% |
| 244 |
% \subsection{Example} |
| 245 |
% |
| 246 |
% \subsubsection{Short example} |
| 247 |
% |
| 248 |
% \begin{quote} |
| 249 |
%\begin{verbatim} |
| 250 |
%\newsavebox{\mybox} |
| 251 |
%\newlength{\mylength} |
| 252 |
%\sbox{\mybox}{Hello World} |
| 253 |
%\settoboxwidth{\mylength}{\mybox} |
| 254 |
%\end{verbatim} |
| 255 |
% \end{quote} |
| 256 |
% |
| 257 |
% \subsubsection{Test file that shows box manipulations} |
| 258 |
% |
| 259 |
% \begin{macrocode} |
| 260 |
%<*example> |
| 261 |
%<<END |
| 262 |
\documentclass{article} |
| 263 |
|
| 264 |
\usepackage{settobox} |
| 265 |
\usepackage{calc} |
| 266 |
|
| 267 |
\newsavebox{\mybox} |
| 268 |
|
| 269 |
\setlength{\fboxsep}{0pt} |
| 270 |
\setlength{\parindent}{20pt} |
| 271 |
\setlength{\parskip}{10pt} |
| 272 |
\pagestyle{empty} |
| 273 |
|
| 274 |
% \test{#1} |
| 275 |
% The macro is called with commands in #1 that manipulates |
| 276 |
% the box \mybox. These commands along with the result of |
| 277 |
% the manipulation is shown. Thus the essence of the |
| 278 |
% macro is: |
| 279 |
% |
| 280 |
% a) \sbox{\mybox}{The cracy fox.} |
| 281 |
% b) #1 % manipulates \mybox |
| 282 |
% c) Print #1 commands. |
| 283 |
% d) Print box with frame |
| 284 |
% |
| 285 |
% The implementation looks more weird: |
| 286 |
\makeatletter |
| 287 |
\newcommand*{\test}[1]{% |
| 288 |
\par |
| 289 |
\begingroup |
| 290 |
\raggedright |
| 291 |
\edef\x{\detokenize{#1}}% |
| 292 |
\let\do\@makeother |
| 293 |
\dospecials |
| 294 |
\catcode`\~\active |
| 295 |
\catcode`\ =10\relax |
| 296 |
\def~{\\}% |
| 297 |
\noindent |
| 298 |
\texttt{\scantokens\expandafter{\x}}% |
| 299 |
\par |
| 300 |
\endgroup |
| 301 |
\begingroup |
| 302 |
\let~\relax |
| 303 |
\sbox{\mybox}{The cracy fox.}% |
| 304 |
#1% |
| 305 |
A---\fbox{\usebox\mybox}---B% |
| 306 |
\endgroup |
| 307 |
\par |
| 308 |
} |
| 309 |
\makeatother |
| 310 |
|
| 311 |
\begin{document} |
| 312 |
|
| 313 |
\test{\setboxwidth{\mybox}{1.25\width}} |
| 314 |
\test{\setboxheight{\mybox}{0pt}} |
| 315 |
\test{\setboxheight{\mybox}{2\height}} |
| 316 |
\test{\setboxdepth{\mybox}{\height}} |
| 317 |
\test{\setboxmoveleft{\mybox}{5pt}} |
| 318 |
\test{% |
| 319 |
\setboxmoveleft{\mybox}{5pt}~% |
| 320 |
\setboxwidth{\mybox}{\width + 5pt}% |
| 321 |
} |
| 322 |
\test{\setboxmoveright{\mybox}{0.5\width}} |
| 323 |
\test{\setboxlower{\mybox}{\height}} |
| 324 |
\test{\setboxraise{\mybox}{\depth}} |
| 325 |
\test{% |
| 326 |
\setboxmoveright{\mybox}{5pt}~% |
| 327 |
\setboxwidth{\mybox}{\width + 5pt}~% |
| 328 |
\setboxheight{\mybox}{\height + 5pt}~% |
| 329 |
\setboxdepth{\mybox}{\depth + 5pt}% |
| 330 |
} |
| 331 |
|
| 332 |
\end{document} |
| 333 |
%END |
| 334 |
%</example> |
| 335 |
% \end{macrocode} |
| 336 |
% |
| 337 |
% \noindent |
| 338 |
% The result: |
| 339 |
% |
| 340 |
% \vspace{1ex} |
| 341 |
% \hrule |
| 342 |
% |
| 343 |
% \begingroup |
| 344 |
% \newsavebox{\mybox} |
| 345 |
% |
| 346 |
% \setlength{\fboxsep}{0pt} |
| 347 |
% \setlength{\parindent}{20pt} |
| 348 |
% \setlength{\parskip}{10pt} |
| 349 |
% |
| 350 |
% \makeatletter |
| 351 |
% \newcommand*{\test}[1]{^^A |
| 352 |
% \par |
| 353 |
% \begingroup |
| 354 |
% \raggedright |
| 355 |
% \edef\x{\detokenize{#1}} |
| 356 |
% \let\do\@makeother |
| 357 |
% \dospecials |
| 358 |
% \catcode`\~\active |
| 359 |
% \catcode`\ =10\relax |
| 360 |
% \def~{\\}^^A |
| 361 |
% \noindent |
| 362 |
% \texttt{\scantokens\expandafter{\x}} |
| 363 |
% \par |
| 364 |
% \endgroup |
| 365 |
% \begingroup |
| 366 |
% \let~\relax |
| 367 |
% \sbox{\mybox}{The cracy fox.} |
| 368 |
% #1^^A |
| 369 |
% A---\fbox{\usebox\mybox}---B |
| 370 |
% \endgroup |
| 371 |
% \par |
| 372 |
% } |
| 373 |
% \makeatother |
| 374 |
% |
| 375 |
% \test{\setboxwidth{\mybox}{1.25\width}} |
| 376 |
% \test{\setboxheight{\mybox}{0pt}} |
| 377 |
% \test{\setboxheight{\mybox}{2\height}} |
| 378 |
% \test{\setboxdepth{\mybox}{\height}} |
| 379 |
% \test{\setboxmoveleft{\mybox}{5pt}} |
| 380 |
% \test{^^A |
| 381 |
% \setboxmoveleft{\mybox}{5pt}~^^A |
| 382 |
% \setboxwidth{\mybox}{\width + 5pt}^^A |
| 383 |
% } |
| 384 |
% \test{\setboxmoveright{\mybox}{0.5\width}} |
| 385 |
% \test{\setboxlower{\mybox}{\height}} |
| 386 |
% \test{\setboxraise{\mybox}{\depth}} |
| 387 |
% \test{^^A |
| 388 |
% \setboxmoveright{\mybox}{5pt}~^^A |
| 389 |
% \setboxwidth{\mybox}{\width + 5pt}~^^A |
| 390 |
% \setboxheight{\mybox}{\height + 5pt}~^^A |
| 391 |
% \setboxdepth{\mybox}{\depth + 5pt}^^A |
| 392 |
% } |
| 393 |
% |
| 394 |
% \endgroup |
| 395 |
% \vspace{1ex} |
| 396 |
% \hrule |
| 397 |
% \vspace{4ex} |
| 398 |
% |
| 399 |
% \StopEventually{ |
| 400 |
% } |
| 401 |
% |
| 402 |
% \section{Implementation} |
| 403 |
% |
| 404 |
% \begin{macrocode} |
| 405 |
%<*package> |
| 406 |
% \end{macrocode} |
| 407 |
% Package identification. |
| 408 |
% \begin{macrocode} |
| 409 |
\NeedsTeXFormat{LaTeX2e} |
| 410 |
\ProvidesPackage{settobox}% |
| 411 |
[2016/05/16 v1.5 Assign box dimensions to length registers (HO)] |
| 412 |
% \end{macrocode} |
| 413 |
% |
| 414 |
% \begin{macrocode} |
| 415 |
\newcommand*{\settoboxwidth}[2]{\setlength{#1}{\wd#2}} |
| 416 |
\newcommand*{\settoboxheight}[2]{\setlength{#1}{\ht#2}} |
| 417 |
\newcommand*{\settoboxdepth}[2]{\setlength{#1}{\dp#2}} |
| 418 |
\newcommand*{\settoboxtotalheight}[2]{% |
| 419 |
\setlength{#1}{\ht#2}% |
| 420 |
\addtolength{#1}{\dp#2}% |
| 421 |
} |
| 422 |
% \end{macrocode} |
| 423 |
% |
| 424 |
% \begin{macro}{\setboxwidth} |
| 425 |
% \begin{macrocode} |
| 426 |
\newcommand*{\setboxwidth}[2]{% |
| 427 |
\settobox@length\wd{#1}{#2}% |
| 428 |
} |
| 429 |
% \end{macrocode} |
| 430 |
% \end{macro} |
| 431 |
% \begin{macro}{\setboxheight} |
| 432 |
% \begin{macrocode} |
| 433 |
\newcommand*{\setboxheight}[2]{% |
| 434 |
\settobox@length\ht{#1}{#2}% |
| 435 |
} |
| 436 |
% \end{macrocode} |
| 437 |
% \end{macro} |
| 438 |
% \begin{macro}{\setboxheight} |
| 439 |
% \begin{macrocode} |
| 440 |
\newcommand*{\setboxdepth}[2]{% |
| 441 |
\settobox@length\dp{#1}{#2}% |
| 442 |
} |
| 443 |
% \end{macrocode} |
| 444 |
% \end{macro} |
| 445 |
% \begin{macro}{\setboxmoveleft} |
| 446 |
% \begin{macrocode} |
| 447 |
\newcommand*{\setboxmoveleft}[2]{% |
| 448 |
\settobox@horiz{-}{#1}{#2}% |
| 449 |
} |
| 450 |
% \end{macrocode} |
| 451 |
% \end{macro} |
| 452 |
% \begin{macro}{\setboxmoveright} |
| 453 |
% \begin{macrocode} |
| 454 |
\newcommand*{\setboxmoveright}[2]{% |
| 455 |
\settobox@horiz{}{#1}{#2}% |
| 456 |
} |
| 457 |
% \end{macrocode} |
| 458 |
% \end{macro} |
| 459 |
% \begin{macro}{\setboxlower} |
| 460 |
% \begin{macrocode} |
| 461 |
\newcommand*{\setboxlower}[2]{% |
| 462 |
\settobox@vert\lower{#1}{#2}% |
| 463 |
} |
| 464 |
% \end{macrocode} |
| 465 |
% \end{macro} |
| 466 |
% \begin{macro}{\setboxraise} |
| 467 |
% \begin{macrocode} |
| 468 |
\newcommand*{\setboxraise}[2]{% |
| 469 |
\settobox@vert\raise{#1}{#2}% |
| 470 |
} |
| 471 |
% \end{macrocode} |
| 472 |
% \end{macro} |
| 473 |
% \begin{macro}{\settobox@length} |
| 474 |
% The work for the \cs{setbox...} commands is done by |
| 475 |
% \cs{settobox@length}. Inside the length expression |
| 476 |
% \cs{width}, \cs{height}, \cs{depth}, \cs{totalheight} |
| 477 |
% are set to the dimensions of the box.\\ |
| 478 |
% \begin{tabular}{@{}ll@{}} |
| 479 |
% |#1|:& the property of the box that is to be changed |
| 480 |
% (\cs{wd}, \cs{ht}, \cs{dp})\\ |
| 481 |
% |#2|:& the box\\ |
| 482 |
% |#3|:& length expression |
| 483 |
% \end{tabular} |
| 484 |
% \begin{macrocode} |
| 485 |
\def\settobox@length#1#2#3{% |
| 486 |
\settobox@calc{#2}{#3}{#1#2=##1sp\relax}% |
| 487 |
} |
| 488 |
% \end{macrocode} |
| 489 |
% \end{macro} |
| 490 |
% |
| 491 |
% \begin{macro}{\settobox@horiz} |
| 492 |
% \begin{macrocode} |
| 493 |
\def\settobox@horiz#1#2#3{% |
| 494 |
\settobox@calc{#2}{#3}{\setbox#2=\hbox{\kern#1##1sp\copy#2}}% |
| 495 |
} |
| 496 |
% \end{macrocode} |
| 497 |
% \end{macro} |
| 498 |
% \begin{macro}{\settobox@vert} |
| 499 |
% \begin{macrocode} |
| 500 |
\def\settobox@vert#1#2#3{% |
| 501 |
\settobox@calc{#2}{#3}{\setbox#2=\hbox{#1##1sp\copy#2}}% |
| 502 |
} |
| 503 |
% \end{macrocode} |
| 504 |
% \end{macro} |
| 505 |
% |
| 506 |
% \begin{macro}{\settobox@calc} |
| 507 |
% \begin{macrocode} |
| 508 |
\def\settobox@calc#1#2#3{% |
| 509 |
\begingroup |
| 510 |
\def\width{\wd#1}% |
| 511 |
\def\height{\ht#1}% |
| 512 |
\def\depth{\dp#1}% |
| 513 |
\dimen@\ht#1\relax |
| 514 |
\advance\dimen@\dp#1\relax |
| 515 |
\def\totalheight{\dimen@}% |
| 516 |
\setlength{\dimen@}{#2}% |
| 517 |
\count@\dimen@ |
| 518 |
\def\x##1{\endgroup |
| 519 |
#3% |
| 520 |
}% |
| 521 |
\expandafter\x\expandafter{\the\count@}% |
| 522 |
} |
| 523 |
% \end{macrocode} |
| 524 |
% \end{macro} |
| 525 |
% |
| 526 |
% \begin{macrocode} |
| 527 |
%</package> |
| 528 |
% \end{macrocode} |
| 529 |
% |
| 530 |
% \section{Installation} |
| 531 |
% |
| 532 |
% \subsection{Download} |
| 533 |
% |
| 534 |
% \paragraph{Package.} This package is available on |
| 535 |
% CTAN\footnote{\CTANpkg{settobox}}: |
| 536 |
% \begin{description} |
| 537 |
% \item[\CTAN{macros/latex/contrib/oberdiek/settobox.dtx}] The source file. |
| 538 |
% \item[\CTAN{macros/latex/contrib/oberdiek/settobox.pdf}] Documentation. |
| 539 |
% \end{description} |
| 540 |
% |
| 541 |
% |
| 542 |
% \paragraph{Bundle.} All the packages of the bundle `oberdiek' |
| 543 |
% are also available in a TDS compliant ZIP archive. There |
| 544 |
% the packages are already unpacked and the documentation files |
| 545 |
% are generated. The files and directories obey the TDS standard. |
| 546 |
% \begin{description} |
| 547 |
% \item[\CTANinstall{install/macros/latex/contrib/oberdiek.tds.zip}] |
| 548 |
% \end{description} |
| 549 |
% \emph{TDS} refers to the standard ``A Directory Structure |
| 550 |
% for \TeX\ Files'' (\CTANpkg{tds}). Directories |
| 551 |
% with \xfile{texmf} in their name are usually organized this way. |
| 552 |
% |
| 553 |
% \subsection{Bundle installation} |
| 554 |
% |
| 555 |
% \paragraph{Unpacking.} Unpack the \xfile{oberdiek.tds.zip} in the |
| 556 |
% TDS tree (also known as \xfile{texmf} tree) of your choice. |
| 557 |
% Example (linux): |
| 558 |
% \begin{quote} |
| 559 |
% |unzip oberdiek.tds.zip -d ~/texmf| |
| 560 |
% \end{quote} |
| 561 |
% |
| 562 |
% \subsection{Package installation} |
| 563 |
% |
| 564 |
% \paragraph{Unpacking.} The \xfile{.dtx} file is a self-extracting |
| 565 |
% \docstrip\ archive. The files are extracted by running the |
| 566 |
% \xfile{.dtx} through \plainTeX: |
| 567 |
% \begin{quote} |
| 568 |
% \verb|tex settobox.dtx| |
| 569 |
% \end{quote} |
| 570 |
% |
| 571 |
% \paragraph{TDS.} Now the different files must be moved into |
| 572 |
% the different directories in your installation TDS tree |
| 573 |
% (also known as \xfile{texmf} tree): |
| 574 |
% \begin{quote} |
| 575 |
% \def\t{^^A |
| 576 |
% \begin{tabular}{@{}>{\ttfamily}l@{ $\rightarrow$ }>{\ttfamily}l@{}} |
| 577 |
% settobox.sty & tex/latex/oberdiek/settobox.sty\\ |
| 578 |
% settobox.pdf & doc/latex/oberdiek/settobox.pdf\\ |
| 579 |
% settobox-example.tex & doc/latex/oberdiek/settobox-example.tex\\ |
| 580 |
% settobox.dtx & source/latex/oberdiek/settobox.dtx\\ |
| 581 |
% \end{tabular}^^A |
| 582 |
% }^^A |
| 583 |
% \sbox0{\t}^^A |
| 584 |
% \ifdim\wd0>\linewidth |
| 585 |
% \begingroup |
| 586 |
% \advance\linewidth by\leftmargin |
| 587 |
% \advance\linewidth by\rightmargin |
| 588 |
% \edef\x{\endgroup |
| 589 |
% \def\noexpand\lw{\the\linewidth}^^A |
| 590 |
% }\x |
| 591 |
% \def\lwbox{^^A |
| 592 |
% \leavevmode |
| 593 |
% \hbox to \linewidth{^^A |
| 594 |
% \kern-\leftmargin\relax |
| 595 |
% \hss |
| 596 |
% \usebox0 |
| 597 |
% \hss |
| 598 |
% \kern-\rightmargin\relax |
| 599 |
% }^^A |
| 600 |
% }^^A |
| 601 |
% \ifdim\wd0>\lw |
| 602 |
% \sbox0{\small\t}^^A |
| 603 |
% \ifdim\wd0>\linewidth |
| 604 |
% \ifdim\wd0>\lw |
| 605 |
% \sbox0{\footnotesize\t}^^A |
| 606 |
% \ifdim\wd0>\linewidth |
| 607 |
% \ifdim\wd0>\lw |
| 608 |
% \sbox0{\scriptsize\t}^^A |
| 609 |
% \ifdim\wd0>\linewidth |
| 610 |
% \ifdim\wd0>\lw |
| 611 |
% \sbox0{\tiny\t}^^A |
| 612 |
% \ifdim\wd0>\linewidth |
| 613 |
% \lwbox |
| 614 |
% \else |
| 615 |
% \usebox0 |
| 616 |
% \fi |
| 617 |
% \else |
| 618 |
% \lwbox |
| 619 |
% \fi |
| 620 |
% \else |
| 621 |
% \usebox0 |
| 622 |
% \fi |
| 623 |
% \else |
| 624 |
% \lwbox |
| 625 |
% \fi |
| 626 |
% \else |
| 627 |
% \usebox0 |
| 628 |
% \fi |
| 629 |
% \else |
| 630 |
% \lwbox |
| 631 |
% \fi |
| 632 |
% \else |
| 633 |
% \usebox0 |
| 634 |
% \fi |
| 635 |
% \else |
| 636 |
% \lwbox |
| 637 |
% \fi |
| 638 |
% \else |
| 639 |
% \usebox0 |
| 640 |
% \fi |
| 641 |
% \end{quote} |
| 642 |
% If you have a \xfile{docstrip.cfg} that configures and enables \docstrip's |
| 643 |
% TDS installing feature, then some files can already be in the right |
| 644 |
% place, see the documentation of \docstrip. |
| 645 |
% |
| 646 |
% \subsection{Refresh file name databases} |
| 647 |
% |
| 648 |
% If your \TeX~distribution |
| 649 |
% (\TeX\,Live, \mikTeX, \dots) relies on file name databases, you must refresh |
| 650 |
% these. For example, \TeX\,Live\ users run \verb|texhash| or |
| 651 |
% \verb|mktexlsr|. |
| 652 |
% |
| 653 |
% \subsection{Some details for the interested} |
| 654 |
% |
| 655 |
% \paragraph{Unpacking with \LaTeX.} |
| 656 |
% The \xfile{.dtx} chooses its action depending on the format: |
| 657 |
% \begin{description} |
| 658 |
% \item[\plainTeX:] Run \docstrip\ and extract the files. |
| 659 |
% \item[\LaTeX:] Generate the documentation. |
| 660 |
% \end{description} |
| 661 |
% If you insist on using \LaTeX\ for \docstrip\ (really, |
| 662 |
% \docstrip\ does not need \LaTeX), then inform the autodetect routine |
| 663 |
% about your intention: |
| 664 |
% \begin{quote} |
| 665 |
% \verb|latex \let\install=y\input{settobox.dtx}| |
| 666 |
% \end{quote} |
| 667 |
% Do not forget to quote the argument according to the demands |
| 668 |
% of your shell. |
| 669 |
% |
| 670 |
% \paragraph{Generating the documentation.} |
| 671 |
% You can use both the \xfile{.dtx} or the \xfile{.drv} to generate |
| 672 |
% the documentation. The process can be configured by the |
| 673 |
% configuration file \xfile{ltxdoc.cfg}. For instance, put this |
| 674 |
% line into this file, if you want to have A4 as paper format: |
| 675 |
% \begin{quote} |
| 676 |
% \verb|\PassOptionsToClass{a4paper}{article}| |
| 677 |
% \end{quote} |
| 678 |
% An example follows how to generate the |
| 679 |
% documentation with pdf\LaTeX: |
| 680 |
% \begin{quote} |
| 681 |
%\begin{verbatim} |
| 682 |
%pdflatex settobox.dtx |
| 683 |
%makeindex -s gind.ist settobox.idx |
| 684 |
%pdflatex settobox.dtx |
| 685 |
%makeindex -s gind.ist settobox.idx |
| 686 |
%pdflatex settobox.dtx |
| 687 |
%\end{verbatim} |
| 688 |
% \end{quote} |
| 689 |
% |
| 690 |
% \begin{History} |
| 691 |
% \begin{Version}{2000/02/11 v1.0} |
| 692 |
% \item |
| 693 |
% First public release, written as answer in the |
| 694 |
% newsgroup \xnewsgroup{de.comp.text.tex}: |
| 695 |
% \URL{``\link{Die Hoehe von Minipages und Bild}''}^^A |
| 696 |
% {https://groups.google.com/group/de.comp.text.tex/msg/c3f6446f54f66c02} |
| 697 |
% \end{Version} |
| 698 |
% \begin{Version}{2000/09/07 v1.1} |
| 699 |
% \item |
| 700 |
% Documentation added. |
| 701 |
% \item |
| 702 |
% CTAN release. |
| 703 |
% \end{Version} |
| 704 |
% \begin{Version}{2006/02/20 v1.2} |
| 705 |
% \item |
| 706 |
% \cs{setboxwidth}, \cs{setboxheight}, \cs{setboxdepth} added. |
| 707 |
% \item |
| 708 |
% Box move commands added. |
| 709 |
% \item |
| 710 |
% DTX framework. |
| 711 |
% \item |
| 712 |
% LPPL 1.3 |
| 713 |
% \end{Version} |
| 714 |
% \begin{Version}{2007/04/11 v1.3} |
| 715 |
% \item |
| 716 |
% Line ends sanitized. |
| 717 |
% \end{Version} |
| 718 |
% \begin{Version}{2008/08/11 v1.4} |
| 719 |
% \item |
| 720 |
% Code is not changed. |
| 721 |
% \item |
| 722 |
% URLs updated. |
| 723 |
% \end{Version} |
| 724 |
% \begin{Version}{2016/05/16 v1.5} |
| 725 |
% \item |
| 726 |
% Documentation updates. |
| 727 |
% \end{Version} |
| 728 |
% \end{History} |
| 729 |
% |
| 730 |
% \PrintIndex |
| 731 |
% |
| 732 |
% \Finale |
| 733 |
\endinput |