-
Notifications
You must be signed in to change notification settings - Fork 200
/
Copy pathlayouts.dtx
4842 lines (4742 loc) · 168 KB
/
layouts.dtx
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
% \iffalse meta-comment
%
% layouts.dtx
% Author: Peter Wilson (Herries Press) herries dot press at earthlink dot net)
% Copyright 1998 --- 2004 Peter R. Wilson
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either
% version 1.3 of this license or (at your option) any
% later version.
% The latest version of the license is in
% http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of
% LaTeX version 2003/06/01 or later.
%
% This work has the LPPL maintenance status "author-maintained".
%
% This work consists of the files listed in the README file.
%
%
%<*driver>
\documentclass[twoside]{ltxdoc}
\usepackage{url}
\makeatletter
\@mparswitchfalse
\makeatother
\EnableCrossrefs
\CodelineIndex
\setcounter{StandardModuleDepth}{1}
\renewcommand{\MakeUppercase}[1]{#1}
\pagestyle{headings}
\begin{document}
\raggedbottom
\DocInput{layouts.dtx}
\end{document}
%</driver>
%
% \fi
%
% \CheckSum{6212}
%
% \DoNotIndex{\',\.,\@M,\@@input,\@addtoreset,\@arabic,\@badmath}
% \DoNotIndex{\@centercr,\@cite}
% \DoNotIndex{\@dotsep,\@empty,\@float,\@gobble,\@gobbletwo,\@ignoretrue}
% \DoNotIndex{\@input,\@ixpt,\@m}
% \DoNotIndex{\@minus,\@mkboth,\@ne,\@nil,\@nomath,\@plus,\@set@topoint}
% \DoNotIndex{\@tempboxa,\@tempcnta,\@tempdima,\@tempdimb}
% \DoNotIndex{\@tempswafalse,\@tempswatrue,\@viipt,\@viiipt,\@vipt}
% \DoNotIndex{\@vpt,\@warning,\@xiipt,\@xipt,\@xivpt,\@xpt,\@xviipt}
% \DoNotIndex{\@xxpt,\@xxvpt,\\,\ ,\addpenalty,\addtolength,\addvspace}
% \DoNotIndex{\advance,\Alph,\alph}
% \DoNotIndex{\arabic,\ast,\begin,\begingroup,\bfseries,\bgroup,\box}
% \DoNotIndex{\bullet}
% \DoNotIndex{\cdot,\cite,\CodelineIndex,\cr,\day,\DeclareOption}
% \DoNotIndex{\def,\DisableCrossrefs,\divide,\DocInput,\documentclass}
% \DoNotIndex{% \DoNotIndex,\egroup,\ifdim,\else,\fi,\em,\endtrivlist}
% \DoNotIndex{\EnableCrossrefs,\end,\end@dblfloat,\end@float,\endgroup}
% \DoNotIndex{\endlist,\everycr,\everypar,\ExecuteOptions,\expandafter}
% \DoNotIndex{\fbox}
% \DoNotIndex{\filedate,\filename,\fileversion,\fontsize,\framebox,\gdef}
% \DoNotIndex{\global,\halign,\hangindent,\hbox,\hfil,\hfill,\hrule}
% \DoNotIndex{\hsize,\hskip,\hspace,\hss,\if@tempswa,\ifcase,\or,\fi,\fi}
% \DoNotIndex{\ifhmode,\ifvmode,\ifnum,\iftrue,\ifx,\fi,\fi,\fi,\fi,\fi}
% \DoNotIndex{\input}
% \DoNotIndex{\jobname,\kern,\leavevmode,\let,\leftmark}
% \DoNotIndex{\list,\llap,\long,\m@ne,\m@th,\mark,\markboth,\markright}
% \DoNotIndex{\month,\newcommand,\newcounter,\newenvironment}
% \DoNotIndex{\NeedsTeXFormat,\newdimen}
% \DoNotIndex{\newlength,\newpage,\nobreak,\noindent,\null,\number}
% \DoNotIndex{\numberline,\OldMakeindex,\OnlyDescription,\p@}
% \DoNotIndex{\pagestyle,\par,\paragraph,\paragraphmark,\parfillskip}
% \DoNotIndex{\penalty,\PrintChanges,\PrintIndex,\ProcessOptions}
% \DoNotIndex{\protect,\ProvidesClass,\raggedbottom,\raggedright}
% \DoNotIndex{\refstepcounter,\relax,\renewcommand,\reset@font}
% \DoNotIndex{\rightmargin,\rightmark,\rightskip,\rlap,\rmfamily,\roman}
% \DoNotIndex{\roman,\secdef,\selectfont,\setbox,\setcounter,\setlength}
% \DoNotIndex{\settowidth,\sfcode,\skip,\sloppy,\slshape,\space}
% \DoNotIndex{\symbol,\the,\trivlist,\typeout,\tw@,\undefined,\uppercase}
% \DoNotIndex{\usecounter,\usefont,\usepackage,\vfil,\vfill,\viiipt}
% \DoNotIndex{\viipt,\vipt,\vskip,\vspace}
% \DoNotIndex{\wd,\xiipt,\year,\z@}
%
% \DoNotIndex{\put,\vector,\line,\texttt,\multiply}
%
% \def\dtxfile{layouts.dtx}
% \def\fileversion{v2.3b} \def\filedate{1999/03/06}
% \def\fileversion{v2.4} \def\filedate{2001/04/30}
% \def\fileversion{v2.5} \def\filedate{2001/11/11}
% \def\fileversion{v2.5a} \def\filedate{2002/03/24}
% \def\fileversion{v2.6} \def\filedate{2002/06/09}
% \def\fileversion{v2.6a} \def\filedate{2002/12/12}
% \def\fileversion{v2.6b} \def\filedate{2003/11/25}
% \def\fileversion{v2.6c} \def\filedate{2004/10/25}
% \newcommand*{\Lpack}[1]{\textsf {#1}} ^^A typeset a package
% \newcommand*{\Lopt}[1]{\textsf {#1}} ^^A typeset an option
% \newcommand*{\file}[1]{\texttt {#1}} ^^A typeset a file
% \newcommand*{\Lcount}[1]{\textsl {\small#1}} ^^A typeset a counter
% \newcommand*{\pstyle}[1]{\textsl {#1}} ^^A typeset a pagestyle
% \newcommand*{\Lenv}[1]{\texttt {#1}} ^^A typeset an environment
%
% \title{The \Lpack{layouts} package: Code\thanks{This
% file (\texttt{\dtxfile}) has version number \fileversion, last revised
% \filedate.}}
%
% \author{%
% Peter Wilson \\
% Herries Press \\
% (\texttt{[email protected]})
% }
% \date{\filedate}
% \maketitle
% \begin{abstract}
% The \Lpack{layouts} package provides facilities for document designers
% to experiment with various aspects of the layout of \LaTeX ed documents.
% There is a separate user manual for the package.
% \end{abstract}
% \tableofcontents
%
% \StopEventually{}
%
%
%
% \section{Introduction}
%
% This document provides the commented source for a \LaTeX{}
% package file developed as part of a suite designed for the typesetting of
% documents according to the rules for ISO international
% standards~\cite{PRW96i}.
% A separate document provides the user manual.
%
% Section~\ref{sec:lays} describes a package to assist in the
% design of new \LaTeX{} classes and packages by graphically
% depicting the layout\footnote{With thanks to Frank Mittelbach
% for noticing some problems with version 2.4 and suggesting additional
% features.} of various logical elements of a document.
% This package has general applicability and is not restricted to
% typesetting ISO documents.
%
% This manual is typeset according to the conventions of the
% \LaTeX{} \textsc{docstrip} utility which enables the automatic
% extraction of the \LaTeX{} macro source files~\cite{GOOSSENS94}.
%
%
%
% \section{The \Lpack{layouts} package} \label{sec:lays}
%
% Announce the name and version of the package which requires \LaTeXe.
% \changes{v2.1}{1998/10/14}{Changed the Title, the Introduction, and other text}
% \changes{v2.1}{1998/10/14}{Added requirement for LaTeX2e}
% \changes{v2.2}{1998/11/14}{Tidied a lot of code}
% \changes{v2.2}{1998/11/14}{Added drawing of font boxes}
% \changes{v2.3}{1999/01/21}{Eliminated several new counters}
% \changes{v2.3}{1999/01/21}{Corrected ToC layout}
% \changes{v2.3}{1999/01/21}{Added ...values commands}
% \changes{v2.3a}{1999/01/21}{Tweaked the ToC layout for dotted leader}
% \changes{v2.3b}{1999/03/06}{Undeleted the l@youtscale command}
% \changes{v2.4}{2001/04/30}{Added \cs{drawstock} for the memoir class}
% \changes{v2.4}{2001/04/30}{Added control to switch on/off marginpars}
% \changes{v2.5}{2001/10/22}{Added several booleans}
% \changes{v2.5}{2001/11/01}{Added diagram and design macros}
% \changes{v2.5a}{2002/01/06}{Fixed footheight in page diagrams}
% \changes{v2.6}{2002/06/09}{Added more bells to page layouts}
% \changes{v2.6}{2002/06/09}{General tidying of page layouts code}
% \changes{v2.6a}{2002/12/12}{Cater for negative length in list layout}
% \changes{v2.6b}{2003/11/25}{Corrected spelling and grammatical errors}
% \changes{v2.6c}{2004/10/25}{Privatised the \cs{*inch}, etc., macros}
% \begin{macrocode}
%<*lays>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{layouts}[2004/10/25 v2.6c graphical depiction of document elements]
% \end{macrocode}
%
% The \Lpack{layouts} package provides means of graphically displaying the layout
% of various logical elements of a document such as section headings,
% lists, floats, and others.
%
%
% \section{Counters and such}
%
% First we define some commands, counters, etc., that will be useful
% later on.
%
% \begin{macro}{\bs}
% We will be doing a lot of printing of \LaTeX{} commands, so we
% need a short command to print a backslash.
% \changes{v2.4}{2001/04/30}{Better definition for the \cs{bs} command}
% \begin{macrocode}
\@ifundefined{bs}{\newcommand{\bs}{\texttt{\char`\\}}}%
{\renewcommand{\bs}{\texttt{\char`\\}}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\l@yoneinch}
% \begin{macro}{\l@yeighthalfinch}
% \begin{macro}{\l@yteninch}
% \begin{macro}{\l@yeleveninch}
% \begin{macro}{\l@yonepoint}
% \changes{v2.3}{1999/01/21}{Made `useful values' commands not counters}
% Some generally useful values. |\l@yonepoint| is set to 65536 sp and all
% the others are set to a value in pts.
% \begin{macrocode}
\newcommand{\l@yoneinch}{72}
\newcommand{\l@yeighthalfinch}{615}
\newcommand{\l@yteninch}{723}
\newcommand{\l@yeleveninch}{795}
\newcommand{\l@yonepoint}{65536}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\l@youtscale}
% Internal command that stores the drawing scale factor. Initialised
% to half scale.
% \begin{macrocode}
\newcommand{\l@youtscale}{0.5}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\l@ylen}
% A length.
% \begin{macrocode}
\newlength{\l@ylen}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\layoutsbox}
% A box for storing something. There seems to be no reason why the user
% should not be able to use this.
% \begin{macrocode}
\newsavebox{\layoutsbox}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\l@youtunitlength}
% This will be used for setting the |\unitlength| for a \Lenv{picture}.
% \begin{macrocode}
\newlength{\l@youtunitlength}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\l@youtlinethick}
% \begin{macro}{\l@youtlinethickii}
% These will be used as parameters to a |\linethickness| command.
% \begin{macrocode}
\newlength{\l@youtlinethick}
\newlength{\l@youtlinethickii}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\l@ysetupparskip}%
% \begin{macro}{\l@ysetupbaselineskip}
% Used for storing the document's |\parskip| and |\baselineskip|.
% \begin{macrocode}
\newlength{\l@ysetupparskip}
\newlength{\l@ysetupbaselineskip}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\l@yonem}
% \begin{macro}{\l@yonex}
% Used for storing the document's value for 1em and 1ex.
% \begin{macrocode}
\newlength{\l@yonem}
\newlength{\l@yonex}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\l@ylmarg}
% \begin{macro}{\l@yrmarg}
% \begin{macro}{\l@yitmindent}
% \begin{macro}{\l@ylblwidth}
% \begin{macro}{\l@ylblsep}
% \begin{macro}{\l@ylparindent}
% \begin{macro}{\l@ytsep}
% \begin{macro}{\l@ypskip}
% \begin{macro}{\l@yptsep}
% \begin{macro}{\l@ypsep}
% \begin{macro}{\l@yitmsep}
% We need to store a list environment's values for use when tabulating
% the actual list values.
% \begin{macrocode}
\newlength{\l@ylmarg}
\newlength{\l@yrmarg}
\newlength{\l@yitmindent}
\newlength{\l@ylblwidth}
\newlength{\l@ylblsep}
\newlength{\l@ylparindent}
\newlength{\l@ytsep}
\newlength{\l@ypskip}
\newlength{\l@yptsep}
\newlength{\l@ypsep}
\newlength{\l@yitmsep}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\l@ytok}
% A useful token
% \begin{macrocode}
\newtoks\l@ytok
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\l@youtpw}
% \begin{macro}{\l@youtph}
% We use these for storing the page width and height.
% \begin{macrocode}
\newcount\l@youtpw
\newcount\l@youtph
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\l@youthpi}
% \begin{macro}{\l@youthpii}
% \begin{macro}{\l@youthpiii}
% \begin{macro}{\l@youthpiv}
% \begin{macro}{\l@youthpv}
% \begin{macro}{\l@youthpvi}
% \begin{macro}{\l@youthpvii}
% Counters for horizontal drawing parameters.
%
% \begin{macrocode}
\newcount\l@youthpi
\newcount\l@youthpii
\newcount\l@youthpiii
\newcount\l@youthpiv
\newcount\l@youthpv
\newcount\l@youthpvi
\newcount\l@youthpvii
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\l@youtparskip}
% \begin{macro}{\l@youtvpi}
% \begin{macro}{\l@youtvpii}
% \begin{macro}{\l@youtvpiii}
% \begin{macro}{\l@youtvpiv}
% \begin{macro}{\l@youtvpv}
% \begin{macro}{\l@youtvpvi}
% \begin{macro}{\l@youtvpvii}
% Counters for vertical drawing parameters.
%
% \begin{macrocode}
\newcount\l@youtparskip
\newcount\l@youtvpi
\newcount\l@youtvpii
\newcount\l@youtvpiii
\newcount\l@youtvpiv
\newcount\l@youtvpv
\newcount\l@youtvpvi
\newcount\l@youtvpvii
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\l@youthdo}
% \begin{macro}{\l@youthdi}
% \begin{macro}{\l@youthdii}
% \begin{macro}{\l@youthdiii}
% \begin{macro}{\l@youthdiv}
% \begin{macro}{\l@youthdv}
% \begin{macro}{\l@youthdvi}
% \begin{macro}{\l@youthdvii}
% Horizontal dimensions.
%
% \begin{macrocode}
\newcount\l@youthdo
\newcount\l@youthdi
\newcount\l@youthdii
\newcount\l@youthdiii
\newcount\l@youthdiv
\newcount\l@youthdv
\newcount\l@youthdvi
\newcount\l@youthdvii
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\l@youtvdo}
% \begin{macro}{\l@youtvdi}
% \begin{macro}{\l@youtvdii}
% \begin{macro}{\l@youtvdiii}
% \begin{macro}{\l@youtvdiv}
% \begin{macro}{\l@youtvdv}
% \begin{macro}{\l@youtvdvi}
% \begin{macro}{\l@youtvdvii}
% \begin{macro}{\l@youtvdviii}
% Vertical dimensions.
% \begin{macrocode}
\newcount\l@youtvdo
\newcount\l@youtvdi
\newcount\l@youtvdii
\newcount\l@youtvdiii
\newcount\l@youtvdiv
\newcount\l@youtvdv
\newcount\l@youtvdvi
\newcount\l@youtvdvii
\newcount\l@youtvdviii
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\l@youtxci}
% \begin{macro}{\l@youtxcii}
% \begin{macro}{\l@youtxciii}
% \begin{macro}{\l@youtxciv}
% \begin{macro}{\l@youtxcv}
% \begin{macro}{\l@youtxcvi}
% X coordinates.
% \begin{macrocode}
\newcount\l@youtxci
\newcount\l@youtxcii
\newcount\l@youtxciii
\newcount\l@youtxciv
\newcount\l@youtxcv
\newcount\l@youtxcvi
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\l@youtyci}
% \begin{macro}{\l@youtycii}
% \begin{macro}{\l@youtyciii}
% \begin{macro}{\l@youtyciv}
% \begin{macro}{\l@youtycv}
% \begin{macro}{\l@youtycvi}
% \begin{macro}{\l@youtycvii}
% \begin{macro}{\l@youtycviii}
% Y coordinates.
% \begin{macrocode}
\newcount\l@youtyci
\newcount\l@youtycii
\newcount\l@youtyciii
\newcount\l@youtyciv
\newcount\l@youtycv
\newcount\l@youtycvi
\newcount\l@youtycvii
\newcount\l@youtycviii
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\l@youtxco}
% \begin{macro}{\l@youtyco}
% For the (X,Y) coordinates of the bottom left hand corner of the page.
% \changes{v2.4}{2001/04/30}{Added \cs{l@youtxco} and \cs{l@youtyco}}
% \begin{macrocode}
\newcount\l@youtxco
\newcount\l@youtyco
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \section{Initialisations}
%
% The following are used to set up default conditions.
%
% \begin{macro}{\ifoddpagelayout}
% Set TRUE to draw an oddside page.
% \begin{macrocode}
\newif\ifoddpagelayout
\oddpagelayouttrue
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\iftwocolumnlayout}
% Set TRUE to draw a two column page.
% \begin{macrocode}
\newif\iftwocolumnlayout
\twocolumnlayoutfalse
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ifdrawmarginpars}
% Set TRUE to draw marginpars on a page.
% \begin{macrocode}
\newif\ifdrawmarginpars
\drawmarginparstrue
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ifdrawparameters}
% Set TRUE to draw a layout with marked dimension lines.
% \begin{macrocode}
\newif\ifdrawparameters
\drawparameterstrue
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\iflistaspara}
% Set TRUE to draw lists as stand-alone paragraph.
% \begin{macrocode}
\newif\iflistaspara
\listasparatrue
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ifruninhead}
% Set TRUE to draw a run-in heading.
% \begin{macrocode}
\newif\ifruninhead
\runinheadfalse
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ifprintparameters}
% Set TRUE to print table of actual parameter values
% \changes{v2.5}{2001/10/22}{Added \cs{ifprintparameters}}
% \begin{macrocode}
\newif\ifprintparameters
\printparameterstrue
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ifdrawdimensions}
% Set TRUE to draw dimension lines
% \changes{v2.5}{2001/10/22}{Added \cs{ifdrawdimensions}}
% \begin{macrocode}
\newif\ifdrawdimensions
\drawdimensionsfalse
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ifprintheadings}
% Set TRUE to print text about dashed lines.
% \changes{v2.5}{2001/10/22}{Added \cs{ifprintheadings}}
% \begin{macrocode}
\newif\ifprintheadings
\printheadingstrue
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ifl@ytempif}
% A scratch |\if|.
% \changes{v2.5}{2001/10/22}{Added \cs{ifl@ytempif}}
% \begin{macrocode}
\newif\ifl@ytempif
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\l@yor}
% |\l@yor{|\meta{ifA}|}{|\meta{ifB}|}| sets |\ifl@ytempif| to TRUE
% unless \meta{ifA} is FALSE and \meta{ifB} is FALSE (i.e.,
% |\ifl@tempif| = \meta{ifA} OR \meta{ifB}).
% \changes{v2.5}{2001/10/22}{Added \cs{l@yor}}
% \begin{macrocode}
\newcommand{\l@yor}[2]{%
\l@ytempiftrue
#1
\else
#2
\else
\l@ytempiffalse
\fi
\fi}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\l@ynnand}
% |\l@ynnand{|\meta{ifA}|}{|\meta{ifB}|}| sets |\ifl@ytempif| to FALSE
% unless \meta{ifA} is FALSE and \meta{ifB} is TRUE
% \changes{v2.5}{2001/10/22}{Added \cs{l@ynnand}}
% \begin{macrocode}
\newcommand{\l@ynnand}[2]{%
\l@ytempiffalse
#1
\else
#2
\l@ytempiftrue
\fi
\fi}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\l@ynox}
% |\l@ynox{|\meta{ifA}|}{|\meta{ifB}|}| sets |\ifl@ytempif| to TRUE
% unless \meta{ifA} is TRUE and \meta{ifB} is FALSE.
% \changes{v2.5}{2001/10/22}{Added \cs{l@ynox}}
% \begin{macrocode}
\newcommand{\l@ynox}[2]{%
\l@ytempiftrue
#1
#2
\else
\l@ytempiffalse
\fi
\fi}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\testdrawdimensions}
% \begin{macro}{\testprintparameters}
% \changes{v2.5}{2001/10/21}{Added \cs{testdrawdimensions} and
% \cs{testprintparameters}}
% \changes{v2.5}{2001/10/21}{Use \cs{testdrawdimensions} for check to
% draw dimensions in actual layouts}
% \changes{v2.5}{2001/10/21}{Use \cs{testprintparameters} for check to
% list parameter values in actual layouts}
% \begin{macrocode}
\newcommand{\testdrawdimensions}{%
\l@yor{\ifdrawparameters}{\ifdrawdimensions}}
\newcommand{\testprintparameters}{%
\l@ynnand{\ifdrawparameters}{\ifprintparameters}}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\setlabelfont}
% \begin{macro}{\l@ylabelfont}
% The font for labels in the diagrams.
% \changes{v2.5}{2001/10/22}{Added \cs{setlabelfont} and \cs{l@ylabelfont}}
% \begin{macrocode}
\newcommand{\setlabelfont}[1]{\renewcommand{\l@ylabelfont}{#1}}
\newcommand{\l@ylabelfont}{\normalfont}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\setparametertextfont}
% \begin{macro}{\l@yparamfont}
% The font size for parameters.
% \changes{v2.5}{2001/10/22}{Added \cs{setparametertextfont} and \cs{l@yparamfont}}
% \begin{macrocode}
\newcommand{\setparametertextfont}[1]{\renewcommand{\l@yparamfont}{#1}}
\newcommand{\l@yparamfont}{\footnotesize}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\setvaluestextsize}
% \begin{macro}{\l@yvalsize}
% The font size for value tables.
% \changes{v2.5}{2001/10/22}{Added \cs{setvaluestextsize} and \cs{l@yvalsize}}
% \begin{macrocode}
\newcommand{\setvaluestextsize}[1]{\renewcommand{\l@yvalsize}{#1}}
\newcommand{\l@yvalsize}{\normalsize}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
%
% \begin{macro}{\setlayoutscale}
% A user command to set the drawing scale. The scale is initialised
% to half size.
% \changes{v2.5a}{2002/01/06}{Added warning to \cs{setlayoutscale}}
% \begin{macrocode}
\newcommand{\setlayoutscale}[1]{\setlength{\l@youtunitlength}{1pt}
\l@youtunitlength = #1\l@youtunitlength
\renewcommand{\l@youtscale}{#1}
\PackageWarning{layouts}{Layout scale set to #1}}
%%%\setlayoutscale{0.5}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\setuplayouts}
% The |\setuplayouts| command should be called immediately at
% the |\begin{document}|. It must be called before any command that
% changes font sizes or makes any change to the document layout.
% It stores relevant skips.
% \begin{macrocode}
\newcommand{\setuplayouts}{%
\setlength{\l@ysetupparskip}{\parskip}
\setlength{\l@ysetupbaselineskip}{\baselineskip}
\setlength{\l@yonem}{1em}
\setlength{\l@yonex}{1ex}
\setlayoutscale{0.5}
%%% \PackageWarning{layouts}{Layout scale set to 0.5}
}
\AtBeginDocument{\setuplayouts}
% \end{macrocode}
% \end{macro}
%
% \section{Utility commands}
%
% A variety of utility commands.
%
% \begin{macro}{\l@yltoc}
% |\l@yltoc{|\meta{length}|}{|\meta{counter}|}| converts a length into a
% counter value. The counter value is to the nearest
% pt of the length.
% \begin{macrocode}
\newcommand{\l@yltoc}[2]{\setlength{\l@ylen}{#1}%
\ifdim\l@ylen > \z@ \advance\l@ylen by 0.5\p@ \else
\ifdim\l@ylen < \z@ \advance\l@ylen by -0.5\p@
\fi
\fi
#2=\l@ylen
\divide #2 by \l@yonepoint\relax}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\l@yvuda}
% \begin{macro}{\l@yhrda}
% |\l@yvuda{|\meta{x}|}{|\meta{y}|}{|\meta{distance}|}| draws a line
% vertically upwards from (\meta{x},\meta{y}) a \meta{distance} with an
% outward pointing arrowhead at each end of the line. |\l@yhrda| is
% similar except that a horizontal line is drawn to the right. Simplistically,
% the commands produce something like |<---->|.
% \begin{macrocode}
\newcommand{\l@yvuda}[3]{\put(#1,#2){\vector(0,1){#3}}
\put(#1,#2){\vector(0,-1){0}}}
\newcommand{\l@yhrda}[3]{\put(#1,#2){\vector(1,0){#3}}
\put(#1,#2){\vector(-1,0){0}}}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\l@yvudia}
% \begin{macro}{\l@yhrdia}
% |\l@yvudia{|\meta{x}|}{|\meta{y}|}{|\meta{distance}|}| draws two vertical
% arrowheads pointing to each other. One is at (\meta{x},\meta{y}) and
% the other is at (\meta{x},\meta{y + distance}). |\l@yhrdia| is
% similar except that the arrowheads are horizontal.
% Simplistically, the commands produce something like |> <|.
% \begin{macrocode}
\newcommand{\l@yvudia}[3]{\begingroup
\l@youthpvii=#1\relax
\l@youtvpvii=#2\relax
\l@youthdvii=#3\relax
\put(\l@youthpvii,\l@youtvpvii){\vector(0,1){0}}
\advance\l@youtvpvii by \l@youthdvii
\put(\l@youthpvii,\l@youtvpvii){\vector(0,-1){0}}
\endgroup}
\newcommand{\l@yhrdia}[3]{\begingroup
\l@youthpvii=#1\relax
\l@youtvpvii=#2\relax
\l@youthdvii=#3\relax
\put(\l@youthpvii,\l@youtvpvii){\vector(1,0){0}}
\advance\l@youthpvii by \l@youthdvii
\put(\l@youthpvii,\l@youtvpvii){\vector(-1,0){0}}
\endgroup}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\l@ypcmd}
% \begin{macro}{\l@ycmd}
% |\l@ypcmd{|\meta{cmdname}|}| typesets a command \meta{cmdname} (which does
% not include the backslash) (in a picture). For example, |\l@ypcmd{fred}|
% prints |\fred|. The font size is given by |\l@yparamfont|. The
% |\l@ycmd| macro is similar but does not set the font size.
% \begin{macrocode}
\newcommand{\l@ypcmd}[1]{{\l@yparamfont\texttt{\bs #1}}}
\newcommand{\l@ycmd}[1]{\texttt{\bs #1}}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\printinunitsof}
% \begin{macro}{\l@yunitperpt}
% \begin{macro}{\l@yunits}
% |\printinunitsof{|\meta{unit}|}| sets |\l@yunits| to the value of \meta{unit}
% and |\l@yunitperpt| to the number of \meta{unit} in 1pt.
% \changes{v2.5}{2001/10/21}{Added \cs{printinunitsof}, \cs{l@yunitperpt}
% and \cs{units}}
% \begin{macrocode}
\newcommand{\printinunitsof}[1]{%
\def\l@yunitperpt{1.0}\def\l@yunits{pt}%
\def\l@yta{#1}\def\l@ytb{pt}%
\ifx \l@yta\l@ytb
\def\l@yunitperpt{1.0}\def\l@yunits{pt}%
\else
\def\l@ytb{pc}%
\ifx \l@yta\l@ytb
\def\l@yunitperpt{0.083333}\def\l@yunits{pc}%
\else
\def\l@ytb{in}%
\ifx \l@yta\l@ytb
\def\l@yunitperpt{0.013837}\def\l@yunits{in}%
\else
\def\l@ytb{mm}%
\ifx \l@yta\l@ytb
\def\l@yunitperpt{0.351459}\def\l@yunits{mm}%
\else
\def\l@ytb{cm}%
\ifx \l@yta\l@ytb
\def\l@yunitperpt{0.0351459}\def\l@yunits{cm}%
\else
\def\l@ytb{bp}%
\ifx \l@yta\l@ytb
\def\l@yunitperpt{0.996264}\def\l@yunits{bp}%
\else
\def\l@ytb{dd}%
\ifx \l@yta\l@ytb
\def\l@yunitperpt{0.9345718}\def\l@yunits{dd}%
\else
\def\l@ytb{cc}%
\ifx \l@yta\l@ytb
\def\l@yunitperpt{0.0778809}\def\l@yunits{cc}%
\else
\def\l@ytb{PT}%
\ifx \l@yta\l@ytb
\def\l@yunitperpt{1.0}\def\l@yunits{PT}%
\fi
\fi
\fi
\fi
\fi
\fi
\fi
\fi
\fi
}
\printinunitsof{pt}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\l@ytempdima}
% \begin{macro}{\prntlen}
% |\l@ytempdima| is a scratch length. |\prntlen{|\meta{length}|}|
% prints the value of \meta{length} in the units set by |\printinunitsof|.
% \changes{v2.5}{2001/10/21}{Added \cs{l@ytempdima} and \cs{prntlen}}
% \begin{macrocode}
\newlength{\l@ytempdima}
\newcommand{\prntlen}[1]{%
\def\l@yta{pt}\ifx\l@yta\l@yunits\the#1\else
\def\l@yta{PT}%
\l@ytempdima=\l@yunitperpt #1\relax\strip@pt\l@ytempdima
\ifx\l@yta\l@yunits pt\else\l@yunits\fi\fi}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\l@yval}
% |\l@yval{|\meta{lcmd}|}| prints a value of the (length) command \meta{lcmd}
% (which includes the backslash); for example |\l@yval{\mylength}|.
% \changes{v2.5}{2001/10/21}{Changed the definition of \cs{l@yval}}
% \begin{macrocode}
%%% \newcommand{\l@yval}[1]{\the#1}
\newcommand{\l@yval}[1]{\prntlen{#1}}
% \end{macrocode}
% \end{macro}
%
% \section{Drawing the layout of a page}
%
% A variety of commands are used to draw the layout of a page.
%
% First some utility commands for setting the layout dimensions.
% \begin{macro}{\trypaperwidth}
% Sets the |paperwidth| and stores the result in |\l@youtpw|.
% \begin{macrocode}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% PAGE LAYOUT
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\trypaperwidth}[1]{\l@yltoc{#1}{\l@youtpw}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\trypaperheight}
% Sets the |paperheight| and stores the result in |\l@youtph|.
% \begin{macrocode}
\newcommand{\trypaperheight}[1]{\l@yltoc{#1}{\l@youtph}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tryhoffset}
% Sets the |hoffset| and stores the result in |\l@youthpi|.
% \begin{macrocode}
\newcommand{\tryhoffset}[1]{\l@yltoc{#1}{\l@youthpi}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tryvoffset}
% Sets the |voffset| and stores the result in |\l@youtvpi|.
% \begin{macrocode}
\newcommand{\tryvoffset}[1]{\l@yltoc{#1}{\l@youtvpi}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\trytopmargin}
% Sets the |topmargin| and stores the result in |\l@youtvpii|.
% \begin{macrocode}
\newcommand{\trytopmargin}[1]{\l@yltoc{#1}{\l@youtvpii}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tryheadheight}
% Sets the |headheight| and stores the result in |\l@youtvpiii|.
% \begin{macrocode}
\newcommand{\tryheadheight}[1]{\l@yltoc{#1}{\l@youtvpiii}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tryheadsep}
% Sets the |headsep| and stores the result in |\l@youtvpiv|.
% \begin{macrocode}
\newcommand{\tryheadsep}[1]{\l@yltoc{#1}{\l@youtvpiv}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\trytextheight}
% Sets the |textheight| and stores the result in |\l@youtvpv|.
% \begin{macrocode}
\newcommand{\trytextheight}[1]{\l@yltoc{#1}{\l@youtvpv}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tryfootskip}
% Sets the |footskip| and stores the result in |\l@youtvpvi|.
% \begin{macrocode}
\newcommand{\tryfootskip}[1]{\l@yltoc{#1}{\l@youtvpvi}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tryoddsidemargin}
% Sets the |oddsidemargin| and stores the result in |\l@youthpv|.
% \begin{macrocode}
\newcommand{\tryoddsidemargin}[1]{\l@yltoc{#1}{\l@youthpv}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tryevensidemargin}
% Sets the |evensidemargin| and stores the result in |\l@youthpiv|.
% \begin{macrocode}
\newcommand{\tryevensidemargin}[1]{\l@yltoc{#1}{\l@youthpiv}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\trytextwidth}
% Sets the |textwidth| and stores the result in |\l@youthpii|.
% \begin{macrocode}
\newcommand{\trytextwidth}[1]{\l@yltoc{#1}{\l@youthpii}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\trymarginparsep}