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
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
|
% \iffalse meta-comment
%
% Copyright (C) 2020-2023 by Antoine Missier <antoine.missier@ac-toulouse.fr>
% ----------------------------------------------------------------------
%
% This file 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 this license is in:
%
% http://www.latex-project.org/lppl.txt
%
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% \fi
%
% \iffalse
%<*driver>
\ProvidesFile{schooldocs.dtx}
%</driver>
%<package>\NeedsTeXFormat{LaTeX2e}[2005/12/01]
%<package>\ProvidesPackage{schooldocs}
%<*package>
[2023/08/28 v1.3 .dtx schooldocs file]
%</package>
%
%<*driver>
\documentclass{ltxdoc}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{charter}
\usepackage{lipsum}
\usepackage{boxedminipage2e}
\usepackage{sectsty}
\usepackage{spacingtricks}
\usepackage{schooldocs}
\usepackage{hyperref}
%\usepackage{geometry}
\geometry{textwidth=355pt,vmarginratio=1:1,hmarginratio=3:2}
% modified by schoodocs loading, very close from the default geometry used by ltxdoc
\newcommand{\bs}{\textbackslash}
\setlength{\fboxsep}{13pt}
\newlength{\mpwd} \setlength{\mpwd}{5.25cm}
\newenvironment{stylex}{\begin{boxedminipage}[c][1.3\mpwd][t]{\mpwd}\tiny
}{\end{boxedminipage}}
\definecolor{darkbrown}{rgb}{0.5,0.1,0.1}
\allsectionsfont{\color{darkbrown}} %\sffamily
\providecommand\headtitlestyle{\scshape}
\providecommand\headsubjectstyle{\scshape}
\providecommand\schoolstyle{\scshape}
%\EnableCrossrefs
%\CodelineIndex
%\RecordChanges
\title{The \textsf{schooldocs} package}%\thanks{This document
% corresponds to \textsf{schooldocs}~\fileversion, dated \filedate.}}
\subject{Antoine Missier \\ %
\texttt{antoine.missier@ac-toulouse.fr}}
\date{\filedate, \fileversion}
\hypersetup{%
colorlinks,
linkcolor=red,
filecolor=blue,
pdftitle={schoodocs},
pdfsubject={LaTeX package},
pdfauthor={Antoine Missier}
}
\begin{document}
\DocInput{schooldocs.dtx}
\PrintChanges
\PrintIndex
\end{document}
%</driver>
% \fi
%
% \CheckSum{811}
%
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
% Digits \0\1\2\3\4\5\6\7\8\9
% Exclamation \! Double quote \" Hash (number) \#
% Dollar \$ Percent \% Ampersand \&
% Acute accent \' Left paren \( Right paren \)
% Asterisk \* Plus \+ Comma \,
% Minus \- Point \. Solidus \/
% Colon \: Semicolon \; Less than \<
% Equals \= Greater than \> Question mark \?
% Commercial at \@ Left bracket \[ Backslash \\
% Right bracket \] Circumflex \^ Underscore \_
% Grave accent \` Left brace \{ Vertical bar \|
% Right brace \} Tilde \~}
%
%
% \changes{v0.0}{2010/09/01}{Initial personal version}
% \changes{v0.1}{2020/01/05}{Initial documentation in French}
% \changes{v0.2}{2020/05/04}{Examples file}
% \changes{v1.0}{2020/07/13}{Initial public version with documentation in English}
% \changes{v1.1}{2021/09/18}{Using the translations package for internationalization}
% \changes{v1.2}{2022/11/14}{
% - New parameter smalltitletopskip,
% - Forename discarded from the identity style,
% - sffamily discarded from the default titlestyle
% - smalltitletopskip changed from -2.0cm to -1.32cm}
% \changes{v1.2}{2023/01/24}{
% Small changes in documentation (charter font is now used)
% and examples files (with several fonts)}
% \changes{v1.3}{2023/08/28}{
% - English documentation corrections}
%
% \GetFileInfo{schooldocs.dtx}
%
% \maketitle
%
% \section{Introduction}
%
% The aim of this package is to offer diverse layout styles
% for school-related documents.
% It serves well in creating exercise sheets, exams, and course materials.
% The package defines page geometry (text and margins dimensions)
% and title formatting.
% Various \emph{styles} are available defining settings for headers, footers
% or alternative title formatting, providing many customizable features.
% Six different styles are proposed that are named:
% \begin{center} \bfseries
% \hfill classic \hfill elegant \hfill modern \hfill soft
% \hfill exam \hfill collection \hfill \mbox{}
% \end{center}
% Furthermore, a specific style named \textbf{identity} is provided
% for documents like exam sheets that need to be completed and returned.
% This style replaces the left header with ``\identityname'',
% while keeping the center and right parts empty.
%
% \medskip
% An overview of these styles is presented in section \ref{par:styles}
% and you can observe the visual outcomes of each style in the file
% \href{run:schooldocs-examples.pdf}{\textsf{schooldocs-examples.pdf}}.
%
% \section{Usage}
%
% \subsection{Choosing a style}
% After loading the package with |\usepackage{schooldocs}|,
% the style is defined by placing |\pagestyle|\marg{style} in the preamble.
% This command comes from the \textsf{fancyhdr} package by Piet van Oostrum.
% It can be placed before of after entering the information described in the next subsection.
%
% \medskip
% You can change the style of a particular page by placing
% |\thispagestyle|\marg{style} on the page you desire.
% For example, on an appendix page that needs to be rendered
% you can use the command |\thispagestyle{identity}|.
%
% \subsection{Information fields}
%
% \DescribeMacro{\title}
% Typically a \LaTeX\ document title is assembled using information
% from the macros |\title|, |\date|, and |\author|.
% The |\title| macro has been extended with an enriched syntax:
% |\title|\oarg{head}\marg{title}.
% The optional parameter \meta{head} corresponds to the text displayed in the header
% instead of \meta{title}.
% When not provided, the mandatory argument \meta{title} will be used in headers.
%
% The macros |\date| and |\author| have not been altered, but the provided information
% is also used in titles, headers or footers
% (depending on the chosen style)
% \footnote{The macro \texttt{\bslash and},
% which can be employed in the \texttt{\bslash author} command
% to typeset a title with several authors, does not function here,
% except in the \textbf{collection} style. Attempting to use it will result
% in a compilation error. The \texttt{\bslash thanks} macro also
% doesn't work, although it does not generate an error.}.
%
% \pagebreak
% \medskip
% \DescribeMacro{\subject} \DescribeMacro{\school} \DescribeMacro{\institute}
% Two additional information macros
% are provided for use in titles, headers or footers, depending on the style:
% |\subject| and |\school| (or its alias |\institute|).
% The |\subject| macro includes an optional argument, similar to |\title|:
% |\subject|\oarg{head}\marg{title}. This enables the placement of an alternative text
% in the header, distinct from the text displayed in the title.
%
% \medskip
% Information macros must be invoked in the preamble
% \footnote{However, the macros \texttt{\bslash date} and \texttt{\bslash author}
% can be used within the document body.},
% they are optional. In cases of omission, the corresponding field will remain empty --
% except for the date field, which will display today's date.
% Therefore, if you wish to exclude the date, you can simply enter |\date{}|.
% If certain title elements, such as subject or date, are absent, the title height
% will be reduced accordingly.
%
% All of these information macros, except for |\date|, accept multi-line arguments, \eg
% |\school{Royal College of Pataphysics\\London}|.
% Within the |\title| macro, if you wish to typeset two (or more) lines, use |\\[1ex]|
% for a proper vertical spacing.
%
% When employing the \textsf{hyperref} package
% (developed by Sebastian Rahtz and Heiko Oberdiek),
% the information provided via |\title|, |\subject|, and |\author|
% (as well as |\school|
% \footnote{The \emph{author} field of the PDF properties will be filled
% as follows: \textsf{author (school)}.
% However \texttt{\bs author} should be called before \texttt{\bs school} in the preamble.
% })
% will also be included in the PDF properties.
%
% \medskip
% The file \textsf{schooldocs-examples.pdf} utilizes the information fields
% outlined in the following table.
% \begin{center}
% \begin{tabular}{ll}
% \hline
% macro & example \\
% \hline
% |\title| & |\title[The classic style]{The classic style layout}| \\
% |\subject| & |\subject[Pathography / M2A]{Pathography / Master 2A}| \\
% |\author| & |\author{Antoine Missier}| \\
% |\school| & |\school{Royal College of Pataphysics}| \\
% |\date| & |\date{May 4, 2020}| \\
% \hline
% \end{tabular}
% \end{center}
%
% \DescribeMacro{\subtitle}
% Within the \textbf{exam} style, the title includes an additional field
% provided by the macro |\subtitle|\marg{text}. The \meta{text} argument
% will be positioned beneath the other title elements and above the separation rule,
% if present. For instance, |\subtitle{Duration of the test: 2\,h}|.
% For a multi-line argument, use |\par| for line breaks instead of |\\|.
%
% \subsection{Making the title}
%
% \DescribeMacro{\maketitle}
% Just like in the standard \LaTeX\ classes, the title is generated
% using the |\maketitle| macro, which is placed after |\begin{document}|.
% This macro has been redefined by the package.
% In fact, the default title produced by the \LaTeX\ \texttt{article} class
% appears unsuitable for school documents such as exercise sheets.
% Vertical spacing before the title has been reduced and,
% a horizontal rule is inserted to separate the title from the subsequent text.
% By default, the title is centered, but this can be altered,
% as demonstrated in section \ref{par:title-set}, to achieve
% a left or right alignment (or even boxing).
% Various title examples can be found in the file
% \href{run:schooldocs-examples.pdf}{\textsf{schooldocs-examples.pdf}}.
%
% The macro has on optional parameter |\maketitle|\oarg{rulelength}
% to define the length of the separation rule, which is 2.5\,cm by default.
% The rule can be completely removed by setting the
% optional argument to 0\,cm. Alternatively, you can typeset a rule spanning
% the entire line using |\maketitle[\linewidth]|. ^^A or |\maketitle[\textwidth]|.
%
% Each style has its own title formatting. Nevertheless the package offers
% a ``standard'' title formatting when no specific style is loaded or when using
% the \LaTeX\ styles \textbf{empty} or \textbf{plain}.
% The \textbf{elegant} style also retains this ``standard'' title formatting.
%
% \medskip
% \DescribeMacro{\seprule}
% Just like in the title, a rule can also be used within
% the text body for creating separations.
% This is achieved using the |\seprule|\oarg{length} macro,
% producing a horizontal and centered rule of optional \meta{length},
% with a default of 2.5\,cm.
%
% \medskip
% \DescribeMacro{\correct}
% To typeset a correct version of an exercise sheet, we provide the |\correct| macro,
% which adds `` -- Correct Version'' to the title.
% It should be placed in the preamble.
% When used with packages that manage multiple versions of a document,
% this macro eliminates the need to define distinct titles for an exercise sheet
% an its correct version.
% However in the \textbf{exam} style, the text ``Correct version''
% replaces the subtitle instead of being added in the main title (except in headers).
%
% \medskip
% \DescribeMacro{\makesmalltitle}
% Inspired by the package \textsf{phfnote} by Philippe Faist, we also offer
% a compact title format. This format combines the details from
% |\title|, |\subject| and |\date| into a single line,
% depending on the chosen style (see \textsf{schooldocs-examples.pdf}).
% The rule is always displayed and spans the entire line width.
%
% \subsection{Style layouts} \label{par:styles}
%
% In accordance with typographic good practices,
% the header on the title page is usually left empty
% (see The \LaTeX\ Companion).
% However, this ``rule'' is often disregarded in school documents.
% On the first page, it is common to find information such as author, school, etc.,
% at the top left and the date at the top right, resembling the layout of a letter.
% While we adhere to good practices for the headers (except in the \textbf{classic} style),
% we still include certain information in the footer.
%
% Below, we present miniature previews illustrating the six styles layout.
% The file \href{run:schooldocs-examples.pdf}{\textsf{schooldocs-examples.pdf}}
% provides an actual representation.
% In several styles, a rule is placed below the header.
% It can be displayed or removed by setting its width, and the same applies to a rule
% above the footer.
% The formatting of each element, as well as specific spacing settings,
% can be freely customized as detailed in \ref{par:head-settings}.
%
% \medskip
% \begin{stylex}
% {\schoolstyle School} \hfill {Author}\\[-0.3ex]
% {\headsubjectstyle Subject} \hfill {date}\\
% \vspace{0.04\mpwd}
% \centered{\footnotesize\bfseries The classic style}
% \vspace{-0.25ex}\centered{\rule{0.15\mpwd}{0.1pt}}
% \vspace{0.85\mpwd}
% \centered{1/2}
% \end{stylex}
% \qquad
% \begin{stylex}
% \mbox{}\\[1ex]
% {\headtitlestyle Title} \hfill {\headsubjectstyle Subject}\\
% \vspace{0.97\mpwd}
% \centered{2/2}
% \end{stylex}
% \medskip
%
% \begin{stylex}
% \mbox{}\vspace{0.03\mpwd}
% \begin{center}
% {\footnotesize\bfseries The elegant style}\\[1.7ex]
% {\scriptsize Subject} \\[0.5ex]
% {\scriptsize date} \\
% \vspace{-0.5ex}\rule{0.15\mpwd}{0.1pt}
% \end{center}
% \vspace{0.72\mpwd}
% {\schoolstyle School} \hfill Author
% \end{stylex}
% \qquad
% \begin{stylex}
% {\headtitlestyle Title} \hfill Page
% \end{stylex}
% \medskip
%
% \begin{stylex}
% \mbox{}\vspace{0.03\mpwd}
% \begin{center}
% {\footnotesize\bfseries The modern style}\\[1.7ex]
% {\scriptsize Subject} \\
% \vspace{-0.5ex}\rule{0.15\mpwd}{0.1pt}
% \end{center}
% \vspace{0.75\mpwd}
% {\schoolstyle School} \hfill \begin{tabular}[c]{r@{}}Author\\[-0.5ex] date\end{tabular}
% \end{stylex}
% \qquad
% \begin{stylex}
% {\headtitlestyle Title} \hfill {\headsubjectstyle Subject} \par
% \vspace{-1.9ex}\rule{0.82\mpwd}{0.1pt}
%
% \vspace{1.01\mpwd}
% \centered{2/2}
% \end{stylex}
% \medskip
%
% \begin{stylex}
% \mbox{}\vspace{0.03\mpwd}
% \begin{center}
% {\footnotesize\bfseries The soft style}\\
% \vspace{-0.5ex}\rule{0.15\mpwd}{0.1pt}
% \end{center}
% \vspace{0.83\mpwd}
% {\schoolstyle School} \hfill {\headsubjectstyle Subject}\\
% Author \hfill date
% \end{stylex}
% \qquad
% \begin{stylex}
% {\headtitlestyle Title} \hfill Page \par
% \vspace{-1.9ex}\rule{0.82\mpwd}{0.1pt}
% \vspace{0.97\mpwd}
%
% \schoolstyle School \hfill \headsubjectstyle Subject
% \end{stylex}
% \medskip
%
% \begin{stylex}
% \mbox{}\vspace{0.1\mpwd}
% \begin{center}
% {\footnotesize THE EXAM STYLE}\\[3.2ex]
% {\scriptsize\bfseries Subject} \\[2.8ex]
% {\scriptsize date} \\[2ex]
% {\scriptsize\slshape subtitle} \\
% \rule{0.15\mpwd}{0.1pt}
% \end{center}
% \vspace{0.51\mpwd}
% \begin{tabular}[c]{@{}l}Author\\[-0.5ex] \schoolstyle School\end{tabular} \hfill {Page}
% \end{stylex}
% \qquad
% \begin{stylex}
% {\headtitlestyle TITLE} \hfill {\headsubjectstyle Subject} \par
% \vspace{-1.9ex}\rule{0.82\mpwd}{0.1pt}
%
% \vspace{1.01\mpwd}
% \begin{tabular}[c]{@{}l}Author\\[-0.5ex] \schoolstyle School\end{tabular} \hfill {Page}
% \end{stylex}
% \medskip
%
% \begin{stylex}
% \mbox{}\vspace{0.1\mpwd}
% \begin{center}
% {\footnotesize THE COLLECTION STYLE}\\[3.2ex]
% {\scriptsize\bfseries Subject} \\[2.8ex]
% {\scriptsize Author} \\[1.5ex]
% {\scriptsize School} \\[1.5ex]
% {\scriptsize date} \\
% \rule{0.15\mpwd}{0.1pt}
% \end{center}
% \end{stylex}
% \qquad
% \begin{stylex}
% {\headtitlestyle TITLE} \hfill {\headsubjectstyle Section} \par
% \vspace{-1.9ex}\rule{0.82\mpwd}{0.1pt}
%
% \vspace{1.01\mpwd}
% {\schoolstyle School} \hfill {2}
% \end{stylex}
% \bigskip
%
% The \textbf{collection} style is well-suited for longer documents.
% In this style the name of the current section is displayed in the right header
% and updates as the content progresses, similar to the behavior
% in the \LaTeX\ \textbf{book} class.
%
% \section{Settings}
%
% \subsection{Page layout}
%
% The page layout is set in the same way for all styles.
% It is defined by the |\geometry| macro of the package
% \textsf{geometry} (by Hideo Umeki and David Carlisle).
% Following good typographic practice (see the \LaTeX\ Companion,
% the \textsf{typearea} package or the \textsf{KOMA-Script} bundle documentation),
% the ratio between the text body (referred to as the ``type area'' by typographers)
% and the page size must be the same horizontally and vertically.
% This ratio gauges the ``shade of gray'' of a page.
% The default scale in the \textsf{geometry} package is 0.7.
% However, for school documents, this setting seems to result in excessive white
% space in the margins. Thus we have adjusted this ratio to 0.75.
% You can modify it using the |\newgeometry| command
% \footnote{You can also call \textsf{geometry} before \textsf{schooldocs}.
% Setting the scale factor several times doesn't work.}.
%
% Moreover, in accordance with ``canons of page construction'', in a one-sided document,
% the ratio between the left and right margins should be 1:1,
% while the ratio between top and bottom margins should be 1:2.
% It appears that this recommended 1:2 ratio is rarely observed,
% as it results in an overly wide bottom margin.
% Additionally, when loading the \textsf{geometry} package, the default vertical
% ratio is set at 2:3 and not 1:2.
% To achieve more balanced margins, we have preferred to set it at 3:4, using
% |\geometry{scale=0.75,vmarginratio=3:4,heightrounded}|
% \footnote{The \texttt{heightrounded} option rounds text height to a multiple of $n$ times
% the height of a line (where $n$ is an integer), preventing occurrences
% of ``underfull vbox'' at times.}.
%
% \subsection{Title settings} \label{par:title-set}
%
% Several parameters allow for customizing the title composition.
% They are presented in the table below along with their default settings.
% Colors can be altered using |\definecolor|, macros using |\renewcommand|
% and lengths using |\setlength|.
% Most command names are self-explanatory and don't require additional information
% about their usage.
% The |\titleflush| command handles alignment:
% it is centered by default, but can be left-aligned using
% |\renewcommand{\titleflush}{flushleft}| (\texttt{flushright} for right alignment)
% \footnote{This macro has no effect
% with the \textbf{exam} and \textbf{collection} styles,
% where the title is always centered.}.
%
% The length |\titlesep| determines the vertical spacing between the \emph{title}
% and \emph{subject} fields, except for the \textbf{classic} and \textbf{soft} styles,
% witch contain only the \emph{title} field, or when the \emph{subject} field
% is not provided.
% Vertical space between other title fields is defined relative to
% |\titlesep| (|0.5\titlesep| for most).
%
% Unless specified otherwise, the ``special settings'' column in the following table
% applies to the \textbf{exam} and \textbf{collection} styles.
%
% \begin{center} \small
% \begin{tabular}{ccc}
% \hline
% parameter & default settings & special settings \\
% \hline
% |titlecolor| & |black| & \\
% |\titlestyle| & |\LARGE\bfseries| & |\LARGE\MakeUppercase| \\
% |\subjectstyle| & |\large| & |\Large\bfseries|\\
% |\datestyle| & |\large| \\
% |\smalltitledatestyle| & |\large\slshape| & \\
% |\titleflush| & |center| & \\
% |\titletopskip| & -1.32\,cm & -0.67\,cm (\textbf{classic, soft}), 0.67\,cm \\
% |\smalltitletopskip| & -1.32\,cm & \\
% |\titlebottomskip| & |\medskipamount| \\
% |\titlesep| & |2\medskipamount| & |2\bigskipamount| \\
% |\seprulewidth| & 0.3\,pt &\\
% |\seprulelength| & 2.5\,cm &\\
% \hline
% \end{tabular}
% \end{center}
%
% \DescribeMacro{\subtitlestyle}\DescribeMacro{\titlecorrectstyle}
% The \textbf{exam} style has two additional setting macros:
% |\subtitlestyle|, set by default to |\large\slshape|,
% and |\titlecorrectstyle|, for the ``\textsf{Correct Version}'' composition
% via |\correct|, with the default being |\color{red}\large\scshape|.
%
% \DescribeMacro{\authorstyle}
% In the \textbf{collection} style, the
% \emph{school} and \emph{author} fields are incorporated into the title.
% Their attributes are governed by |\authorstyle|
% \footnote{In other styles, the \texttt{\bs authorstyle} macro
% (set to \texttt{\bs textnormal})
% is utilized within header or footer.} which is set to |\Large|.
%
% To create a separate title page
% (especially for the \textbf{exam} or \textbf{collection} styles),
% you can enclose |\maketitle| within the |titlepage| environment provided by \LaTeX.
%
% \medskip
% \DescribeMacro{\boxedshape}
% A specific formatting has been predefined to create a lightly
% shaded box around the title: |\boxedshape|\marg{text}
% (thanks to the \textsf{fancybox} package by Timothy Van Zandt).
% It can be used within the command |\titlestyle|
% if you want to achieve this kind of effect, for instance:
% \centeredline{|\renewcommand{\titlestyle}{\LARGE\sffamily\bfseries\boxedshape}|.}
%
% \subsection{Headers and footers} \label{par:head-settings}
%
% The typesetting of headers and footers is achieved using specialized macros
% \footnote{The \textsf{fancyhdr} package offers
% the commands \texttt{\bs lhead}, \texttt{\bs chead}, \texttt{\bs rhead}
% for the left, center and right portions of the header, and similarly for the footer:
% \texttt{\bs lfoot}, \texttt{\bs cfoot} and \texttt{\bs rfoot}.}
% from the \textsf{fancyhdr} package.
% Similar to the title, various macros enable customization of specific settings.
% They are outlined in the table below.
% Note that |\pagenamestyle| determines the format of the word ``\emph{page}''
% displayed preceding the page number.
%
% The |\headstyle| and |\footstyle| commands are common for all
% headers and footers components, respectively.
% These commands are combined with macros that provide
% distinct settings for each individual field.
% \begin{center}
% \begin{tabular}{cc}
% \hline
% parameter & default setting \\
% \hline
% |headingcolor| & |black| \\
% |\headstyle| & |\small\color{headingcolor}| \\
% |\footstyle| & |\small\color{headingcolor}| \\
% |\headtitlestyle| & |\scshape| \\
% |\headsubjectstyle| & |\scshape| \\
% |\schoolstyle| & |\scshape| \\
% |\headdatestyle| & |\textnormal| \\
% |\authorstyle| & |\textnormal| \\
% |\pagenamestyle| & |\textnormal| \\
% \hline
% \end{tabular}
% \end{center}
%
% The \textbf{exam} and \textbf{collection} styles have a specific setting for
% |\headtitlestyle|, which is defined by |\renewcommand{\headtitlestyle}{\MakeUppercase}|.
%
% \medskip
% Macros that enable the display (or removal) of the rule in the header
% \footnote{In fact, we have redefined the \texttt{\bs headrule} macro
% so that the rule never appears on the first page.}
% or the footer are provided
% by the \textsf{fancyhdr} package. For example, in any style,
% the header rule can be removed using:
% |\renewcommand{\headrulewidth}{0pt}|,
% and it can be displayed in the footer with:
% |\renewcommand\footrulewidth{0.4pt}|.
%
% \subsection{Internationalization}
% Three keywords are utilized by the package: \emph{page}, \emph{Correct version},
% and \emph{Name},
% defined by the macros |\pagename|, |\correctname| and |\identityname|.
% |\pagename| is used in the header or footer, |\correctname| by the |\correct|
% macro and |\identityname| by the \textbf{identity} style.
% These keywords are automatically translated into a few languages
% \footnote{Translation is currently built into the package
% for the following languages:
% French, German, Spanish, Italian, Portuguese.}
% based on the selected language using the \textsf{babel} or \textsf{polyglossia} package.
% They can be redefined using |\renewcommand|,
% or you can also utilize macros from Clemens Niederberger's \textsf{translations} package
% (allowing dynamic language changes), such as
% |\DeclareTranslation{romanian}{pagin\u{a}}| (in the preamble).
%
%
% \StopEventually{}
%
% \section{Implementation}
%
% \subsection{Required packages and geometry settings}
%
% \begin{macrocode}
\@ifpackageloaded{geometry}{}{\RequirePackage{geometry}}
\let\footruleskip\relax % because the memoir class uses it
\RequirePackage{fancyhdr}
\RequirePackage{ifthen}
\RequirePackage{lastpage}
\RequirePackage{fancybox}
\RequirePackage{xcolor}
\RequirePackage{translations}
\geometry{scale=0.75,vmarginratio=3:4,heightrounded}
% \end{macrocode}
% If the \textsf{geometry} package has been previously loaded,
% we do not load it again to prevent conflict with options.
%
% To modify the scale factor, utilize |\newgeometry| as the
% |\geometry| command will not function when the scale is already set.
%\medskip
% \subsection{Internationalization}
%
% \begin{macrocode}
\DeclareTranslationFallback{schooldocs-pagename}{page}
\DeclareTranslationFallback{schooldocs-correct}{Correct version}
\DeclareTranslationFallback{schooldocs-name}{Name:}
\DeclareTranslation{english}{schooldocs-pagename}{page}
\DeclareTranslation{english}{schooldocs-correct}{Correct version}
\DeclareTranslation{english}{schooldocs-name}{Name:}
\DeclareTranslation{french}{schooldocs-pagename}{page}
\DeclareTranslation{french}{schooldocs-correct}{Corrigé}
\DeclareTranslation{french}{schooldocs-name}{Nom :}
\DeclareTranslation{german}{schooldocs-pagename}{Seite}
\DeclareTranslation{german}{schooldocs-correct}{Musterlösung}
\DeclareTranslation{german}{schooldocs-name}{Name:}
\DeclareTranslation{spanish}{schooldocs-pagename}{página}
\DeclareTranslation{spanish}{schooldocs-correct}{Correccion}
\DeclareTranslation{spanish}{schooldocs-name}{Apellido:}
\DeclareTranslation{italian}{schooldocs-pagename}{pagina}
\DeclareTranslation{italian}{schooldocs-correct}{Corretto}
\DeclareTranslation{italian}{schooldocs-name}{Nome:}
\DeclareTranslation{portuges}{schooldocs-pagename}{página}
\DeclareTranslation{portuges}{schooldocs-correct}{Corrigiu}
\DeclareTranslation{portuges}{schooldocs-name}{Nome:}
\newcommand*\pagename{\GetTranslation{schooldocs-pagename}}
\newcommand*\correctname{\GetTranslation{schooldocs-correct}}
\newcommand*\identityname{\GetTranslation{schooldocs-name}}
% \end{macrocode}
%
% \subsection{Information fields}
%
% Once defined, information fields are initially set to empty
% to ensure that tests for empty fields work correctly.
%
% \begin{macrocode}
\renewcommand{\title}[2][]{\long\def\@title{#2}
\ifthenelse{\equal{#1}{}}{\def\@headtitle{#2}}{\def\@headtitle{#1}}
\@ifpackageloaded{hyperref}{\hypersetup{pdftitle={\@headtitle}}}{}
}
\title{}
\author{}
\newcommand\school[1]{\long\def\@school{#1}
\@ifpackageloaded{hyperref}{
\hypersetup{pdfauthor={\@author\ (\@school)}}}{}
}
\school{}
\newcommand{\institute}{\school}
\let\subject\relax
\newcommand{\subject}[2][]{\long\def\@subject{#2}
\ifthenelse{\equal{#1}{}}{\def\@headsubject{#2}}{\def\@headsubject{#1}}
\@ifpackageloaded{hyperref}{\hypersetup{pdfsubject={\@headsubject}}}{}
}
\def\@subject{}
\def\@headsubject{}
% \end{macrocode}
% Due to the usage of the |\subject| macro by the \textsf{KOMA-Script} package,
% we include a |\relax| command before defining this macro.
%
% The |\subject{}| command doesn't function properly with the |\@empty| test
% employed below in the |\maketitle| command. Consequently,
% we define |\@subject| and |\@headsubject| as empty by default.
%
% \subsection{Settings}
%
% First we present the title settings.
% \begin{macrocode}
\definecolor{titlecolor}{named}{black}
\newcommand{\titlestyle}{\LARGE\bfseries}
\newcommand{\subjectstyle}{\large}
\newcommand{\datestyle}{\large}
\newcommand{\smalltitledatestyle}{\large\slshape}
\newcommand{\titleflush}{center}
\newlength{\titletopskip} \setlength{\titletopskip}{-1.32cm}
\newlength{\smalltitletopskip} \setlength{\smalltitletopskip}{-1.32cm}
\newlength{\titlesep} \setlength{\titlesep}{2\medskipamount}
\newlength{\titlebottomskip} \setlength{\titlebottomskip}{\medskipamount}
\newlength{\seprulewidth} \setlength{\seprulewidth}{0.3pt}
\newlength{\seprulelength} \setlength{\seprulelength}{2.5cm}
\newcommand{\boxedshape}[1]{%
\color{gray} % no effect
\setlength{\fboxsep}{4.5pt}
\setlength{\shadowsize}{3pt}
\shadowbox{\quad\textcolor{titlecolor}{\rule{0pt}{2ex}#1}\quad}
}
% \end{macrocode}
% The default value for |\fboxsep| is 3\,pt and for |\shadowsize| it's 4\,pt.
% These settings have a local scope.
%
% \medskip
% Then, we move on to the settings for headers and footers.
% \begin{macrocode}
\definecolor{headingcolor}{named}{black}
\newcommand{\headstyle}{\small\color{headingcolor}}
\newcommand{\footstyle}{\small\color{headingcolor}}
\newcommand{\headtitlestyle}{\scshape}
\newcommand{\headsubjectstyle}{\scshape}
\newcommand{\schoolstyle}{\scshape}
\newcommand{\headdatestyle}{\textnormal}
\newcommand{\authorstyle}{\textnormal}
\newcommand{\pagenamestyle}{\textnormal}
\setlength{\headheight}{\baselineskip}
\renewcommand{\headrule}{\ifthenelse{\thepage=1}%
{\vspace{-2ex}\rule{\headwidth}{0pt}}%
{\vspace{-2ex}\rule{\headwidth}{\headrulewidth}}
}
% \end{macrocode}
% The redefinition of the |\headrule| macro allows for the removal
% of the rule on the first page.
%
% The header height is set to |\baselineskip| to prevent
% error messages (``\texttt{headheight too small}'') when the text size is
% equal to or greater than |\small|.
%
% \subsection{Title composition}
%
% \begin{macrocode}
\renewcommand{\maketitle}[1][\seprulelength]{
\mbox{}\par\vspace{\titletopskip}
\begin{\titleflush}
{\color{titlecolor}
{\titlestyle{\@title}}
\ifx\@subject\@empty\else
\par\vspace{\titlesep}\subjectstyle\@subject
\fi
\ifthenelse{\equal{\@date}{}}{}{%
\par\vspace{0.5\titlesep} \datestyle\@date}
\par\vspace{0.5\titlesep}
}
\ifthenelse{\lengthtest{#1 > 0cm}}{\rule{#1}{\seprulewidth}}{}
\end{\titleflush}
\vspace{\titlebottomskip}
}
\newcommand{\makesmalltitle}{
\mbox{}\par\vspace{\smalltitletopskip}
\begin{center}
{\color{titlecolor}
{\titlestyle{\@title}}
\hfill \subjectstyle\@subject
\ifthenelse{\equal{\@date}{}}{}{%
\enskip --\enskip \smalltitledatestyle\@date}
}
\rule{\linewidth}{\seprulewidth}
\end{center}
\vspace{\titlebottomskip}
}
\newcommand\correct{%
\let\@originalheadtitle\@headtitle
\def\@headtitle{\@originalheadtitle ~--~\correctname}
\@ifpackageloaded{hyperref}{%
\AtBeginDocument{\hypersetup{pdftitle={\@headtitle}}}}{}
\let\@originaltitle\@title
\def\@title{\@originaltitle ~--~\correctname}
}
\newcommand{\seprule}[1][\seprulelength]{\begin{center}
\raisebox{0.25\baselineskip}{\rule{#1}{\seprulewidth}}\end{center}}
% \end{macrocode}
% The use of |\AtBeginDocument| is necessary in the |\correct| macro because
% |\correctname| could be redefined by \textsf{babel} at |\begin{document}|.
%
% \bigskip
% \subsection{Basic styles}
%
% In the \textbf{classic} style, the header is displayed on two lines,
% thus requiring an increase in the |\headheight|.
%
% To include the header or footer into the total body,
% add |\geometry{includehead}| or |\geometry{includefoot}|
% in the preamble.
% \begin{macrocode}
\fancypagestyle{classic}{%
\renewcommand{\headrulewidth}{0pt}
\addtolength{\headheight}{\baselineskip}
\lhead{\headstyle\ifthenelse{\thepage=1}{\schoolstyle\@school\mbox{}\\
\headsubjectstyle\@subject}{\headtitlestyle\@headtitle} }
\rhead{\headstyle\ifthenelse{\thepage=1}{\authorstyle\@author\mbox{}\\
\headdatestyle\@date}{\headsubjectstyle\@headsubject}}
\cfoot{\footstyle \thepage /\pageref{LastPage}}
\setlength{\titletopskip}{-0.67cm}
\renewcommand{\maketitle}[1][\seprulelength]{%
\mbox{}\par\vspace{\titletopskip}
\begin{\titleflush}
{\color{titlecolor}\titlestyle{\@title}}
\par\vspace{0.5\titlesep}
\ifthenelse{\lengthtest{##1>0cm}}{\rule{##1}{\seprulewidth}}{}
\end{\titleflush}
\vspace{\titlebottomskip}
}
\renewcommand{\makesmalltitle}{
\mbox{}\par\vspace{\smalltitletopskip}
\begin{center}
{\color{titlecolor}
{\titlestyle{\@title}}
\hfill \subjectstyle\@subject
}
\rule{\linewidth}{\seprulewidth}
\end{center}
\vspace{\titlebottomskip}
}
}
\fancypagestyle{elegant}{%
\renewcommand{\headrulewidth}{0pt}
\lhead{\headstyle
\ifthenelse{\thepage=1}{}{\headtitlestyle\@headtitle}}
\rhead{\headstyle
\ifthenelse{\thepage=1}{}{%
\pagenamestyle\pagename~\thepage /\pageref{LastPage}}}
\lfoot{\ifthenelse{\thepage=1}{\footstyle\schoolstyle\@school}{}}
\cfoot{}
\rfoot{\ifthenelse{\thepage=1}{\footstyle\authorstyle\@author}{}}
}
\fancypagestyle{modern}{%
\lhead{\headstyle
\ifthenelse{\thepage=1}{}{\headtitlestyle\@headtitle}}
\rhead{\headstyle
\ifthenelse{\thepage=1}{}{\headsubjectstyle\@headsubject}}
\lfoot{\ifthenelse{\thepage=1}{\footstyle\schoolstyle\@school}{}}
\cfoot{\ifthenelse{\thepage=1}{}{
\footstyle\thepage /\pageref{LastPage}}}
\rfoot{\footstyle\ifthenelse{\thepage=1}{%
\authorstyle\@author
\ifx\@author\empty\else\\ \fi
\headdatestyle\@date\ignorespaces}{}
}
\renewcommand{\maketitle}[1][\seprulelength]{%
\mbox{}\par\vspace{\titletopskip}
\begin{\titleflush}
{\color{titlecolor}
{\titlestyle{\@title}}
\ifx\@subject\@empty\else
\par\vspace{\titlesep}\subjectstyle\@subject
\fi
\par\vspace{0.5\titlesep}
}
\ifthenelse{\lengthtest{##1>0cm}}{\rule{##1}{\seprulewidth}}{}
\end{\titleflush}
\vspace{\titlebottomskip}
}
\renewcommand{\makesmalltitle}{
\mbox{}\par\vspace{\smalltitletopskip}
\begin{center}
{\color{titlecolor}
{\titlestyle{\@title}}
\hfill \subjectstyle\@subject
}
\rule{\linewidth}{\seprulewidth}
\end{center}
\vspace{\titlebottomskip}
}
}
\fancypagestyle{soft}{%
\lhead{\headstyle
\ifthenelse{\thepage=1}{}{\headtitlestyle\@headtitle}}
\rhead{\headstyle
\ifthenelse{\thepage=1}{}{%
\pagenamestyle\pagename~\thepage /\pageref{LastPage}}}
\lfoot{\footstyle{\schoolstyle\@school}
\ifthenelse{\thepage=1}{\ifx\@author\empty\else\\ \fi
\authorstyle\@author}{}
}
\cfoot{}
\rfoot{\footstyle{\headsubjectstyle\@headsubject}
\ifthenelse{\thepage=1}{\ifx\@date\empty\else\\ \fi
\headdatestyle\@date\ignorespaces}{}
}
\setlength{\titletopskip}{-0.67cm}
\renewcommand{\maketitle}[1][\seprulelength]{%
\mbox{}\par\vspace{\titletopskip}
\begin{\titleflush}
{\color{titlecolor}\titlestyle{\@title}}
\par\vspace{0.5\titlesep}
\ifthenelse{\lengthtest{##1>0cm}}{\rule{##1}{\seprulewidth}}{}
\end{\titleflush}
\vspace{\titlebottomskip}
}
\renewcommand{\makesmalltitle}{
\mbox{}\par\vspace{\smalltitletopskip}
\begin{center}
{\color{titlecolor}
{\titlestyle{\@title}}
\hfill \mbox{}
}
\rule{\linewidth}{\seprulewidth}
\end{center}
\vspace{\titlebottomskip}
}
}
\fancypagestyle{identity}{%
\lhead{\headstyle\headtitlestyle \identityname}
\chead{}
\rhead{}
}
% \end{macrocode}
%
% \subsection{Extended styles}
%
% \begin{macrocode}
\fancypagestyle{exam}{%
\let\subtitle\relax % because KOMA-Script uses it
\newcommand\subtitle[1]{\long\def\@subtitle{##1}}
\subtitle{}
\renewcommand{\headtitlestyle}{\MakeUppercase}
\lhead{\headstyle
\ifthenelse{\thepage=1}{}{\headtitlestyle{\@headtitle}}}
\rhead{\headstyle
\ifthenelse{\thepage=1}{}{\headsubjectstyle\@headsubject}}
\lfoot{\footstyle
\authorstyle\@author
\ifx\@author\empty\else\\ \fi
\schoolstyle\@school
}
\cfoot{}
\rfoot{\footstyle \pagenamestyle\pagename~\thepage/\pageref{LastPage}}
\setlength{\titletopskip}{0.67cm}
\setlength{\titlesep}{2\bigskipamount}
\renewcommand{\titlestyle}{\LARGE\MakeUppercase}
\renewcommand{\subjectstyle}{\Large\bfseries}
\newcommand{\subtitlestyle}{\large\slshape}
\newcommand*{\titlecorrectstyle}{\color{red}\large\scshape}
\renewcommand\correct{%
\let\@originalheadtitle\@headtitle
\def\@headtitle{\@originalheadtitle ~--~\correctname}
\@ifpackageloaded{hyperref}{%
\AtBeginDocument{\hypersetup{pdftitle={\@headtitle}}}}{}
\renewcommand{\subtitlestyle}{\titlecorrectstyle}
\subtitle{\correctname}
}
\renewcommand{\maketitle}[1][\seprulelength]{%
\mbox{}\par\vspace{\titletopskip}
\begin{center}
{\color{titlecolor}
{\titlestyle{\@title}}
\par\vspace{\titlesep}{\subjectstyle \@subject}
\par\vspace{\titlesep}
\ifthenelse{\equal{\@date}{}}{}{%
\datestyle\@date\par\vspace{0.5\titlesep}}
\ifthenelse{\equal{\@subtitle}{}}{}{%
\subtitlestyle\@subtitle\par\vspace{0.5\titlesep}
}
}
\ifthenelse{\lengthtest{##1>0cm}}{\rule{##1}{\seprulewidth}}{}
\end{center}
\vspace{\titlebottomskip}
}
}
\fancypagestyle{collection}{%
\renewcommand{\headtitlestyle}{\MakeUppercase}
\lhead{\headstyle\headtitlestyle\@headtitle}
\AtBeginDocument{\renewcommand{\sectionmark}[1]{\markboth{##1}{}}}
\rhead{\headstyle\headsubjectstyle\leftmark} %\@section
\lfoot{\footstyle\schoolstyle \@school}
\cfoot{}
\rfoot{\footstyle\thepage}
\setlength{\titletopskip}{0.67cm}
\setlength{\titlesep}{2\bigskipamount}
\renewcommand{\titlestyle}{\LARGE\MakeUppercase}
\renewcommand{\subjectstyle}{\Large\bfseries}
\renewcommand{\authorstyle}{\Large}
\renewcommand{\datestyle}{\Large}
\renewcommand{\maketitle}[1][\seprulelength]{%
\thispagestyle{empty}
\mbox{}\par\vspace{\titletopskip}
\begin{center}
{\color{titlecolor}
{\titlestyle{\@title}}
\par\vspace{\titlesep} {\subjectstyle{\@subject}}
\par\vspace{\titlesep}
\ifx\@author\empty
\else \authorstyle
\begin{tabular}[t]{c}\@author\end{tabular}
\ifx\@school\empty\else\par\vspace{1ex} \@school\fi
\par\vspace{0.5\titlesep}
\fi
\ifthenelse{\equal{\@date}{}}{}{%
\datestyle\@date \par\vspace{0.5\titlesep}}
}
\ifthenelse{\lengthtest{##1>0cm}}{\rule{##1}{\seprulewidth}}{}
\end{center}
\vspace{\titlebottomskip}
}
}
% \end{macrocode}
%
% In the \textbf{collection} style,
% we redefine |\sectionmark| using |\AtBeginDocument| to prevent |\MakeUppercase|
% from removing the section number
% (alternatively, you can use |\nouppercase| here).
%
% The |\ifthenelse| command doesn't function properly when |\and| is used within |\author|.
%
% Note the |\pagestyle{empty}| command in |\maketitle|, which ensures that there is
% no header on the first page.
%
% \Finale
\endinput
|