1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
|
% \iffalse meta-comment
%
% Copyright (C) 1993-2020
%
% The LaTeX3 Project and any individual authors listed elsewhere
% in this file.
%
% This file is part of the Standard LaTeX `Tools Bundle'.
% -------------------------------------------------------
%
% It may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3c
% of this license or (at your option) any later version.
% The latest version of this license is in
% https://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% The list of all files belonging to the LaTeX `Tools Bundle' is
% given in the file `manifest.txt'.
%
% \fi
%\iffalse
% This file is built for \LaTeXe, so we make sure an error is
% generated when it is used with another format
%<*dtx>
\ProvidesFile{layout.dtx}
%</dtx>
%<+package>\NeedsTeXFormat{LaTeX2e}
%<+package>\ProvidesPackage{layout}
%<+driver>\ProvidesFile{layout.drv}
%\ProvidesFile{layout.dtx}
[2014/10/28 v1.2c Show layout parameters]
%
% A short driver is provided that can be extracted if necessary by
% the \textsf{DocStrip} program provided with \LaTeXe.
% \begin{macrocode}
%<*driver>
\documentclass{ltxdoc}
\usepackage{layout}
\newcommand\Lopt[1]{\textsf{#1}}
\pagestyle{myheadings}
\DisableCrossrefs
\begin{document}
\DocInput{layout.dtx}
\end{document}
%</driver>
% \end{macrocode}
%\fi
% \changes{v1.1c}{1994/07/13}{Moved Identification code to the front
% and removed the permanent use of \cs{filedate} and friends}
% \changes{v1.1d}{1994/09/08}{Stored texts in control sequences to
% allow other languages}
%
% \GetFileInfo{layout.dtx}
% \title{Displaying page layout variables}
% \author{Kent McPherson a.o.\thanks{Converted for \LaTeXe\ by
% Johannes Braams and modified by Hideo Umeki}}
% \date{\filedate}
%
% \markboth{layout package version \fileversion\space as of \filedate}
% {layout package version \fileversion\space as of \filedate}
%
% \MaintainedByLaTeXTeam{tools}
% \maketitle
%
% \section{Introduction}
%
% This \LaTeXe\ package is a reimplementation of
% \texttt{layout.sty} by Kent McPherson. It defines the command
% |\layout| which produces an overview of the layout of the current
% document. The command |\layout*| recomputes the values it uses to
% produce the overview.
%
% The figure on the next page shows the output of the |\layout|
% command for this document.
%
% \begin{figure}[p]
% \layout
% \end{figure}
%
% \StopEventually{}
%
% \section{The implementation}
%
% \changes{v1.1b}{1994/03/23}{removed the \cs{wlog} as
% \cs{ProvidesPackage} does that now}
% \changes{v1.1d}{1994/09/08}{Added language options dutch and
% english}
%
% This package prints a figure to illustrate the layout that is
% implemented by the document class. In the figure several words
% appear. They are stored in control sequences to be able to select
% a different language.
% \changes{v1.1e}{1994/10/29}{The dutch texts should be one word.}
% \changes{v1.1f}{1995/03/14}{Added \cs{notshown}}
% \changes{v1.1f}{1995/03/14}{Added option french}
% \changes{v1.1j}{1995/10/29}{Added the options spanish, brazilian and
% portuguese}
% \changes{v1.1k}{1995/11/23}{Documentation fixes}
% \changes{v1.2}{1998/04/13}{Redesign of the output by Hideo Umeki}
% \changes{v1.2c}{2000/09/21}{Added option german}
% \changes{v1.2c}{2000/09/25}{Added option for italian by Claudio Beccari}
% \begin{macrocode}
%<*package>
\DeclareOption{dutch}{%
\def\Headertext{Kopregel}
\def\Bodytext{Broodtekst}
\def\Footertext{Voetregel}
\def\MarginNotestext{Marge\\Notities}
\def\oneinchtext{een inch}
\def\notshown{niet getoond}
}
\DeclareOption{german}{%
\def\Headertext{Kopfzeile}
\def\Bodytext{Haupttext}
\def\Footertext{Fu{\ss}zeile}
\def\MarginNotestext{Rand-\\ notizen}
\def\oneinchtext{ein Zoll}
\def\notshown{ohne Abbildung}
}
\DeclareOption{ngerman}{\ExecuteOptions{german}}
\DeclareOption{english}{%
\def\Headertext{Header}
\def\Bodytext{Body}
\def\Footertext{Footer}
\def\MarginNotestext{Margin\\Notes}
\def\oneinchtext{one inch}
\def\notshown{not shown}
}
\DeclareOption{french}{%
\def\Headertext{Ent\^{e}te}
\def\Bodytext{Corps}
\def\Footertext{Pied de page}
\def\MarginNotestext{Marge\\Notes}
\def\oneinchtext{un pouce}
\def\notshown{non affich\'{e}}
}
\DeclareOption{francais}{\ExecuteOptions{french}}
\DeclareOption{spanish}{%
\def\Headertext{Encabezamiento}
\def\Bodytext{Cuerpo}
\def\Footertext{Pie de p\'agina}
\def\MarginNotestext{Notas\\ Marginales}
\def\oneinchtext{una pulgada}
\def\notshown{no mostradas}
}
\DeclareOption{portuguese}{%
\def\Headertext{Cabe\c{c}alho}
\def\Bodytext{Corpo}
\def\Footertext{Rodap\'e}
\def\MarginNotestext{Notas\\ Marginais}
\def\oneinchtext{uma polegada}
\def\notshown{n\~ao mostradas}
}
\DeclareOption{brazilian}{%
\def\Headertext{Cabe\c{c}alho}
\def\Bodytext{Corpo}
\def\Footertext{Rodap\'e}
\def\MarginNotestext{Notas\\ Marginais}
\def\oneinchtext{uma polegada}
\def\notshown{n\~ao mostradas}
}
\DeclareOption{italian}{%
\def\Headertext{Testatina}
\def\Bodytext{Corpo}
\def\Footertext{Piedino}
\def\MarginNotestext{Note\\ Marginali}
\def\oneinchtext{un pollice}
\def\notshown{non mostrato}
}
% \end{macrocode}
%
% This package has an option \Lopt{verbose}. Using it will make the
% command |\layout| type some of the parameters on the terminal.
% \begin{macrocode}
\DeclareOption{verbose}{\let\LayOuttype\typeout}
\DeclareOption{silent}{\let\LayOuttype\@gobble}
% \end{macrocode}
%
% \changes{v1.1h}{1995/04/07}{Added the options \Lopt{integers}
% (default) and \Lopt{reals}}
%
% The normal behaviour of this package when showing the values of
% the parameters is to truncate them. However, if you want to see
% the real parameter values you can use the option \Lopt{reals} to
% get that effect.
% \changes{v1.1i}{1995/06/25}{\LaTeX\ release 1995/06/01 no longer
% needs double hashmarks in the argument of \cs{DeclareOption}}
% \begin{macrocode}
\def\lay@value{}
\DeclareOption{integers}{%
\renewcommand*{\lay@value}[2]{%
\expandafter\number\csname #1@#2\endcsname pt}}
\DeclareOption{reals}{%
\renewcommand*{\lay@value}[2]{\the\csname #2\endcsname}}
% \end{macrocode}
%
% The default language is English, the default mode is
% \Lopt{silent} and the default way of showing parameter values is
% to use integers.
% \begin{macrocode}
\ExecuteOptions{english,silent,integers}
\ProcessOptions
% \end{macrocode}
%
% \begin{macro}{\LayOutbs}
% Define |\LayOutbs| to produce a backslash. We use a definition
% which also works with OT1 fonts.
% \changes{v1.2b}{1998/06/21}{Renamed \cs{bs} to avoid possible conflicts
% with other packages}
% \begin{macrocode}
\newcommand\LayOutbs{}
\chardef\LayOutbs`\\
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ConvertToCount}
% This macro stores the value of a \emph{length} register in a
% \emph{count} register.
% \begin{macrocode}
\def\ConvertToCount#1#2{%
% \end{macrocode}
% First copy the value
% \begin{macrocode}
#1=#2
% \end{macrocode}
% Then divide it by 65536.
% \begin{macrocode}
\divide #1 by 65536}
% \end{macrocode}
% The result of this is that the \emph{count} register holds the
% value of the \emph{length} register in points.
% \end{macro}
%
% \begin{macro}{\SetToHalf}
% \begin{macro}{\SetToQuart}
% Small macros used in computing positions.
% \begin{macrocode}
\def\SetToHalf#1#2{#1=#2\relax\divide#1by\tw@}
\def\SetToQuart#1#2{#1=#2\relax\divide#1by4}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Identify}
% A small macro used in identifying dimensions.
% \begin{macrocode}
\def\Identify#1{%
\put(\PositionX,\PositionY){\circle{20}}
\put(\PositionX,\PositionY){\makebox(0,0){\tiny #1}}
}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\InsideHArrow}
% This macro is used to produce two horizontal arrows inside a box.
% The argument gives the width of the box.
% \changes{v1.1c}{1994/07/14}{Added check for a negative arrow length}
% \begin{macrocode}
\def\InsideHArrow#1{{%
\ArrowLength = #1
\divide\ArrowLength by \tw@
\advance\ArrowLength by -10
\advance\PositionX by -10
\ifnum\ArrowLength<\z@
\put(\PositionX,\PositionY){\vector(1,0){-\ArrowLength}}
\advance\PositionX by 20
\put(\PositionX,\PositionY){\vector(-1,0){-\ArrowLength}}
\else
\put(\PositionX,\PositionY){\vector(-1,0){\ArrowLength}}
\advance\PositionX by 20
\put(\PositionX,\PositionY){\vector(+1,0){\ArrowLength}}
\fi
}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\InsideVArrow}
% This macro is used to produce two vertical arrows inside a box.
% The argument gives the height of the box.
% \begin{macrocode}
\def\InsideVArrow#1{{%
\ArrowLength = #1
\divide\ArrowLength by \tw@
\advance\ArrowLength by -10
\advance\PositionY by -10
\put(\PositionX,\PositionY){\vector(0,-1){\ArrowLength}}
\advance\PositionY by 20
\put(\PositionX,\PositionY){\vector(0,+1){\ArrowLength}}
}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\OutsideHArrow}
% This macro is used to produce two horizontal arrows to delimit a
% length. The first argument is the position for the right arrow,
% the second argument gives the length and the third specifies the
% length of the arrows.
% \begin{macrocode}
\def\OutsideHArrow#1#2#3{{%
\PositionX = #1
\advance\PositionX by #3
\put(\PositionX,\PositionY){\vector(-1,0){#3}}
\PositionX = #1 \advance\PositionX-#2
\advance\PositionX by -#3
\put(\PositionX,\PositionY){\vector(+1,0){#3}}
}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\OutsideVArrow}
% This macro is used to produce two vertical arrows to delimit a
% length. The first argument is the position for the lower arrow,
% the second argument gives the length and the third and fourth
% specify the lenghts of the lower and upper arrow.
% \begin{macrocode}
\def\OutsideVArrow#1#2#3#4{{%
\PositionY = #1
\advance\PositionY by -#3
\put(\PositionX,\PositionY){\vector(0,+1){#3}}
\PositionY = #1
\advance\PositionY#2
\advance\PositionY#4
\put(\PositionX,\PositionY){\vector(0,-1){#4}}
}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Show}
% \changes{v1.1g}{1995/04/03}{Simplified the definition, now show
% complete value}
% \changes{v1.1h}{1995/04/07}{Use \cs{lay@value} to show the value
% because of the option which decides which of two ways of doing it
% should be used}
%
% Macro used in the table that shows the setting of the parameters.
% \begin{macrocode}
\def\Show#1#2{\LayOutbs #2 = \lay@value{#1}{#2}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Type}
% \changes{v1.1g}{1995/04/03}{Simplified the definition, now show
% complete value}
% \changes{v1.1h}{1995/04/07}{Use \cs{lay@value} to show the value
% because of the option which decides which of two ways of doing it
% should be used}
% \changes{v1.2b}{1998/06/21}{Renamed \cs{type} to \cs{LayOuttype}
% to avoid possible conflicts with other packages}
%
% Macro used to show a setting of a parameter on the terminal.
% \begin{macrocode}
\def\Type#1#2{%
\LayOuttype{#2 = \lay@value{#1}{#2}}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\oneinch}
% A constant, giving the length of an inch in points (approximately)
% \begin{macrocode}
\newcount\oneinch
\oneinch=72
% \end{macrocode}
% \end{macro}
%
% Because the overview of the layout is produced in a figure
% environment we need to allocate a number of counters that are
% used to store the values of various dimensions.
%
% \begin{macro}{\cnt@paperwidth}
% \begin{macro}{\cnt@paperheight}
% The dimensions of the paper
% \begin{macrocode}
\newcount\cnt@paperwidth
\newcount\cnt@paperheight
\ConvertToCount\cnt@paperwidth\paperwidth
\ConvertToCount\cnt@paperheight\paperheight
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\cnt@hoffset}
% \begin{macro}{\cnt@voffset}
% the offsets,
% \begin{macrocode}
\newcount\cnt@hoffset
\newcount\cnt@voffset
\ConvertToCount\cnt@hoffset\hoffset
\ConvertToCount\cnt@voffset\voffset
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\cnt@textheight}
% \begin{macro}{\cnt@textwidth}
% dimensions of the text area,
% \begin{macrocode}
\newcount\cnt@textheight
\newcount\cnt@textwidth
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\cnt@topmargin}
% \begin{macro}{\cnt@oddsidemargin}
% \begin{macro}{\cnt@evensidemargin}
% margins,
% \begin{macrocode}
\newcount\cnt@topmargin
\newcount\cnt@oddsidemargin
\newcount\cnt@evensidemargin
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\cnt@headheight}
% \begin{macro}{\cnt@headsep}
% dimensions of the running heads,
% \begin{macrocode}
\newcount\cnt@headheight
\newcount\cnt@headsep
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\cnt@marginparsep}
% \begin{macro}{\cnt@marginparwidth}
% \begin{macro}{\cnt@marginparpush}
% marginal paragraphs,
% \begin{macrocode}
\newcount\cnt@marginparsep
\newcount\cnt@marginparwidth
\newcount\cnt@marginparpush
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\cnt@footskip}
% the distance between the running footers and the text,
% \begin{macrocode}
\newcount\cnt@footskip
% \end{macrocode}
% \end{macro}
% and the height of the footers, which is needed here to display a
% box, but which isn't used by \LaTeX.
% \begin{macro}{\fheight}
% \begin{macrocode}
\newcount\fheight
\fheight=12
% \end{macrocode}
% \end{macro}
%
% Apart from integer representations of the page layout parameters
% we also need registers to store reference values in.
%
% \begin{macro}{\ref@top}
% The position of the top of the `printable area' is
% one inch below the top of the paper by default. The value of
% |\ref@top| is relative to the lower left corner of the picture
% environment that will be used.
%
% \begin{macrocode}
\newcount\ref@top
\ref@top=\cnt@paperheight \advance\ref@top by -\oneinch
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ref@hoffset}
% \begin{macro}{\ref@voffset}
% For the offsets,
% \begin{macrocode}
\newcount\ref@hoffset
\newcount\ref@voffset
% \end{macrocode}
% The |\hoffset| and |\voffset| values are added to the default
% offset of one inch.
% \begin{macrocode}
\ref@hoffset=\cnt@hoffset \advance\cnt@hoffset by \oneinch
\ref@voffset=\cnt@voffset
% \end{macrocode}
%
% |\cnt@voffset| is converted to be relative to the origin of the
% picture.
% \begin{macrocode}
\cnt@voffset=\ref@top
\advance\cnt@voffset by -\ref@voffset
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\ref@head}
% and the text areas, running heads,
% \begin{macrocode}
\newcount\ref@head
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ref@body}
% body of the text
% \begin{macrocode}
\newcount\ref@body
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ref@foot}
% and running footers.
% \begin{macrocode}
\newcount\ref@foot
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ref@margin}
% \begin{macro}{\ref@marginwidth}
% \begin{macro}{\ref@marginpar}
% These are different for even and odd pages, so they are computed
% by |\layout|.
% \begin{macrocode}
\newcount\ref@margin
\newcount\ref@marginwidth
\newcount\ref@marginpar
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% The following are a number of scratch registers, used in the
% positioning of the various pices of the picture.
% \begin{macrocode}
\newcount\Interval
\newcount\ExtraYPos
\newcount\PositionX
\newcount\PositionY
\newcount\ArrowLength
% \end{macrocode}
%
% \begin{macro}{\lay@getvalues}
% \changes{v1.1j}{1995/10/30}{Added macro to compute values at later
% time}
% All values that might change during the document are computed by
% calling the macro |\lay@getvalues|. By default this macro is
% executed at |\begin{document}|.
% \begin{macrocode}
\def\lay@getvalues{%
\ConvertToCount\cnt@textheight\textheight
\ConvertToCount\cnt@textwidth\textwidth
\ConvertToCount\cnt@topmargin\topmargin
\ConvertToCount\cnt@oddsidemargin\oddsidemargin
\ConvertToCount\cnt@evensidemargin\evensidemargin
\ConvertToCount\cnt@headheight\headheight
\ConvertToCount\cnt@headsep\headsep
\ConvertToCount\cnt@marginparsep\marginparsep
\ConvertToCount\cnt@marginparwidth\marginparwidth
\ConvertToCount\cnt@marginparpush\marginparpush
\ConvertToCount\cnt@footskip\footskip
\ref@head=\ref@top
\advance\ref@head by -\ref@voffset
\advance\ref@head by -\cnt@topmargin
\advance\ref@head by -\cnt@headheight
\ref@body=\ref@head
\advance\ref@body by -\cnt@headsep
\advance\ref@body by -\cnt@textheight
\ref@foot=\ref@body
\advance\ref@foot by -\cnt@footskip
}
\AtBeginDocument{\lay@getvalues}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\computevalues}
%
% \begin{macro}{\layout}
% \begin{macro}{\layout*}
% The command |\layout| makes the picture and table that display
% the current settings of the layout parameters.
%
% \changes{v1.1b}{1994/03/23}{Produce two pages in twoside mode}
% \changes{v1.1j}{1995/10/30}{Added \cs{layout*}}
% \begin{macrocode}
\newcommand\layout{%
\@ifstar{\lay@getvalues\lay@xlayout}{\lay@xlayout}}
\def\lay@xlayout{%
\lay@layout
\if@twoside
\lay@layout
\fi}
% \end{macrocode}
%
% \begin{macro}{\lay@layout}
% The internal macro |\lay@layout| does all the dirty work.
% \begin{macrocode}
\newcommand\lay@layout{%
\thispagestyle{empty}
% \end{macrocode}
%
% The actions of |\layout| depend on the pagestyle.
% \begin{macrocode}
\if@twoside
\ifodd\count\z@
% \end{macrocode}
%
% Here we deal with an odd page in the twosided case.
%
% \begin{macrocode}
\typeout{Two-sided document style, odd page.}
% \end{macrocode}
%
% So we compute |\ref@marginwidth|, |\ref@marginpar| and
% |\ref@margin|.
% \changes{v1.1}{1994/02/23}{Added check for reversemargin}
% \begin{macrocode}
\ref@marginwidth=\cnt@oddsidemargin
\ref@marginpar=\oneinch
\advance\ref@marginpar by \ref@hoffset
\advance\ref@marginpar by \cnt@oddsidemargin
\ref@margin\ref@marginpar
\if@reversemargin
\advance\ref@marginpar by -\cnt@marginparsep
\advance\ref@marginpar by -\cnt@marginparwidth
\else
\advance\ref@marginpar by \cnt@textwidth
\advance\ref@marginpar by \cnt@marginparsep
\fi
% \end{macrocode}
%
% \begin{macrocode}
\else
% \end{macrocode}
%
% Here we deal with an even page in the twosided case.
%
% \begin{macrocode}
\typeout{Two-sided document style, even page.}
% \end{macrocode}
%
% So we compute |\ref@marginwidth|, |\ref@marginpar| and
% |\ref@margin|.
% \changes{v1.1}{1994/02/23}{Added check for reversemargin}
% \begin{macrocode}
\ref@marginwidth=\cnt@evensidemargin
\ref@marginpar=\oneinch
\advance\ref@marginpar by \ref@hoffset
\advance\ref@marginpar by \cnt@evensidemargin
\ref@margin\ref@marginpar
\if@reversemargin
\advance\ref@marginpar by \cnt@textwidth
\advance\ref@marginpar by \cnt@marginparsep
\else
\advance\ref@marginpar by -\cnt@marginparsep
\advance\ref@marginpar by -\cnt@marginparwidth
\fi
% \end{macrocode}
%
% \begin{macrocode}
\fi
\else
% \end{macrocode}
%
% Finally we the case for single sided printing.
%
% \changes{v1.1}{1994/02/23}{Added check for reversemargin}
% \begin{macrocode}
\typeout{One-sided document style.}
\ref@marginwidth=\cnt@oddsidemargin
\ref@marginpar=\oneinch
\advance\ref@marginpar by \ref@hoffset
\advance\ref@marginpar by \cnt@oddsidemargin
\ref@margin\ref@marginpar
\if@reversemargin
\advance\ref@marginpar by -\cnt@marginparsep
\advance\ref@marginpar by -\cnt@marginparwidth
\else
\advance\ref@marginpar by \cnt@textwidth
\advance\ref@marginpar by \cnt@marginparsep
\fi
\fi
% \end{macrocode}
%
%
% Now we begin the picture environment; dividing all the lengths by
% two is done by setting |\unitlength| to \texttt{0.5pt}
% \begin{macrocode}
\setlength{\unitlength}{.5pt}
\begin{picture}(\cnt@paperwidth,\cnt@paperheight)
\centering
\thicklines
% \end{macrocode}
%
% First we have the pagebox and reference lines,
%
% \begin{macrocode}
\put(0,0){\framebox(\cnt@paperwidth,\cnt@paperheight){\mbox{}}}
\put(0,\cnt@voffset){\dashbox{10}(\cnt@paperwidth,0){\mbox{}}}
\put(\cnt@hoffset,0){\dashbox{10}(0,\cnt@paperheight){\mbox{}}}
% \end{macrocode}
%
% then the header,
%
% \begin{macrocode}
\put(\ref@margin,\ref@head){%
\framebox(\cnt@textwidth,\cnt@headheight)%
{\footnotesize\Headertext}}
% \end{macrocode}
%
% the body of the text area,
%
% \begin{macrocode}
\put(\ref@margin,\ref@body){%
\framebox(\cnt@textwidth,\cnt@textheight){\Bodytext}}
% \end{macrocode}
%
% the footer
%
% \begin{macrocode}
\put(\ref@margin,\ref@foot){%
\framebox(\cnt@textwidth,\fheight){\footnotesize\Footertext}}
% \end{macrocode}
%
% and the space for marginal notes.
%
% \begin{macrocode}
\put(\ref@marginpar,\ref@body){%
\framebox(\cnt@marginparwidth,\cnt@textheight)%
{\footnotesize\shortstack{\MarginNotestext}}}
% \end{macrocode}
%
% Then we start putting in `arrows' to mark the various parameters.
% From here we use |\thinlines|.
% \begin{macrocode}
\thinlines
% \end{macrocode}
%
% |\PositionX| and |\PositionY| will be the coordinates of the center of
% the arrow displaying |\textwidth|.
% \begin{macrocode}
\SetToHalf\PositionX\cnt@textwidth
\advance\PositionX by \ref@margin
% \end{macrocode}
% The arrow should be a bit above the bottom of the `body box'.
% \begin{macrocode}
\PositionY = \ref@body
\advance\PositionY by 50
% \end{macrocode}
% An identifying number is put here, in a circle.
% \begin{macrocode}
\Identify{8}
% \end{macrocode}
% Then the arrow is drawn.
% \begin{macrocode}
\InsideHArrow\cnt@textwidth
% \end{macrocode}
%
% Now the |\textheight|
% \begin{macrocode}
\SetToHalf\PositionY\cnt@textheight
\advance\PositionY by \ref@body
% \end{macrocode}
%
% The x-position of the arrow is at $4/5$ of the width of the `body
% box'.
% \begin{macrocode}
\PositionX = \cnt@textwidth
\divide\PositionX by 5
\multiply \PositionX by 4
\advance\PositionX by \ref@margin
% \end{macrocode}
%
% An identifying number is put here, in a circle.
% \begin{macrocode}
\Identify{7}
\InsideVArrow\cnt@textheight
% \end{macrocode}
%
%
% The |\hoffset|,
% \changes{v1.2}{1998/04/13}{\cs{PositionY} for label 1 is
% fixed at 50}
% \begin{macrocode}
\PositionY = 50
\SetToHalf\PositionX\cnt@hoffset
\Identify{1}
\InsideHArrow\cnt@hoffset
% \end{macrocode}
%
%
% The width of the margin.
% \changes{v1.2}{1998/04/13}{The direction of the arrows should be
% switched by the sign of \cs{oddsidemargin}}
% \begin{macrocode}
\SetToQuart\PositionY\cnt@textheight
\advance\PositionY by \ref@body
\ifnum\ref@marginwidth > 0
\OutsideHArrow\ref@margin\ref@marginwidth{20}
\PositionX = \cnt@hoffset
\else
\OutsideHArrow\cnt@hoffset{-\ref@marginwidth}{20}
\PositionX = \ref@margin
\fi
\advance\PositionX by -30
\Identify{3}
% \end{macrocode}
%
% the |\marginparwidth|,
% \begin{macrocode}
\SetToQuart\PositionY\cnt@textheight
\advance\PositionY by \ref@body
% \end{macrocode}
% This arrow has to be bit below the one for the |\oddsidemargin|
% or\\ |\evensidemargin|.
% \begin{macrocode}
\advance\PositionY by 30
\SetToHalf\PositionX\cnt@marginparwidth
\advance\PositionX by \ref@marginpar
\Identify{10}
\InsideHArrow\cnt@marginparwidth
% \end{macrocode}
%
%
% The |\marginparsep|, this depends on single or double sided
% printing.
% \begin{macrocode}
\advance\PositionY by 30
\if@twoside
% \end{macrocode}
%
% Twosided mode, reversemargin;
% \changes{v1.1b}{1994/03/23}{\cs{OutSideHArrow} should be
% \cs{OutsideHArrow}}
% \changes{v1.2}{1998/04/13}{Added check for reversemargin}
% \begin{macrocode}
\if@reversemargin
\ifodd\count\z@
\OutsideHArrow\ref@margin\cnt@marginparsep{20}
\PositionX = \ref@margin
\else
\OutsideHArrow\ref@marginpar\cnt@marginparsep{20}
\PositionX = \ref@marginpar
\fi
\else
% \end{macrocode}
% Not reversemargin;
% \begin{macrocode}
\ifodd\count\z@
\OutsideHArrow\ref@marginpar\cnt@marginparsep{20}
\PositionX = \ref@marginpar
\else
\OutsideHArrow\ref@margin\cnt@marginparsep{20}
\PositionX = \ref@margin
\fi
\fi
\else
% \end{macrocode}
%
% Single sided mode.
% \changes{v1.2}{1998/04/13}{Added check for reversemargin}
% \begin{macrocode}
\if@reversemargin
\OutsideHArrow\ref@margin\cnt@marginparsep{20}
\PositionX = \ref@margin
\else
\OutsideHArrow\ref@marginpar\cnt@marginparsep{20}
\PositionX = \ref@marginpar
\fi
\fi
% \end{macrocode}
% \changes{v1.2}{1998/04/13}{The \cs{PositionX} of the label 9 is
% changed to the left side of the arrows}
% \begin{macrocode}
\advance\PositionX by -\cnt@marginparsep
\advance\PositionX by -30
\Identify{9}
% \end{macrocode}
%
% Identify the |\footskip|. The arrow will be located on $1/8$th of
% the |\textwidth|.
% \changes{v1.2}{1998/04/13}{The \cs{PositionY} of the label 11 is
% changed to the upper side of the arrows}
% \begin{macrocode}
\PositionX = \cnt@textwidth
\divide\PositionX by 8
\advance\PositionX by \ref@margin
\OutsideVArrow\ref@foot\cnt@footskip{20}{20}
\PositionY = \ref@foot
\advance\PositionY by \cnt@footskip
\advance\PositionY by 30
\Identify{11}
% \end{macrocode}
%
% Identify the |\voffset|. The arrow will be located a bit to the
% left of the edge of the paper.
% \begin{macrocode}
\PositionX = \cnt@paperwidth
\advance\PositionX by -50
\PositionY = \cnt@paperheight
\ExtraYPos = \PositionY
\advance\ExtraYPos by -\cnt@voffset
\advance\PositionY by \cnt@voffset
\divide\PositionY by \tw@
\Identify{2}
\InsideVArrow\ExtraYPos
% \end{macrocode}
%
% Identify |\topmargin|, |\headheight| and |\headsep|.
%
% The arrows will be located on $1/8$th of the |\textwidth|, with
% intervals of the same size, stored in |\Interval|.
% \begin{macrocode}
\Interval = \cnt@textwidth
\divide\Interval by 8
\PositionX = \ref@margin
\advance\PositionX by \Interval
% \end{macrocode}
% First the |\topmargin|. If |\topmargin| has a positive value, the
% arrow is upward. Otherwise, it is downward. The number label is
% always placed at the base of the arrow.
% \changes{v1.2}{1998/04/13}{The direction of the arrows should be
% switched by the sign of \cs{topmargin}}
% \begin{macrocode}
\ifnum\cnt@topmargin > \z@
\ExtraYPos = \ref@head
\advance\ExtraYPos\cnt@headheight
\OutsideVArrow\ExtraYPos\cnt@topmargin{20}{20}
\PositionY = \ExtraYPos
\advance\PositionY by \cnt@topmargin
\else
\ExtraYPos = \cnt@voffset
\OutsideVArrow\ExtraYPos{-\cnt@topmargin}{20}{20}
\PositionY = \ExtraYPos
\advance\PositionY by -\cnt@topmargin
\fi
\advance\PositionY by 30
\Identify{4}
\advance\PositionX by \Interval
% \end{macrocode}
% Then the |\headheight|
% \changes{v1.2}{1998/04/13}{The \cs{PositionY} of the label 5 is
% fixed}
% \begin{macrocode}
\OutsideVArrow\ref@head\cnt@headheight{20}{20}
\PositionY = \ref@head
\advance\PositionY by \cnt@headheight
\advance\PositionY by 30
\Identify{5}
\advance\PositionX by \Interval
% \end{macrocode}
% and finally the |\headsep|
% \changes{v1.2}{1998/04/13}{The \cs{PositionY} of the label 6 is
% fixed}
% \begin{macrocode}
\ExtraYPos=\ref@body
\advance\ExtraYPos\cnt@textheight
\OutsideVArrow\ExtraYPos\cnt@headsep{20}{20}
\PositionY = \ref@body
\advance\PositionY by \cnt@textheight
\advance\PositionY by -30
\Identify{6}
% \end{macrocode}
%
% Here we can end the picture environment and insert a little
% space.
% \begin{macrocode}
\end{picture}
\medskip
% \end{macrocode}
%
% Below the picture we put a table to show the actual values of the
% parameters. Note that fractional points are truncated, i.e.,
% \texttt{72.27pt} is displayed as \texttt{72pt}
%
% The table is typeset inside a box with a depth of 0 to always
% keep it on the same page as the picture.
% \changes{v1.1b}{1994/03/23}{Showing oddside and evenside margins was
% defective}
% \changes{v1.1c}{1994/07/14}{in compatibility mode \cs{footnotesize}
% calls \cs{normalfont}; therefore we need to switch to a tt font
% later}
% \changes{v1.1f}{1995/03/14}{introduced \cs{notshown}}
% \begin{macrocode}
\vtop to 0pt{%
\@minipagerestore\footnotesize\ttfamily
\begin{tabular}{@{}rl@{\hspace{20pt}}rl}
1 & \oneinchtext\ + \LayOutbs\texttt{hoffset}
& 2 & \oneinchtext\ + \LayOutbs\texttt{voffset} \\
3 & \if@twoside
\ifodd\count\z@ \Show{cnt}{oddsidemargin}
\else \Show{cnt}{evensidemargin}
\fi
\else
\Show{cnt}{oddsidemargin}
\fi & 4 & \Show{cnt}{topmargin} \\
5 & \Show{cnt}{headheight} & 6 & \Show{cnt}{headsep} \\
7 & \Show{cnt}{textheight} & 8 & \Show{cnt}{textwidth} \\
9 & \Show{cnt}{marginparsep}&10& \Show{cnt}{marginparwidth} \\
11& \Show{cnt}{footskip} & & \Show{cnt}{marginparpush}
\rlap{(\notshown)}\\
& \Show{ref}{hoffset} & & \Show{ref}{voffset} \\
& \Show{cnt}{paperwidth} & & \Show{cnt}{paperheight} \\
\end{tabular}\vss}
% \end{macrocode}
% When the option \Lopt{verbose} was used the following lines will
% show dimensions on the terminal.
% \begin{macrocode}
\Type{ref}{hoffset}
\Type{ref}{voffset}
\Type{cnt}{textheight}
\Type{cnt}{textwidth}
% \end{macrocode}
% Finally we start a new page.
% \begin{macrocode}
\newpage
}
%</package>
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \Finale
\endinput
|