summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/schooldocs/schooldocs.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/schooldocs/schooldocs.dtx')
-rw-r--r--macros/latex/contrib/schooldocs/schooldocs.dtx121
1 files changed, 61 insertions, 60 deletions
diff --git a/macros/latex/contrib/schooldocs/schooldocs.dtx b/macros/latex/contrib/schooldocs/schooldocs.dtx
index 284d239bcd..6d66e09605 100644
--- a/macros/latex/contrib/schooldocs/schooldocs.dtx
+++ b/macros/latex/contrib/schooldocs/schooldocs.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 2020 by Antoine Missier <antoine.missier@ac-toulouse.fr>
+% Copyright (C) 2020-2021 by Antoine Missier <antoine.missier@ac-toulouse.fr>
% ----------------------------------------------------------------------
%
% This file may be distributed and/or modified under the
@@ -22,7 +22,7 @@
%<package>\NeedsTeXFormat{LaTeX2e}[2005/12/01]
%<package>\ProvidesPackage{schooldocs}
%<*package>
- [2020/07/13 v1.0 .dtx schooldocs file]
+ [2021/09/18 v1.1 .dtx schooldocs file]
%</package>
%
%<*driver>
@@ -58,7 +58,7 @@
% corresponds to \textsf{schooldocs}~\fileversion, dated \filedate.}}
\subject{Antoine Missier \\ %
\texttt{antoine.missier@ac-toulouse.fr}}
-\date{July 13, 2020, \fileversion}
+\date{\filedate, \fileversion}
\hypersetup{%
colorlinks,
@@ -76,7 +76,7 @@
%</driver>
% \fi
%
-% \CheckSum{792}
+% \CheckSum{766}
%
% \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
@@ -96,9 +96,10 @@
%
%
% \changes{v0.0}{2010/09/01}{Initial personal version}
-% \changes{v0.1}{2020/01/05}{Initial documentation in french}
+% \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.0}{2020/07/13}{Initial public version with documentation in English}
+% \changes{v1.1}{2021/09/18}{Using the translations package for internationalization}
%
% \GetFileInfo{schooldocs.dtx}
%
@@ -107,7 +108,7 @@
% \section{Introduction}
%
% The purpose of this package is to provide several layout styles for school documents.
-% It can be used for exercices sheets, exams, course materials.
+% It can be used for exercises sheets, exams, course materials.
% The package sets the page geometry (dimensions of text and margins)
% and the title typesetting;
% the various \emph{styles} define the header, footer and title formatting,
@@ -140,7 +141,7 @@
% |\thispagestyle|\marg{style} at the page you want.
% For example, you can place the command |\thispagestyle{identity}|
% in an appendix page to render.
-% \subsection{Informations fields}
+% \subsection{Information fields}
%
% \DescribeMacro{\title}
% Usually a \LaTeX\ document title is made up of information
@@ -179,7 +180,7 @@
% So, if you do not want any date, just write |\date{}|.
% When title elements like subject, date are missing, the title height will be reduced accordingly.
%
-% Except |\date|, all these information macros accept multiline arguments,
+% Except |\date|, all these information macros accept multi-line arguments,
% for example |\school{Royal College of Pataphysics\\London}|.
% To typeset the main title on two (or more) lines, use |\\[1ex]|
% for a good vertical spacing.
@@ -213,7 +214,7 @@
% provided by the macro |\subtitle|\marg{text}. The parameter \meta{text}
% will be placed under the other title elements and before the separation rule,
% if there is one. For instance |\subtitle{Duration of the test: 2\,h}|.
-% For a multi-line argument, the linebreak instruction must be
+% For a multi-line argument, the line break instruction must be
% |\par| and not |\\|.
%
% \subsection{Making the title}
@@ -255,7 +256,7 @@
% which adds \textsf{-- Correct Version} to the title.
% It should be placed in the preamble.
% Combined with packages that deal with multiple versions of a document,
-% this macro avoids to define different titles for a an exercice sheet an its correct version.
+% this macro avoids to define different titles for a an exercise sheet an its correct version.
% However in the \textbf{exam} style, the text \textsf{Correct version}
% will not be added in the title (except in headers), but will be substituted for
% the subtitle.
@@ -419,9 +420,9 @@
% \textsf{geometry} (by Hideo Umeki and David Carlisle).
% According to good typographic practice (see the \LaTeX\ Companion,
% the \textsf{typearea} package or \textsf{KOMA-Script} bundle documentation)
-% the ratio between the text body (the type area as named by typographs)
+% the ratio between the text body (the type area as named by typographers)
% and the page size must be the same horizontally and vertically.
-% This ratio gauges the ``shades of grey'' of a page.
+% This ratio gauges the ``shades of gray'' of a page.
% The default scale in the \textsf{geometry} package is 0.7.
% For school documents, it seems that this setting leaves too much white space in the margins, thus this ratio has been set to 0.75.
% Of course, it can be freely redefined with the |\geometry| command.
@@ -443,7 +444,7 @@
% and lengths with |\setlength|.
% Most of command names are explicit enough to give some information about their use.
%
-% Let us specifiy nevertheless that |\titleflush| manages the alignment:
+% Let us specify nevertheless that |\titleflush| manages the alignment:
% centered by default, it can be left-aligned with
% |\renewcommand{\titleflush}{flushleft}| or right-aligned with
% |\renewcommand{\titleflush}{flushright}|\footnote{This macro has no effect
@@ -481,7 +482,7 @@
% \end{center}
%
% \DescribeMacro{\subtitlestyle}\DescribeMacro{\titlecorrectstyle}
-% The \textbf{exam} style has two additionnal setting macros:
+% The \textbf{exam} style has two additional setting macros:
% |\subtitlestyle|, set by default to |\large\slshape|,
% and |\titlecorrectstyle|, for the composition of \textsf{Correct Version}
% produced by |\correct|, set by default to |\color{red}\large\scshape|.
@@ -497,7 +498,7 @@
%
% \medskip
% \DescribeMacro{\boxedshape}
-% A particular formatting has been predefined to produce a slighlty shaded box around the title: |\boxedshape|\marg{text}
+% A particular formatting has been predefined to produce a slightly shaded box around the title: |\boxedshape|\marg{text}
% (thanks to the \textsf{fancybox} package by Timothy Van Zandt).
% It is not activated by default but it can be used within the
% command |\titlestyle| if we want to get this kind of effect, e.g.
@@ -553,19 +554,20 @@
% |\renewcommand\footrulewidth{0.4pt}|
%
% \subsection{Internationalization}
-% Four keywords are used by the package: page, Correct version, Name and Forename,
+% Four keywords are used by the package: \emph{page}, \emph{Correct version},
+% \emph{Name} and \emph{Forename},
% defined by the macros |\pagename|, |\correctname|, |\identityname| and |\identityforename|.
% |\pagename| is used in header or footer, |\correctname| by the macro |\correct|
% and both others by the \textbf{identity} style.
% These keywords get automatic translation in a few languages\footnote{Translation
% is currently integrated into the package for the following languages:
-% French, German, Spanish, Italian, Portuguese.}
-% when the \textsf{babel} package is loaded.
+% French, German, Spanish, Italian, Portuges.}
+% according to the selected language by \textsf{babel} package or \textsf{polyglossia}.
% They can be redefined, with |\renewcommand|,
% which should be placed \emph{after} |\begin{document}|,
-% or else we can use macros from the \textsf{babel} package
+% or else we can use macros from the \textsf{translations} package by Clemens Niederberger
% (allowing dynamic language change), e.g.\\
-% |\addto\captionsromanian{\def\pagename{pagin\u{a}}}| (in the preamble).
+% |\DeclareTranslation{romanian}{pagin\u{a}}| (in the preamble).
%
%
% \StopEventually{}
@@ -585,6 +587,7 @@
\RequirePackage{lastpage}
\RequirePackage{fancybox}
\RequirePackage{xcolor}
+\RequirePackage{translations}
\geometry{scale=0.75,vmarginratio=3:4,heightrounded}
@@ -597,47 +600,45 @@
% \subsection{Internationalization}
%
% \begin{macrocode}
-\providecommand{\pagename}{page}
-\def\correctname{Correct version}
-\def\identityname{Name:}
-\def\identityforename{Forename:}
+\DeclareTranslationFallback{schooldocs-pagename}{page}
+\DeclareTranslationFallback{schooldocs-correct}{Correct version}
+\DeclareTranslationFallback{schooldocs-name}{Name:}
+\DeclareTranslationFallback{schooldocs-forename}{Forename:}
-\newcommand\schooldocstranslate{%
- \@ifpackageloaded{babel}{%
- \addto\captionsfrench{%
- \def\correctname{Corrig\'e}
- \def\identityname{Nom :}
- \def\identityforename{Pr\'enom :}
- }
- \addto\captionsgerman{%
- \def\pagename{Seite}
- \def\correctname{Musterl\"osung}
- \def\identityname{Name :}
- \def\identityforename{Vorname :}
- }
- \addto\captionsspanish{%
- \def\pagename{p\'agina}
- \def\correctname{Correccion}
- \def\identityname{Apellido:}
- \def\identityforename{Nombre:}
- }
- \addto\captionsitalian{%
- \def\pagename{Seite}
- \def\correctname{Corretto}
- \def\identityname{Nome :}
- \def\identityforename{Conome :}
- }
- \addto\captionsportuges{%
- \def\pagename{p\'agina}
- \def\correctname{Corrigiu}
- \def\identityname{Nome :}
- \def\identityforename{Primeiro nome :}
- }
- }{}
- }
+\DeclareTranslation{english}{schooldocs-pagename}{page}
+\DeclareTranslation{english}{schooldocs-correct}{Correct version}
+\DeclareTranslation{english}{schooldocs-name}{Name:}
+\DeclareTranslation{english}{schooldocs-forename}{Forename:}
+
+\DeclareTranslation{french}{schooldocs-pagename}{page}
+\DeclareTranslation{french}{schooldocs-correct}{Corrigé}
+\DeclareTranslation{french}{schooldocs-name}{Nom :}
+\DeclareTranslation{french}{schooldocs-forename}{Prénom :}
+
+\DeclareTranslation{german}{schooldocs-pagename}{Seite}
+\DeclareTranslation{german}{schooldocs-correct}{Musterlösung}
+\DeclareTranslation{german}{schooldocs-name}{Name:}
+\DeclareTranslation{german}{schooldocs-forename}{Vorname:}
+
+\DeclareTranslation{spanish}{schooldocs-pagename}{página}
+\DeclareTranslation{spanish}{schooldocs-correct}{Correccion}
+\DeclareTranslation{spanish}{schooldocs-name}{Apellido:}
+\DeclareTranslation{spanish}{schooldocs-forename}{Nombre:}
+
+\DeclareTranslation{italian}{schooldocs-pagename}{pagina}
+\DeclareTranslation{italian}{schooldocs-correct}{Corretto}
+\DeclareTranslation{italian}{schooldocs-name}{Nome:}
+\DeclareTranslation{italian}{schooldocs-forename}{Conome:}
+
+\DeclareTranslation{portuges}{schooldocs-pagename}{página}
+\DeclareTranslation{portuges}{schooldocs-correct}{Corrigiu}
+\DeclareTranslation{portuges}{schooldocs-name}{Nome:}
+\DeclareTranslation{portuges}{schooldocs-forename}{Primeiro nome:}
-\AtBeginDocument{\schooldocstranslate} % if loaded before babel
-\schooldocstranslate % necessary when loaded after babel
+\newcommand*\pagename{\GetTranslation{schooldocs-pagename}}
+\newcommand*\correctname{\GetTranslation{schooldocs-correct}}
+\newcommand*\identityname{\GetTranslation{schooldocs-name}}
+\newcommand*\identityforename{\GetTranslation{schooldocs-forename}}
% \end{macrocode}
%