%% boundbox.sty %% Copyright 1997 Sigitas Tolu\v sis %% VTeX Ltd., Akademijos 4, Vilnius, Lithuania %% e-mail sigitas@vtex.lt %% http://www.vtex.lt/tex/download/macros/ %% % This program can redistributed and/or modified under the terms % of the LaTeX Project Public License Distributed from CTAN % archives in directory macros/latex/base/lppl.txt; either % version 1 of the License, or (at your option) any later version. % % PURPOSE: Calculate TeX Bounding Box in points (LaTeX2e) % % SHORT DESCRIPTION: % % \@calculate % ----------- % Internal macro \@calculate writes TeX box dimensions % to the token list \bound in such format: % % \bound{left=x1 top=y1 right=x2 bottom=y2} % % x1 - distance in points from the left side of paper % to the left side of TeX box % y1 - distance in points from the top of paper % to the top of TeX box (including head) % x2 - distance in points from the left side of paper % to the right side of TeX box % y2 - distance in points from the top of paper % to the bottom of TeX box % (including foot; with option "nofoot" without foot) % % \topoint#1#2 % ------------ % Dimension #1 in any unit of measure converts to value in points % and defines it to macro #2 % % This package writes such special to DVI: % \special{mt:TeXBBox left=x1 top=y1 right=x2 bottom=y2} % % \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{boundbox}[1998/02/24] % \newif\if@withfoot \@withfoottrue \DeclareOption{nofoot}{\global\@withfootfalse} \ProcessOptions % \newtoks\bound \bound={}% \def\@@to#1#2{\begingroup \xdef\a@act{\global\noexpand#1{\the#1#2}}\a@act \endgroup} % \def\topoint#1#2{% \@tempdimb=#1 \@tempcnta=\@tempdimb \multiply\@tempcnta by10 \divide\@tempcnta by18647 \advance\@tempcnta by1 \multiply\@tempcnta by72 \divide\@tempcnta by2540 \expandafter\def\expandafter#2\expandafter{\the\@tempcnta}} % \def\@calculate{% \@tempdima=1in \advance\@tempdima by\hoffset \advance\@tempdima by\oddsidemargin \topoint{\@tempdima}{\@a}% \advance\@tempdima\textwidth \topoint{\@tempdima}{\@c}% \@tempdima=1in \advance\@tempdima by\voffset \advance\@tempdima by\topmargin \topoint{\@tempdima}{\@b}% \advance\@tempdima by\headheight \advance\@tempdima by\headsep \advance\@tempdima\textheight \if@withfoot \advance\@tempdima\footskip \fi \topoint{\@tempdima}{\@d}% \@tempcnta=\@d \expandafter\def\expandafter\@d\expandafter{\the\@tempcnta}% \@@to\bound{left=\@a\space top=\@b\space right=\@c\space bottom=\@d}% } \AtBeginDocument{\@calculate\special{mt:TeXBBox \the\bound}} \endinput