home *** CD-ROM | disk | FTP | other *** search
/ MACD 4 / MACD4.iso / TeX / macros / latex2e / inputs / layout.sty < prev    next >
Encoding:
Text File  |  1978-03-06  |  10.9 KB  |  342 lines

  1. %% 
  2. %% This is file `layout.sty', generated 
  3. %% on <1994/6/9> with the docstrip utility (2.2h).
  4. %% 
  5. %% The original source files were:
  6. %% 
  7. %% layout.dtx  (with options: `package')
  8. %% 
  9. %% Copyright (C) 1994 by Kent McPherson and Johanes Braams. 
  10. %% All rights reserved. 
  11. %% 
  12. %% 
  13. %% This file is part of the layout package (PRELIMINARY TEST RELEASE) 
  14. %% ------------------------------------------------------------------ 
  15. %% 
  16. %% IMPORTANT NOTICE: 
  17. %% 
  18. %% You are not allowed to change this file. You may however copy this file 
  19. %% to a file with a different name and then change the copy. 
  20. %% 
  21. %% You are NOT ALLOWED to distribute this file alone. You are NOT ALLOWED 
  22. %% to take money for the distribution or use of this file (or a changed 
  23. %% version) except for a nominal charge for copying etc. 
  24. %% 
  25. %% You are allowed to distribute this file under the condition that it is 
  26. %% distributed together with all files mentioned below. 
  27. %% 
  28. %% If you receive only some of these files from someone, complain! 
  29. %% 
  30. %% Error Reports in case of UNCHANGED versions to 
  31. %% 
  32. %% J. Braams 
  33. %% PTT Research, dr Neher Laboratorium 
  34. %% P.O. box 421 
  35. %% 2260 AK Leidschendam 
  36. %% The Netherlands 
  37. %% Internet: <J.L.Braams@research.ptt.nl> 
  38. %% 
  39. \NeedsTeXFormat{LaTeX2e}
  40. \def\filedate{1994/02/23}
  41. \def\filename{layout.dtx}
  42. \def\fileversion{1.1}
  43. \ProvidesPackage{layout}[\filedate\space
  44.                             Show layout parameters]
  45. \wlog{Package layout \fileversion\space <\filedate>}
  46. \DeclareOption{verbose}{\let\type\typeout}
  47. \DeclareOption{silent}{\let\type\@gobble}
  48. \ExecuteOptions{silent}
  49. \ProcessOptions
  50. \@ifundefined{bs}{\newcommand\bs{\char '134 }}%
  51.   {\renewcommand\bs{\char '134 }}
  52. \def\ConvertToCount#1#2{%
  53.   #1=#2
  54.   \divide #1 by 65536}
  55. \def\SetToHalf#1#2{#1=#2\relax\divide#1by\tw@}
  56. \def\SetToQuart#1#2{#1=#2\relax\divide#1by4}
  57. \def\Identify#1{%
  58.   \put(\PositionX,\PositionY){\circle{20}}
  59.   \put(\PositionX,\PositionY){\makebox(0,0){\tiny #1}}
  60. }
  61. \def\InsideHArrow#1{{%
  62.   \ArrowLength = #1
  63.   \divide\ArrowLength by \tw@
  64.   \advance\ArrowLength by -10
  65.   \advance\PositionX by -10
  66.   \put(\PositionX,\PositionY){\vector(-1,0){\ArrowLength}}
  67.   \advance\PositionX by 20
  68.   \put(\PositionX,\PositionY){\vector(+1,0){\ArrowLength}}
  69. }}
  70. \def\InsideVArrow#1{{%
  71.   \ArrowLength = #1
  72.   \divide\ArrowLength by \tw@
  73.   \advance\ArrowLength by -10
  74.   \advance\PositionY by -10
  75.   \put(\PositionX,\PositionY){\vector(0,-1){\ArrowLength}}
  76.   \advance\PositionY by 20
  77.   \put(\PositionX,\PositionY){\vector(0,+1){\ArrowLength}}
  78. }}
  79. \def\OutsideHArrow#1#2#3{{%
  80.   \PositionX = #1
  81.   \advance\PositionX by #3
  82.   \put(\PositionX,\PositionY){\vector(-1,0){#3}}
  83.   \PositionX = #1 \advance\PositionX-#2
  84.   \advance\PositionX by -#3
  85.   \put(\PositionX,\PositionY){\vector(+1,0){#3}}
  86. }}
  87. \def\OutsideVArrow#1#2#3#4{{%
  88.   \PositionY = #1
  89.   \advance\PositionY by -#3
  90.   \put(\PositionX,\PositionY){\vector(0,+1){#3}}
  91.   \PositionY = #1
  92.   \advance\PositionY#2
  93.   \advance\PositionY#4
  94.   \put(\PositionX,\PositionY){\vector(0,-1){#4}}
  95. }}
  96. \def\Show#1#2{\bs #2 = \expandafter\number\csname #1@#2\endcsname pt}
  97. \def\Type#1#2{%
  98.   \type{#2 = \expandafter\number\csname #1@#2\endcsname pt}}
  99. \newcount\oneinch
  100. \oneinch=72
  101. \newcount\cnt@paperwidth
  102. \newcount\cnt@paperheight
  103. \ConvertToCount\cnt@paperwidth\paperwidth
  104. \ConvertToCount\cnt@paperheight\paperheight
  105. \newcount\cnt@hoffset
  106. \newcount\cnt@voffset
  107. \ConvertToCount\cnt@hoffset\hoffset
  108. \ConvertToCount\cnt@voffset\voffset
  109. \newcount\cnt@textheight
  110. \newcount\cnt@textwidth
  111. \ConvertToCount\cnt@textheight\textheight
  112. \ConvertToCount\cnt@textwidth\textwidth
  113. \newcount\cnt@topmargin
  114. \newcount\cnt@oddsidemargin
  115. \newcount\cnt@evensidemargin
  116. \ConvertToCount\cnt@topmargin\topmargin
  117. \ConvertToCount\cnt@oddsidemargin\oddsidemargin
  118. \ConvertToCount\cnt@evensidemargin\evensidemargin
  119. \newcount\cnt@headheight
  120. \newcount\cnt@headsep
  121. \ConvertToCount\cnt@headheight\headheight
  122. \ConvertToCount\cnt@headsep\headsep
  123. \newcount\cnt@marginparsep
  124. \newcount\cnt@marginparwidth
  125. \newcount\cnt@marginparpush
  126. \ConvertToCount\cnt@marginparsep\marginparsep
  127. \ConvertToCount\cnt@marginparwidth\marginparwidth
  128. \ConvertToCount\cnt@marginparpush\marginparpush
  129. \newcount\cnt@footskip
  130. \ConvertToCount\cnt@footskip\footskip
  131. \newcount\fheight
  132. \fheight=12
  133. \newcount\ref@top
  134. \ref@top=\cnt@paperheight \advance\ref@top by -\oneinch
  135. \newcount\ref@hoffset
  136. \newcount\ref@voffset
  137. \ref@hoffset=\cnt@hoffset  \advance\cnt@hoffset by \oneinch
  138. \ref@voffset=\cnt@voffset
  139. \cnt@voffset=\ref@top
  140. \advance\cnt@voffset by -\ref@voffset
  141. \newcount\ref@head
  142. \ref@head=\ref@top
  143.   \advance\ref@head by -\ref@voffset
  144.   \advance\ref@head by -\cnt@topmargin
  145.   \advance\ref@head by -\cnt@headheight
  146. \newcount\ref@body
  147. \ref@body=\ref@head
  148.   \advance\ref@body by -\cnt@headsep
  149.   \advance\ref@body by -\cnt@textheight
  150. \newcount\ref@foot
  151.   \ref@foot=\ref@body
  152.   \advance\ref@foot by -\cnt@footskip
  153. \newcount\ref@margin
  154. \newcount\ref@marginwidth
  155. \newcount\ref@marginpar
  156. \newcount\Interval
  157. \newcount\ExtraYPos
  158. \newcount\PositionX
  159. \newcount\PositionY
  160. \newcount\ArrowLength
  161. \def\layout{%
  162.   \thispagestyle{empty}
  163.   \if@twoside
  164.     \ifodd\count\z@
  165.       \typeout{Two-sided document style, odd page.}
  166.       \ref@marginwidth=\cnt@oddsidemargin
  167.       \ref@marginpar=\oneinch
  168.       \advance\ref@marginpar by \ref@hoffset
  169.       \advance\ref@marginpar by \cnt@oddsidemargin
  170.       \ref@margin\ref@marginpar
  171.       \if@reversemargin
  172.         \advance\ref@marginpar by -\cnt@marginparsep
  173.         \advance\ref@marginpar by -\cnt@marginparwidth
  174.       \else
  175.         \advance\ref@marginpar by \cnt@textwidth
  176.         \advance\ref@marginpar by \cnt@marginparsep
  177.       \fi
  178.     \else
  179.   \typeout{Two-sided document style, even page.}
  180.       \ref@marginwidth=\cnt@evensidemargin
  181.       \ref@marginpar=\oneinch
  182.       \advance\ref@marginpar by \ref@hoffset
  183.       \advance\ref@marginpar by \cnt@evensidemargin
  184.       \ref@margin\ref@marginpar
  185.       \if@reversemargin
  186.         \advance\ref@marginpar by \cnt@textwidth
  187.         \advance\ref@marginpar by \cnt@marginparsep
  188.       \else
  189.         \advance\ref@marginpar by -\cnt@marginparsep
  190.         \advance\ref@marginpar by -\cnt@marginparwidth
  191.       \fi
  192.     \fi
  193.   \else
  194.     \typeout{One-sided document style.}
  195.     \ref@marginwidth=\cnt@oddsidemargin
  196.     \ref@marginpar=\oneinch
  197.     \advance\ref@marginpar by \ref@hoffset
  198.     \advance\ref@marginpar by \cnt@oddsidemargin
  199.     \ref@margin\ref@marginpar
  200.     \if@reversemargin
  201.       \advance\ref@marginpar by -\cnt@marginparsep
  202.       \advance\ref@marginpar by -\cnt@marginparwidth
  203.     \else
  204.       \advance\ref@marginpar by \cnt@textwidth
  205.       \advance\ref@marginpar by \cnt@marginparsep
  206.     \fi
  207.   \fi
  208.   \setlength{\unitlength}{.5pt}
  209.   \begin{picture}(\cnt@paperwidth,\cnt@paperheight)
  210.     \centering
  211.     \thicklines
  212.     \put(0,0){\framebox(\cnt@paperwidth,\cnt@paperheight){\mbox{}}}
  213.     \put(0,\cnt@voffset){\dashbox{10}(\cnt@paperwidth,0){\mbox{}}}
  214.     \put(\cnt@hoffset,0){\dashbox{10}(0,\cnt@paperheight){\mbox{}}}
  215.     \put(\ref@margin,\ref@head){%
  216.       \framebox(\cnt@textwidth,\cnt@headheight){\footnotesize Header}}
  217.     \put(\ref@margin,\ref@body){%
  218.       \framebox(\cnt@textwidth,\cnt@textheight){Body}}
  219.     \put(\ref@margin,\ref@foot){%
  220.       \framebox(\cnt@textwidth,\fheight){\footnotesize Footer}}
  221.     \put(\ref@marginpar,\ref@body){%
  222.       \framebox(\cnt@marginparwidth,\cnt@textheight)%
  223.                {\footnotesize\shortstack{Margin\\Notes}}}
  224.     \thinlines
  225.     \SetToHalf\PositionX\cnt@textwidth
  226.     \advance\PositionX by \ref@margin
  227.     \PositionY = \ref@body
  228.     \advance\PositionY by 50
  229.     \Identify{8}
  230.     \InsideHArrow\cnt@textwidth
  231.     \SetToHalf\PositionY\cnt@textheight
  232.     \advance\PositionY by \ref@body
  233.     \PositionX = \cnt@textwidth
  234.     \divide\PositionX by 5
  235.     \multiply \PositionX by 4
  236.     \advance\PositionX by \ref@margin
  237.     \Identify{7}
  238.     \InsideVArrow\cnt@textheight
  239.     \PositionY = \ref@foot
  240.     \SetToHalf\PositionX\cnt@hoffset
  241.     \Identify{1}
  242.     \InsideHArrow\cnt@hoffset
  243.     \SetToQuart\PositionY\cnt@textheight
  244.     \advance\PositionY by \ref@body
  245.     \OutsideHArrow\ref@margin\ref@marginwidth{20}
  246.     \PositionX = \cnt@hoffset
  247.     \advance\PositionX by -30
  248.     \Identify{3}
  249.     \SetToQuart\PositionY\cnt@textheight
  250.     \advance\PositionY by \ref@body
  251.     \SetToHalf\PositionX\cnt@marginparwidth
  252.     \advance\PositionX by \ref@marginpar
  253.     \Identify{10}
  254.     \InsideHArrow\cnt@marginparwidth
  255.     \advance\PositionY by 30
  256.     \if@twoside
  257.       \ifodd\count\z@
  258.         \OutSideHArrow\ref@marginpar\cnt@marginparsep{20}
  259.         \PositionX = \ref@marginpar
  260.         \advance\PositionX by 30
  261.         \Identify{9}
  262.       \else
  263.         \OutSideHArrow\ref@margin\cnt@marginparsep{20}
  264.         \PositionX = \ref@margin
  265.         \advance\PositionX by 30
  266.         \Identify{9}
  267.       \fi
  268.     \else
  269.       \OutsideHArrow\ref@marginpar\cnt@marginparsep{20}
  270.       \PositionX = \ref@marginpar
  271.       \advance\PositionX by 30
  272.       \Identify{9}
  273.     \fi
  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\ttfamily\footnotesize
  317.     \begin{tabular}{@{}rl@{\hspace{20pt}}rl}
  318.       1 & one inch +\bs\texttt{hoffset}
  319.         & 2 & one inch + \bs\texttt{voffset} \\
  320.       3 & \if@twoside
  321.             \if@odd \Show{cnt}{oddsidemargin}
  322.             \else \Show{cnt}{evensidemargin}
  323.             \fi                  & 4 & \Show{cnt}{topmargin} \\
  324.       5 & \Show{cnt}{headheight} & 6 & \Show{cnt}{headsep} \\
  325.       7 & \Show{cnt}{textheight} & 8 & \Show{cnt}{textwidth} \\
  326.       9 & \Show{cnt}{marginparsep}&10& \Show{cnt}{marginparwidth} \\
  327.       11& \Show{cnt}{footskip}   &   & \Show{cnt}{marginparpush}
  328.        \rlap{(not shown)}\\
  329.         & \Show{ref}{hoffset}    &   & \Show{ref}{voffset} \\
  330.         & \Show{cnt}{paperwidth} &   & \Show{cnt}{paperheight} \\
  331.  
  332.   \end{tabular}\vss}
  333.   \Type{ref}{hoffset}
  334.   \Type{ref}{voffset}
  335.   \Type{cnt}{textheight}
  336.   \Type{cnt}{textwidth}
  337.   \newpage
  338. }
  339. \endinput
  340. %% 
  341. %% End of file `layout.sty'.
  342.