summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/sttools/boundbox.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-01-13 00:07:56 +0000
committerKarl Berry <karl@freefriends.org>2006-01-13 00:07:56 +0000
commit90905949da34ee02fd885fc494a50360f00e296d (patch)
tree9c0b80cfc6dd9a35a268dfe3557341e496f97611 /Master/texmf-dist/tex/latex/sttools/boundbox.sty
parent6ecc8cbfd257eb7f97e87528164659d6c031ba07 (diff)
sttools
git-svn-id: svn://tug.org/texlive/trunk@1351 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/sttools/boundbox.sty')
-rw-r--r--Master/texmf-dist/tex/latex/sttools/boundbox.sty85
1 files changed, 85 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/sttools/boundbox.sty b/Master/texmf-dist/tex/latex/sttools/boundbox.sty
new file mode 100644
index 00000000000..a08ac801f9e
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/sttools/boundbox.sty
@@ -0,0 +1,85 @@
+%% 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 \ No newline at end of file