home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Utilities / Text / OzTeX 1.9 / TeX-inputs / Tools / layout.sty < prev    next >
Encoding:
Text File  |  1995-01-24  |  10.7 KB  |  345 lines  |  [TEXT/MPS ]

  1. %% 
  2. %% This is file `layout.sty', generated 
  3. %% on <1995/1/24> with the docstrip utility (2.2i).
  4. %% 
  5. %% The original source files were:
  6. %% 
  7. %% layout.dtx  (with options: `package')
  8. %% 
  9. %% IMPORTANT NOTICE: 
  10. %% This file is part of the `tools' bundle 
  11. %% in the LaTeX2e distribution. 
  12. %% 
  13. %% You are not allowed to distribute this file. 
  14. %% For distribution of the original source see 
  15. %% the copyright notice in the source file, and 
  16. %% in the file readme.txt distributed with the 
  17. %% tools bundle. 
  18. %% 
  19. \NeedsTeXFormat{LaTeX2e}
  20. \ProvidesPackage{layout}
  21.                 [1994/10/29 v1.1e
  22.                  Show layout parameters]
  23. \DeclareOption{dutch}{%
  24.   \def\Headertext{Kopregel}
  25.   \def\Bodytext{Broodtekst}
  26.   \def\Footertext{Voetregel}
  27.   \def\MarginNotestext{Marge\\Notities}
  28.   \def\oneinchtext{een inch}
  29.   }
  30. \DeclareOption{english}{%
  31.   \def\Headertext{Header}
  32.   \def\Bodytext{Body}
  33.   \def\Footertext{Footer}
  34.   \def\MarginNotestext{Margin\\Notes}
  35.   \def\oneinchtext{one inch}
  36.   }
  37. \DeclareOption{verbose}{\let\type\typeout}
  38. \DeclareOption{silent}{\let\type\@gobble}
  39. \ExecuteOptions{english,silent}
  40. \ProcessOptions
  41. \@ifundefined{bs}{\newcommand\bs{\char '134 }}%
  42.   {\renewcommand\bs{\char '134 }}
  43. \def\ConvertToCount#1#2{%
  44.   #1=#2
  45.   \divide #1 by 65536}
  46. \def\SetToHalf#1#2{#1=#2\relax\divide#1by\tw@}
  47. \def\SetToQuart#1#2{#1=#2\relax\divide#1by4}
  48. \def\Identify#1{%
  49.   \put(\PositionX,\PositionY){\circle{20}}
  50.   \put(\PositionX,\PositionY){\makebox(0,0){\tiny #1}}
  51. }
  52. \def\InsideHArrow#1{{%
  53.   \ArrowLength = #1
  54.   \divide\ArrowLength by \tw@
  55.   \advance\ArrowLength by -10
  56.   \advance\PositionX by -10
  57.   \ifnum\ArrowLength<\z@
  58.     \put(\PositionX,\PositionY){\vector(1,0){-\ArrowLength}}
  59.     \advance\PositionX by 20
  60.     \put(\PositionX,\PositionY){\vector(-1,0){-\ArrowLength}}
  61.   \else
  62.     \put(\PositionX,\PositionY){\vector(-1,0){\ArrowLength}}
  63.     \advance\PositionX by 20
  64.     \put(\PositionX,\PositionY){\vector(+1,0){\ArrowLength}}
  65.   \fi
  66. }}
  67. \def\InsideVArrow#1{{%
  68.   \ArrowLength = #1
  69.   \divide\ArrowLength by \tw@
  70.   \advance\ArrowLength by -10
  71.   \advance\PositionY by -10
  72.   \put(\PositionX,\PositionY){\vector(0,-1){\ArrowLength}}
  73.   \advance\PositionY by 20
  74.   \put(\PositionX,\PositionY){\vector(0,+1){\ArrowLength}}
  75. }}
  76. \def\OutsideHArrow#1#2#3{{%
  77.   \PositionX = #1
  78.   \advance\PositionX by #3
  79.   \put(\PositionX,\PositionY){\vector(-1,0){#3}}
  80.   \PositionX = #1 \advance\PositionX-#2
  81.   \advance\PositionX by -#3
  82.   \put(\PositionX,\PositionY){\vector(+1,0){#3}}
  83. }}
  84. \def\OutsideVArrow#1#2#3#4{{%
  85.   \PositionY = #1
  86.   \advance\PositionY by -#3
  87.   \put(\PositionX,\PositionY){\vector(0,+1){#3}}
  88.   \PositionY = #1
  89.   \advance\PositionY#2
  90.   \advance\PositionY#4
  91.   \put(\PositionX,\PositionY){\vector(0,-1){#4}}
  92. }}
  93. \def\Show#1#2{\bs #2 = \expandafter\number\csname #1@#2\endcsname pt}
  94. \def\Type#1#2{%
  95.   \type{#2 = \expandafter\number\csname #1@#2\endcsname pt}}
  96. \newcount\oneinch
  97. \oneinch=72
  98. \newcount\cnt@paperwidth
  99. \newcount\cnt@paperheight
  100. \ConvertToCount\cnt@paperwidth\paperwidth
  101. \ConvertToCount\cnt@paperheight\paperheight
  102. \newcount\cnt@hoffset
  103. \newcount\cnt@voffset
  104. \ConvertToCount\cnt@hoffset\hoffset
  105. \ConvertToCount\cnt@voffset\voffset
  106. \newcount\cnt@textheight
  107. \newcount\cnt@textwidth
  108. \ConvertToCount\cnt@textheight\textheight
  109. \ConvertToCount\cnt@textwidth\textwidth
  110. \newcount\cnt@topmargin
  111. \newcount\cnt@oddsidemargin
  112. \newcount\cnt@evensidemargin
  113. \ConvertToCount\cnt@topmargin\topmargin
  114. \ConvertToCount\cnt@oddsidemargin\oddsidemargin
  115. \ConvertToCount\cnt@evensidemargin\evensidemargin
  116. \newcount\cnt@headheight
  117. \newcount\cnt@headsep
  118. \ConvertToCount\cnt@headheight\headheight
  119. \ConvertToCount\cnt@headsep\headsep
  120. \newcount\cnt@marginparsep
  121. \newcount\cnt@marginparwidth
  122. \newcount\cnt@marginparpush
  123. \ConvertToCount\cnt@marginparsep\marginparsep
  124. \ConvertToCount\cnt@marginparwidth\marginparwidth
  125. \ConvertToCount\cnt@marginparpush\marginparpush
  126. \newcount\cnt@footskip
  127. \ConvertToCount\cnt@footskip\footskip
  128. \newcount\fheight
  129. \fheight=12
  130. \newcount\ref@top
  131. \ref@top=\cnt@paperheight \advance\ref@top by -\oneinch
  132. \newcount\ref@hoffset
  133. \newcount\ref@voffset
  134. \ref@hoffset=\cnt@hoffset  \advance\cnt@hoffset by \oneinch
  135. \ref@voffset=\cnt@voffset
  136. \cnt@voffset=\ref@top
  137. \advance\cnt@voffset by -\ref@voffset
  138. \newcount\ref@head
  139. \ref@head=\ref@top
  140.   \advance\ref@head by -\ref@voffset
  141.   \advance\ref@head by -\cnt@topmargin
  142.   \advance\ref@head by -\cnt@headheight
  143. \newcount\ref@body
  144. \ref@body=\ref@head
  145.   \advance\ref@body by -\cnt@headsep
  146.   \advance\ref@body by -\cnt@textheight
  147. \newcount\ref@foot
  148.   \ref@foot=\ref@body
  149.   \advance\ref@foot by -\cnt@footskip
  150. \newcount\ref@margin
  151. \newcount\ref@marginwidth
  152. \newcount\ref@marginpar
  153. \newcount\Interval
  154. \newcount\ExtraYPos
  155. \newcount\PositionX
  156. \newcount\PositionY
  157. \newcount\ArrowLength
  158. \newcommand\layout{%
  159.   \@layout
  160.   \if@twoside
  161.     \@layout
  162.   \fi}
  163. \newcommand\@layout{%
  164.   \thispagestyle{empty}
  165.   \if@twoside
  166.     \ifodd\count\z@
  167.       \typeout{Two-sided document style, odd page.}
  168.       \ref@marginwidth=\cnt@oddsidemargin
  169.       \ref@marginpar=\oneinch
  170.       \advance\ref@marginpar by \ref@hoffset
  171.       \advance\ref@marginpar by \cnt@oddsidemargin
  172.       \ref@margin\ref@marginpar
  173.       \if@reversemargin
  174.         \advance\ref@marginpar by -\cnt@marginparsep
  175.         \advance\ref@marginpar by -\cnt@marginparwidth
  176.       \else
  177.         \advance\ref@marginpar by \cnt@textwidth
  178.         \advance\ref@marginpar by \cnt@marginparsep
  179.       \fi
  180.     \else
  181.   \typeout{Two-sided document style, even page.}
  182.       \ref@marginwidth=\cnt@evensidemargin
  183.       \ref@marginpar=\oneinch
  184.       \advance\ref@marginpar by \ref@hoffset
  185.       \advance\ref@marginpar by \cnt@evensidemargin
  186.       \ref@margin\ref@marginpar
  187.       \if@reversemargin
  188.         \advance\ref@marginpar by \cnt@textwidth
  189.         \advance\ref@marginpar by \cnt@marginparsep
  190.       \else
  191.         \advance\ref@marginpar by -\cnt@marginparsep
  192.         \advance\ref@marginpar by -\cnt@marginparwidth
  193.       \fi
  194.     \fi
  195.   \else
  196.     \typeout{One-sided document style.}
  197.     \ref@marginwidth=\cnt@oddsidemargin
  198.     \ref@marginpar=\oneinch
  199.     \advance\ref@marginpar by \ref@hoffset
  200.     \advance\ref@marginpar by \cnt@oddsidemargin
  201.     \ref@margin\ref@marginpar
  202.     \if@reversemargin
  203.       \advance\ref@marginpar by -\cnt@marginparsep
  204.       \advance\ref@marginpar by -\cnt@marginparwidth
  205.     \else
  206.       \advance\ref@marginpar by \cnt@textwidth
  207.       \advance\ref@marginpar by \cnt@marginparsep
  208.     \fi
  209.   \fi
  210.   \setlength{\unitlength}{.5pt}
  211.   \begin{picture}(\cnt@paperwidth,\cnt@paperheight)
  212.     \centering
  213.     \thicklines
  214.     \put(0,0){\framebox(\cnt@paperwidth,\cnt@paperheight){\mbox{}}}
  215.     \put(0,\cnt@voffset){\dashbox{10}(\cnt@paperwidth,0){\mbox{}}}
  216.     \put(\cnt@hoffset,0){\dashbox{10}(0,\cnt@paperheight){\mbox{}}}
  217.     \put(\ref@margin,\ref@head){%
  218.       \framebox(\cnt@textwidth,\cnt@headheight)%
  219.         {\footnotesize\Headertext}}
  220.     \put(\ref@margin,\ref@body){%
  221.       \framebox(\cnt@textwidth,\cnt@textheight){\Bodytext}}
  222.     \put(\ref@margin,\ref@foot){%
  223.       \framebox(\cnt@textwidth,\fheight){\footnotesize\Footertext}}
  224.     \put(\ref@marginpar,\ref@body){%
  225.       \framebox(\cnt@marginparwidth,\cnt@textheight)%
  226.                {\footnotesize\shortstack{\MarginNotestext}}}
  227.     \thinlines
  228.     \SetToHalf\PositionX\cnt@textwidth
  229.     \advance\PositionX by \ref@margin
  230.     \PositionY = \ref@body
  231.     \advance\PositionY by 50
  232.     \Identify{8}
  233.     \InsideHArrow\cnt@textwidth
  234.     \SetToHalf\PositionY\cnt@textheight
  235.     \advance\PositionY by \ref@body
  236.     \PositionX = \cnt@textwidth
  237.     \divide\PositionX by 5
  238.     \multiply \PositionX by 4
  239.     \advance\PositionX by \ref@margin
  240.     \Identify{7}
  241.     \InsideVArrow\cnt@textheight
  242.     \PositionY = \ref@foot
  243.     \SetToHalf\PositionX\cnt@hoffset
  244.     \Identify{1}
  245.     \InsideHArrow\cnt@hoffset
  246.     \SetToQuart\PositionY\cnt@textheight
  247.     \advance\PositionY by \ref@body
  248.     \OutsideHArrow\ref@margin\ref@marginwidth{20}
  249.     \PositionX = \cnt@hoffset
  250.     \advance\PositionX by -30
  251.     \Identify{3}
  252.     \SetToQuart\PositionY\cnt@textheight
  253.     \advance\PositionY by \ref@body
  254.     \advance\PositionY by 30
  255.     \SetToHalf\PositionX\cnt@marginparwidth
  256.     \advance\PositionX by \ref@marginpar
  257.     \Identify{10}
  258.     \InsideHArrow\cnt@marginparwidth
  259.     \advance\PositionY by 30
  260.     \if@twoside
  261.       \ifodd\count\z@
  262.         \OutsideHArrow\ref@marginpar\cnt@marginparsep{20}
  263.         \PositionX = \ref@marginpar
  264.       \else
  265.         \OutsideHArrow\ref@margin\cnt@marginparsep{20}
  266.         \PositionX = \ref@margin
  267.       \fi
  268.     \else
  269.       \OutsideHArrow\ref@marginpar\cnt@marginparsep{20}
  270.       \PositionX = \ref@marginpar
  271.     \fi
  272.     \advance\PositionX by 30
  273.     \Identify{9}
  274.     \PositionX = \cnt@textwidth
  275.     \divide\PositionX by 8
  276.     \advance\PositionX by \ref@margin
  277.     \OutsideVArrow\ref@foot\cnt@footskip{20}{20}
  278.     \PositionY = \ref@foot
  279.     \advance\PositionY by -30
  280.     \Identify{11}
  281.     \PositionX = \cnt@paperwidth
  282.     \advance\PositionX by -50
  283.     \PositionY = \cnt@paperheight
  284.     \ExtraYPos = \PositionY
  285.     \advance\ExtraYPos by -\cnt@voffset
  286.     \advance\PositionY by \cnt@voffset
  287.     \divide\PositionY by \tw@
  288.     \Identify{2}
  289.     \InsideVArrow\ExtraYPos
  290.     \Interval = \cnt@textwidth
  291.     \divide\Interval by 8
  292.     \PositionX = \ref@margin
  293.     \advance\PositionX by \Interval
  294.     \Identify{4}
  295.     \ExtraYPos = \ref@head
  296.     \advance\ExtraYPos\cnt@headheight
  297.     \ArrowLength = \PositionY
  298.     \advance\ArrowLength-\ExtraYPos
  299.     \advance\ArrowLength-\cnt@topmargin
  300.     \advance\ArrowLength-10%
  301.     \OutsideVArrow\ExtraYPos\cnt@topmargin{20}{\ArrowLength}
  302.     \advance\PositionX by \Interval
  303.     \Identify{5}
  304.     \advance\ArrowLength\cnt@topmargin
  305.     \OutsideVArrow\ref@head\cnt@headheight{20}{\ArrowLength}
  306.     \advance\PositionX by \Interval
  307.     \Identify{6}
  308.     \advance\ArrowLength\cnt@headheight
  309.     \ExtraYPos=\ref@body
  310.     \advance\ExtraYPos\cnt@textheight
  311.     \OutsideVArrow\ExtraYPos\cnt@headsep{20}{\ArrowLength}
  312.   \end{picture}
  313.  
  314.   \medskip
  315.   \vtop to 0pt{%
  316.     \@minipagerestore\footnotesize\ttfamily
  317.     \begin{tabular}{@{}rl@{\hspace{20pt}}rl}
  318.       1 & \oneinchtext\ + \bs\texttt{hoffset}
  319.         & 2 & \oneinchtext\ + \bs\texttt{voffset} \\
  320.       3 & \if@twoside
  321.             \ifodd\count\z@ \Show{cnt}{oddsidemargin}
  322.             \else \Show{cnt}{evensidemargin}
  323.             \fi
  324.           \else
  325.             \Show{cnt}{oddsidemargin}
  326.           \fi                    & 4 & \Show{cnt}{topmargin} \\
  327.       5 & \Show{cnt}{headheight} & 6 & \Show{cnt}{headsep} \\
  328.       7 & \Show{cnt}{textheight} & 8 & \Show{cnt}{textwidth} \\
  329.       9 & \Show{cnt}{marginparsep}&10& \Show{cnt}{marginparwidth} \\
  330.       11& \Show{cnt}{footskip}   &   & \Show{cnt}{marginparpush}
  331.        \rlap{(not shown)}\\
  332.         & \Show{ref}{hoffset}    &   & \Show{ref}{voffset} \\
  333.         & \Show{cnt}{paperwidth} &   & \Show{cnt}{paperheight} \\
  334.  
  335.   \end{tabular}\vss}
  336.   \Type{ref}{hoffset}
  337.   \Type{ref}{voffset}
  338.   \Type{cnt}{textheight}
  339.   \Type{cnt}{textwidth}
  340.   \newpage
  341. }
  342. \endinput
  343. %% 
  344. %% End of file `layout.sty'.
  345.