summaryrefslogtreecommitdiff
path: root/macros/latex
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex')
-rw-r--r--macros/latex/contrib/acrotex/README.md15
-rw-r--r--macros/latex/contrib/acrotex/doc/aeb_man.pdfbin1688452 -> 2357846 bytes
-rw-r--r--macros/latex/contrib/acrotex/doc/aeb_man.tex69
-rw-r--r--macros/latex/contrib/acrotex/doc/eformman.pdfbin1000084 -> 1000113 bytes
-rw-r--r--macros/latex/contrib/acrotex/doc/eformman.tex2
-rw-r--r--macros/latex/contrib/acrotex/examples/jquiztst.pdfbin357365 -> 358366 bytes
-rw-r--r--macros/latex/contrib/acrotex/examples/jtxttst.pdfbin319655 -> 320578 bytes
-rw-r--r--macros/latex/contrib/acrotex/examples/webeqtst.pdfbin495914 -> 538600 bytes
-rw-r--r--macros/latex/contrib/acrotex/examples/webeqtst.tex4
-rw-r--r--macros/latex/contrib/acrotex/exerquiz.dtx352
-rw-r--r--macros/latex/contrib/acrotex/insdljs.dtx23
-rw-r--r--macros/latex/contrib/denisbdoc/README.md2
-rw-r--r--macros/latex/contrib/denisbdoc/denisbdoc.dtx62
-rw-r--r--macros/latex/contrib/easybook/easybook.dtx10
-rw-r--r--macros/latex/contrib/easybook/easybook.ins4
-rw-r--r--macros/latex/contrib/easybook/easybook.pdfbin578151 -> 576732 bytes
-rw-r--r--macros/latex/contrib/easybook/easybook.tex56
-rw-r--r--macros/latex/contrib/nwejm/README.md2
-rw-r--r--macros/latex/contrib/nwejm/doc/examples/article-in-dutch.pdfbin188077 -> 199009 bytes
-rw-r--r--macros/latex/contrib/nwejm/doc/examples/article-in-english.pdfbin183735 -> 194657 bytes
-rw-r--r--macros/latex/contrib/nwejm/doc/examples/article-in-french.pdfbin238982 -> 251463 bytes
-rw-r--r--macros/latex/contrib/nwejm/doc/examples/article-in-german.pdfbin189448 -> 202043 bytes
-rw-r--r--macros/latex/contrib/nwejm/doc/examples/issue.pdfbin382101 -> 396986 bytes
-rw-r--r--macros/latex/contrib/nwejm/doc/examples/sample.pdfbin182347 -> 193276 bytes
-rw-r--r--macros/latex/contrib/nwejm/doc/nwejm-fr.pdfbin579238 -> 335969 bytes
-rw-r--r--macros/latex/contrib/nwejm/source/nwejm.dtx172
-rw-r--r--macros/latex/contrib/tugboat/ltubguid.ltx46
-rw-r--r--macros/latex/contrib/tugboat/ltubguid.pdfbin361610 -> 362482 bytes
-rw-r--r--macros/latex/contrib/tugboat/tugboat.bst67
-rw-r--r--macros/latex/contrib/tugboat/tugboat.dtx71
-rw-r--r--macros/latex/contrib/tugboat/tugboat.pdfbin493778 -> 493932 bytes
-rw-r--r--macros/latex/contrib/yathesis/CHANGELOG.md22
-rw-r--r--macros/latex/contrib/yathesis/README.md2
-rw-r--r--macros/latex/contrib/yathesis/doc/yathesis-fr.pdfbin6469140 -> 6445131 bytes
-rw-r--r--macros/latex/contrib/yathesis/exemples/specimen/latexmkrc2
-rw-r--r--macros/latex/contrib/yathesis/exemples/specimen/these.pdfbin1261113 -> 1261440 bytes
-rw-r--r--macros/latex/contrib/yathesis/exemples/specimen/these.tex4
-rw-r--r--macros/latex/contrib/yathesis/source/yathesis-samples-templates.dtx4
-rw-r--r--macros/latex/contrib/yathesis/source/yathesis.dtx329
-rw-r--r--macros/latex/required/babel/base/README.md16
-rw-r--r--macros/latex/required/babel/base/babel.dtx2790
-rw-r--r--macros/latex/required/babel/base/babel.ins2
-rw-r--r--macros/latex/required/babel/base/babel.pdfbin849481 -> 847060 bytes
-rw-r--r--macros/latex/required/babel/base/bbcompat.dtx2
44 files changed, 2372 insertions, 1758 deletions
diff --git a/macros/latex/contrib/acrotex/README.md b/macros/latex/contrib/acrotex/README.md
index 08fe58aad6..edfe9a3ce4 100644
--- a/macros/latex/contrib/acrotex/README.md
+++ b/macros/latex/contrib/acrotex/README.md
@@ -1,6 +1,6 @@
The AcroTeX eDucation Bundle (AeB)
Author: D. P. Story
-Dated: 2021-06-19
+Dated: 2021-10-03
AeB contains the following:
@@ -19,6 +19,19 @@ AeB contains the following:
6) Documentation for AeB (AcroTeX eDucatation Bundle) and eforms
(including insdljs and dljslib).
+What's New (2021-10-03)
+ exerquiz: In recent versions of AA/AR DC, the rollover display
+ for choice fields (radio fields and checkboxes) has changed. Previously
+ when the mouse rolls over a choice field, the tool tip is displayed. For
+ quizzes, the choice fields have no tool tip, so nothing was displayed.
+ Now, AA/AR DC displays `<tool-tip>: export-value>', which reveals
+ information not intended for the student taking that quiz. The exerquiz
+ package is modified to reflect this change. The rollover of radio buttons
+ and check boxes now displays as `Choice: a', `Choice: b', etc. The word
+ `Choice' is the tool tip and lower case letter is the export value. The
+ tool tip for all choice fields of a quizzes can be changed with
+ \TUChoice{<text>}, the default is \TUChoice{Choice}.
+
What's New (2021-06-19) Move files out of this distribution to the
acrotex-js package, dated 2021/06/19 or later. The folder JavaScript
file aeb.js (and aeb_pro.js) are now distributed with acrotex-js. Installation
diff --git a/macros/latex/contrib/acrotex/doc/aeb_man.pdf b/macros/latex/contrib/acrotex/doc/aeb_man.pdf
index 86e9159d5e..d27012cf3c 100644
--- a/macros/latex/contrib/acrotex/doc/aeb_man.pdf
+++ b/macros/latex/contrib/acrotex/doc/aeb_man.pdf
Binary files differ
diff --git a/macros/latex/contrib/acrotex/doc/aeb_man.tex b/macros/latex/contrib/acrotex/doc/aeb_man.tex
index 29337b17a0..93c348abb9 100644
--- a/macros/latex/contrib/acrotex/doc/aeb_man.tex
+++ b/macros/latex/contrib/acrotex/doc/aeb_man.tex
@@ -17,7 +17,7 @@
%%\usepackage{times}
%\usepackage{timesNRMT}
-% \previewOn\pmpvOn
+%\previewOn\pmpvOn
\usepackage{aeb_mlink}
\usepackage{longtable,colortbl}
@@ -243,10 +243,10 @@
\university{{\AcroT} Software Development Team}
\email{dpstory@acrotex.net}
\versionLabel{Dated:}
-\version{2021/06/19}
+\version{2021/10/03}
\copyrightyears{1999-\the\year}
\nocopyright
-\prepared{2021/06/19}
+\prepared{2021/10/03}
\revisionLabel{Distribution Dated:}
\copyrightStatus{True}
@@ -4153,7 +4153,7 @@ this topic.
\subsection{The \texttt{userbmintrvl} Option}\label{eq:userbmintrvl}
-The \opt{userbmintrvl} option defines \cs{rbmIntrvl} command, the syntax of which is,
+The \opt{userbmintrvl} option defines the \cs{rbmIntrvl} command, the syntax of which is,
\bVerb\takeMeasure{\cs{rbmIntrvl\darg{[a,b]}\ameta{\textsf{arguments of \cs{RespBoxMath}}}}}%
\begin{dCmd}[commandchars=!()]{\bxSize}
\rbmIntrvl{[a,b]}!ameta(!textsf(arguments of !cs(RespBoxMath)))
@@ -5284,7 +5284,7 @@ Which of the following are prime numbers?
\Ans0 1 &
\Ans1 2 &
\Ans1 3 &
- \Ans0 4 \\
+ \Ans0 4 \\[3bp]
\Ans1 5 &
\Ans0 6 &
\Ans1 7 &
@@ -5305,6 +5305,40 @@ You'll note that the \env{shortquiz} environment is used, yet form fields
(check boxes) are used; this is by design. Links are not available for MS
questions, only for MC questions.
+\subsubsection{The rollover display of choice fields}\label{ss:ChoiceTT}
+
+In recent versions of \textsf{AA/AR DC}, the rollover display for choice
+fields (radio fields and checkboxes) has changed. Previously when the mouse
+rolls over a choice field, the tool tip is displayed. For quizzes, the choice
+fields have no tool tip, so nothing was displayed. Now, \textsf{AA/AR DC}
+displays \texttt{\ameta{tool-tip}:\,\ameta{export-value}}, which reveals
+information not intended for the student taking that quiz. The \pkg{exerquiz}
+package is modified to reflect this change. The rollover of radio buttons and
+check boxes now displays as \texttt{Choice:\,a}, \texttt{Choice:\,b}, \dots. The word
+`Choice' is the tool tip and lower case letter is the export value. The tool tip for
+all choice fields of a quizzes can be changed with \cs{TUChoice}:
+\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()]
+\TUChoice{!ameta(text)}
+\end{Verbatim}
+The default is \verb~\TUChoice{Choice}~.
+
+The tool tip may be localized to other languages as follows:
+\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()]
+\TUChoice{Ellecci\'{o}n}
+\end{Verbatim}
+to obtain the Spanish word Ellecci\'{o}n for choice. More obscure localization
+can be done using unicode, for example,
+\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()]
+\defUniStr{Choice}{Ellecci\u00F3n}
+\TUChoice{\unicodeStr(Choice)}
+\end{Verbatim}
+However, for this form to be valid, the preamble must use the package \pkg{forms16be}:
+\begin{Verbatim}
+\usepackage{exerquiz}
+\usepackage{forms16be}
+\end{Verbatim}
+
+
\subsubsection{Other supported question types}
In addition to MC and MS questions, any other supported types can be used
@@ -5356,9 +5390,9 @@ Was it in Xanadu did Kubla Kahn a stately pleasure dome decree?
short-quiz to change response feedback; \cs{sqTurnOffAlerts} turns off the
(annoying) alerts.
-\redpoint The \cs{sqTurnOffAlerts} command only apply to a short-quiz that
-uses radio buttons. You can reverse the effect of this command by expanding
-\cs{sqTurnOnAlerts}. The default is \cs{sqTurnOnAlerts}.
+\redpoint The \cs{sqTurnOffAlerts} command only apply to a short-quiz.
+Reverse the effect of this command by expanding \cs{sqTurnOnAlerts}. The
+default is \cs{sqTurnOnAlerts}.
\subsubsection{\texttt{shortquiz} with solutions}\label{ss:QuizS}
@@ -6037,7 +6071,7 @@ levels are set through the optional argument of \cs{sqTallyTotal}.
\begin{aebQuote}
\begin{description}
-\item[Weak passing level] Syntax: \cs{sqTallyTotal[\cs{weakpassing\darg{\ameta{n}}}]}\\[3pt]
+\item[Weak passing level] Syntax: \cs{sqTallyTotal[\cs{weakpass\darg{\ameta{n}}}]}\\[3pt]
\textbf{User Experience.} As soon as the student makes more than
\ameta{n} errors, the following message appears in an alert dialog box:
\begin{Verbatim}
@@ -6048,7 +6082,7 @@ with fewer errors and greater understanding.}
The student is allowed to continue the quiz, but with the knowledge the
performance is below the expected standard, as set by the instructor.
-\item[Strong passing level] Syntax: \cs{sqTallyTotal[\cs{strongpassing\darg{\ameta{n}}}]}\\[3pt]
+\item[Strong passing level] Syntax: \cs{sqTallyTotal[\cs{strongpass\darg{\ameta{n}}}]}\\[3pt]
\textbf{User Experience.} As soon as the student makes more than \ameta{n}
errors, the following message appears in an alert dialog box:
\begin{Verbatim}
@@ -6580,6 +6614,12 @@ argument to pass partial points rewarded for a wrong answer.
\texttt{manswers} environment, \Nameref{manswersQuiz}, for posting questions with multiple
correct answers.
+\subsubsection{The rollover display choice fields}
+
+Refer to the comments in the subsection titled \Nameref{ss:ChoiceTT}.
+
+
+
\subsection{Basic Usage}
In this section we discuss the two \texttt{quiz} styles:
@@ -6799,8 +6839,8 @@ Prior to your quiz, use the following code, if desired.
\useBeginQuizButton
\useEndQuizButton
\end{Verbatim}
-Clicking the \uif{Begin Quiz} button clears all fields in the quiz and initializes it for the user
-to respond to each question. Shift-clicking the \uif{Begin Quiz} button clears all fields, but does not
+Clicking the \FmtMP{Click \uif{Begin Quiz} action}\uif{Begin Quiz} button clears all fields in the quiz and initializes it for the user
+to respond to each question. Shift-clicking the \FmtMP{Shift-click \uif{Begin Quiz} action}\uif{Begin Quiz} button clears all fields, but does not
initialize the quiz.
\useBeginQuizButton\useEndQuizButton
@@ -7241,6 +7281,9 @@ parameter is a unique name for the solution to the quiz. Notice as well that
the \texttt{solution} environment follows, and is not nested
within the \texttt{answers} environment.
+\subsubsection{The rollover display choice fields}
+
+Refer to the comments in the subsection titled \Nameref{ss:ChoiceTT}.
\subsection{How to Modify the \texttt{quiz} Environment}
@@ -12020,7 +12063,7 @@ features of the \pkg{web} and \textsf{exerquiz} packages.
\item Documented the use of form check boxes with the \texttt{shortquiz}
environment and introduced the commands
\begin{Verbatim}[xleftmargin=\amtIndent]
- \sqTurnOffAlerts,\sqTurnOnAlerts,\sqNoCorrections,\sqNoCorrections
+ \sqTurnOffAlerts,\sqTurnOnAlerts,\sqCorrections,\sqNoCorrections
\end{Verbatim}
to control response feedback.
\item Added language \texttt{finnish} Options. Translation due
diff --git a/macros/latex/contrib/acrotex/doc/eformman.pdf b/macros/latex/contrib/acrotex/doc/eformman.pdf
index e34de8e677..35ab252e80 100644
--- a/macros/latex/contrib/acrotex/doc/eformman.pdf
+++ b/macros/latex/contrib/acrotex/doc/eformman.pdf
Binary files differ
diff --git a/macros/latex/contrib/acrotex/doc/eformman.tex b/macros/latex/contrib/acrotex/doc/eformman.tex
index 7ad44ef209..d9b2eb2de2 100644
--- a/macros/latex/contrib/acrotex/doc/eformman.tex
+++ b/macros/latex/contrib/acrotex/doc/eformman.tex
@@ -82,7 +82,7 @@
subject={Documentation for the eforms and insdljs packages},
talksite={\url{www.acrotex.net}},
version={2.0},
- prepared={2021/05/29},
+ prepared={2021/10/03},
preparedLabel={Distribution Dated:},
keywords={LaTeX, hyperref, PDF, exercises, quizzes},
copyrightStatus=True,
diff --git a/macros/latex/contrib/acrotex/examples/jquiztst.pdf b/macros/latex/contrib/acrotex/examples/jquiztst.pdf
index 3e8294ea9f..39f0d58d02 100644
--- a/macros/latex/contrib/acrotex/examples/jquiztst.pdf
+++ b/macros/latex/contrib/acrotex/examples/jquiztst.pdf
Binary files differ
diff --git a/macros/latex/contrib/acrotex/examples/jtxttst.pdf b/macros/latex/contrib/acrotex/examples/jtxttst.pdf
index 626f437c86..9af5055e92 100644
--- a/macros/latex/contrib/acrotex/examples/jtxttst.pdf
+++ b/macros/latex/contrib/acrotex/examples/jtxttst.pdf
Binary files differ
diff --git a/macros/latex/contrib/acrotex/examples/webeqtst.pdf b/macros/latex/contrib/acrotex/examples/webeqtst.pdf
index 5c70119e6c..bfa5794fd5 100644
--- a/macros/latex/contrib/acrotex/examples/webeqtst.pdf
+++ b/macros/latex/contrib/acrotex/examples/webeqtst.pdf
Binary files differ
diff --git a/macros/latex/contrib/acrotex/examples/webeqtst.tex b/macros/latex/contrib/acrotex/examples/webeqtst.tex
index 8080e497e7..0e349ab0ef 100644
--- a/macros/latex/contrib/acrotex/examples/webeqtst.tex
+++ b/macros/latex/contrib/acrotex/examples/webeqtst.tex
@@ -1,6 +1,6 @@
\documentclass{article}
\usepackage{amsmath}
-\usepackage[tight,designvi]{web}
+\usepackage[tight,designvi,navibar]{web}
\usepackage{exerquiz}
% \previewOn \pmpvOn
@@ -387,7 +387,7 @@ This is the link-style format:
is 100\%.
\begin{questions}
\item Who created \TeX?
-\begin{answers}4
+\begin{answers}{4}
\Ans1 Knuth &\Ans0 Lamport &\Ans0 Carlisle &\Ans0 Rahtz
\end{answers}
\item Who originally wrote \LaTeX?
diff --git a/macros/latex/contrib/acrotex/exerquiz.dtx b/macros/latex/contrib/acrotex/exerquiz.dtx
index 51a44283e2..d850fe27e9 100644
--- a/macros/latex/contrib/acrotex/exerquiz.dtx
+++ b/macros/latex/contrib/acrotex/exerquiz.dtx
@@ -22,7 +22,7 @@
%<randomize>\ProvidesFile{aebrandom.def}
%<sumrytbls>\ProvidesFile{aebsumrytbls.def}
%<template>\ProvidesFile{template.def}
-%<package|driver|aebjs|eqexam|randomize|sumrytbls|template> [2021/05/29 v8.8.2 %
+%<package|driver|aebjs|eqexam|randomize|sumrytbls|template> [2021/10/03 v8.8.5 %
%<package> Exerquiz: Exercises and Quizzes for LaTeX/PDF package (dps)]
%<driver> Exerquiz documentation driver file (dps)]
%<aebjs> Exerquiz document level JavaScript (dps)]
@@ -101,6 +101,9 @@
% {\PackageInfo{exerquiz}{aebdonotindex.def cannot be found}}
% \begin{macrocode}
% \end{macrocode}
+%\changes{v8.8.5}{2021/10/03}{This version attempts to fix a problem induced to acrotex by displaying
+%the export values of choice field. The export values secretly contain a zero (0) or one (1) to signal
+%that the current choice is wrong or right.}
%\changes{v8.6.3}{2021/01/31}{Updated documentation, informing users of \string\app{Acrobat DC} that
% it is necessary to change their \string\uif{Security (Enhanced)} preferences.}
%\changes{v8.2.8}{2018/12/13}{The SOL file is now written entirely when there is no solution option specified}
@@ -3888,6 +3891,13 @@
% wherein we pass the key-value pairs defined above.
% \begin{macrocode}
\newenvironment{questions}[1][]{%
+% \end{macrocode}
+% Insert \cs{nopartquestion} to fix problem
+% with \cs{multipartquestion}
+% \changes{v8.8.4}{2021/10/02}{Insert \string\cs{nopartquestion} to fix problem
+% with \string\cs{multipartquestion}}
+% \begin{macrocode}
+ \nopartquestion
\ifnum\@eqquestiondepth>\tw@\@toodeep\else
\advance\@eqquestiondepth\@ne\fi
\def\@quesctr{eqquestionno\romannumeral\the\@eqquestiondepth}%
@@ -5208,6 +5218,14 @@ else {
\BG{.7529 .7529 .7529}\W{1}\S{B}\H{P}}
\def\eq@@EndQuizButtonActions{%
\A{\JS{\eQzBtnActns}}}
+% \end{macrocode}
+% Save end quiz button action. The \DescribeMacro\restoreNormalEndQuiz\cs{restoreNormalEndQuiz}
+% restores the action to its original definition.
+% \changes{v8.8.3}{2021/06/24}{Added \string\cs{restoreNormalEndQuiz}}
+% \begin{macrocode}
+\let\eq@@EndQuizButtonActionsDefSave\eq@@EndQuizButtonActions % dps0624
+\def\restoreNormalEndQuiz % dps0624
+ {\let\eq@@EndQuizButtonActions\eq@@EndQuizButtonActionsDefSave}
\newcommand{\eq@hiddenScoreData}{\makebox[0pt][r]{%
\textField[\BC{}\F{\FHidden}]{ScoreData.\curr@quiz}{2bp}{2bp}}}
% \end{macrocode}
@@ -5764,7 +5782,6 @@ if (isEndQuizPushed("@eqBaseName")){
% \begin{macro}{\aeb@creditmarkupfmt}
% \begin{macro}{\ptsLabel}
% \begin{macro}{\ptLabel}
-% \begin{macro}{\multipartquestion}
% \begin{macro}{\hideCreditMarkup}
% \begin{macro}{\showCreditMarkup}
% \cs{showCreditMarkup} will show points assigned to individual questions in a quiz.
@@ -5784,7 +5801,23 @@ if (isEndQuizPushed("@eqBaseName")){
%}
% \begin{macrocode}
\newcounter{qMarkCnt}
-\def\multipartquestion{\global\let\aeb@multipart\eq@One}
+% \end{macrocode}
+% When a question has multi-parts, use \DescribeMacro{\multipartquestion}\cs{multipartquestion} to suppress
+% the partial credit markup.
+% \begin{macrocode}
+\def\multipartquestion{\global
+ \let\aeb@multipart\eq@One
+}
+% \end{macrocode}
+% The default is that a question does not have multiple parts, use \DescribeMacro{\nopartquestion}\cs{nopartquestion}
+% to return to this detault after a \cs{multipartquestion} has been expanded.
+% \changes{v8.8.4}{2021/10/02}{Define \string\cs{nopartquestion} to recover from
+% \string\cs{multipartquestion}}
+% \begin{macrocode}
+\def\nopartquestion{\global
+ \let\aeb@multipart\eq@Zero
+}
+\let\aeb@multipart\eq@Zero
% \end{macrocode}
% The labeling for the partial credit markup. These two commands are
% are defined (identically) in the \textsf{eqexam} package, hence the
@@ -5792,7 +5825,6 @@ if (isEndQuizPushed("@eqBaseName")){
% \begin{macrocode}
\providecommand{\ptsLabel}[1]{\def\eqptsLabel{#1}}\ptsLabel{pts}
\providecommand{\ptLabel}[1]{\def\eqptLabel{#1}}\ptLabel{pt}
-\let\aeb@multipart\eq@Zero
% \end{macrocode}
% \DescribeMacro{\pcMarkupColor} is the named color in RGB color space to
% use for the color of the partial credit markup. (2013/09/14).
@@ -5828,7 +5860,7 @@ if (isEndQuizPushed("@eqBaseName")){
% it is zero. If zero we do place the markup, otherwise, no.
% \begin{macrocode}
\def\qMark{\if\aeb@multipart\eq@Zero\aeb@creditmarkup
- \stepcounter{qMarkCnt}\else\global\let\aeb@multipart\eq@Zero\fi}%
+ \stepcounter{qMarkCnt}\else\nopartquestion\fi}%
% \end{macrocode}
% \cs{qMark@Hook} is a hook that is normally \cs{@empty}. The hook is strategically
% placed at the beginning of each question \cs{item}. Here we define it to be
@@ -5851,7 +5883,6 @@ if (isEndQuizPushed("@eqBaseName")){
% \end{macro}
% \end{macro}
% \end{macro}
-% \end{macro}
%\subsection{Filtering solutions to quizzes}
% The \cs{eqQt} and \cs{eqSQt} commands have one argument designed to be used to filter
% solutions to quizzes. The demo document is \texttt{filter\_quizzes.tex},
@@ -6262,24 +6293,32 @@ if (isEndQuizPushed("@eqBaseName")){
% For the link multiple choice type question. The driver independent stuff starts
% here, then goes to |\Ans@sq@l@driver| the rest of the code that depends on the
% driver.
-% \begin{macrocode}
-\def\sqWrongRespJS{OnBlurRespBox(false,"\oField");}
-\def\sqRightRespJS{OnBlurRespBox(true,"\oField");}
-\def\Ans@sq@l@Actions
-{%
- \A{\if\Ans@choice\eq@One\JS{\sqRightRespJS}
- \ifx\@qzsolndest\@empty\else
- \ifeq@solutionsafter\else
- /Next <</S/GoTo/D(\@qzsolndest)>>
- \fi
+% \changes{v8.8.5}{2021/10/03}{Allow MC in short-quizzes to have check box to dismiss
+% alert box.}
+% \begin{macrocode}
+\def\sqWrongRespJS{% dpsx
+ \ifx\@sqTurnOffAlerts\eq@One%
+ OnBlurRespBox(false,"\oField");\r\fi
+ this.getField("mc.\curr@quiz.\thequestionno").value="\alph{quizno}";
+}
+\def\sqRightRespJS{% dpsx
+ \ifx\@sqTurnOffAlerts\eq@One%
+ OnBlurRespBox(true,"\oField");\r\fi
+ this.getField("mc.\curr@quiz.\thequestionno").value="\alph{quizno}";
+}
+\def\Ans@sq@l@Actions{\A{%
+ \if\Ans@choice\eq@One\JS{\sqRightRespJS}
+ \ifx\@qzsolndest\@empty\else
+ \ifeq@solutionsafter\else
+ /Next <</S/GoTo/D(\@qzsolndest)>>
\fi
- \else
- \JS{\sqWrongRespJS\jsR
- \ifx\oField\@empty\else
- updateTally("\oField.\thequestionno");\fi}%
\fi
- }%
-}
+ \else
+ \JS{\sqWrongRespJS\jsR
+ \ifx\oField\@empty\else
+ updateTally("\oField.\thequestionno");\fi}%
+ \fi
+}}
% \end{macrocode}
% \end{macro}
% \begin{macrocode}
@@ -6295,25 +6334,50 @@ if (isEndQuizPushed("@eqBaseName")){
%</eqexam>
%<*package|eqexam>
\def\linkContentWrapper{(\hfil\linkContentFormat\hfil)}%
-\def\Ans@sq@l{%
- \leavevmode\if\eq@listType\eq@One\stepcounter{quizno}\else
- \@ifundefined{ifwithinsoldoc}{\refstepcounter{quizno}}
- {\ifwithinsoldoc\stepcounter{quizno}\else
- \refstepcounter{quizno}\fi}\fi\PBS\raggedright
- \settowidth{\eq@tmplength}{\eq@lw@l}\sbox{\eq@tmpbox}{\eq@l@l}%
- \eq@tmpdima=\wd\eq@tmpbox
- \def\link@@Content{\linkContentWrapper}%
- \hangindent=\eq@tmplength\hangafter=1\relax
+\def\Ans@sq@l{\leavevmode
+ \if\eq@listType\eq@One\stepcounter{quizno}\else
+ \@ifundefined{ifwithinsoldoc}{\refstepcounter{quizno}}
+ {\ifwithinsoldoc\stepcounter{quizno}\else
+ \refstepcounter{quizno}\fi}\fi\PBS\raggedright
+ \settowidth{\eq@tmplength}{\eq@lw@l}\sbox{\eq@tmpbox}{\eq@l@l}%
+ \eq@tmpdima=\wd\eq@tmpbox
+ \def\link@@Content{\linkContentWrapper}%
+ \hangindent=\eq@tmplength\hangafter=1\relax
%</package|eqexam>
%<*eqexam>
- \Ans@sq@l@driver
+ \Ans@sq@l@driver
%</eqexam>
%<*package>
+% \end{macrocode}
+% (2021/10/03) Move 0 and 1 to tooltip of underlying radio button that flags
+% choice as incorrect and incorrect.
+% \begin{macrocode}
+ \if\Ans@choice\eq@One % dpsx
+ \def\Ans@c@l@Choice{\TU{1}%
+ \BC{}\Ff{\FfReadOnly}}%
+ \def\rbf@Opts{\symbolchoice{\sq@corrsymch}%
+ \textColor{\sq@corrsymcol}}%
+ \else
+ \def\Ans@c@l@Choice{\TU{0}\DV{Yes}%
+ \Ff{\FfReadOnly}\BC{}}%
+ \def\rbf@Opts{\symbolchoice{\sq@wrgsymch}%
+ \textColor{\sq@wrgsymcol}}%
+ \fi
+ \makebox[0pt][l]{\expandafter\radio@@Button\expandafter{\rbf@Opts}%
+ {mc.\curr@quiz.\thequestionno}%
+% \end{macrocode}
+% (2021/10/03) Remove 0 and 1 from export value radio button
+% \begin{macrocode}
+ {\eq@tmpdima}{\RadioFieldSize}{\alph{quizno}}% dpsx
+% {\eq@tmpdima}{\RadioFieldSize}{\Ans@choice\alph{quizno}}%
+ {\eq@protect\A}{\eq@setWidgetProps\eq@l@check@driver}%
+ {\Ans@r@l@Defaults\every@RadioButton
+ \every@qRadioButton}}%
\set@@Link{}{}{}%
- {\makebox[\eq@tmpdima]{\color{\@linkcolor}\link@@Content}}
- {\eq@protect\A}{\eq@setWidgetProps\setLink@driver}%
- {\set@LinkTextDefaults\Ans@sq@l@Actions\every@Link}%
- \Ans@proofing{\eq@tmpdima}%
+ {\makebox[\eq@tmpdima]{\color{\@linkcolor}\link@@Content}}
+ {\eq@protect\A}{\eq@setWidgetProps\setLink@driver}%
+ {\set@LinkTextDefaults\Ans@sq@l@Actions\every@Link}%
+ \Ans@proofing{\eq@tmpdima}%
%</package>
%<*package|eqexam>
\eq@hspanner\ignorespaces}
@@ -6341,14 +6405,22 @@ if (isEndQuizPushed("@eqBaseName")){
% driver.
% \changes{v7.7d}{2015/11/15}{Changed mc.\string\cs{oFields} so it is printable}
% \begin{macrocode}
-\def\@@Ans@sq@f@Defaults
-{%
- \BC{0 0 0}\Ff{\FfNoToggleToOff}\W{1}
-% \F{\FPrint}
- \textSize{12}\textColor{0 g}
+% \end{macrocode}
+%\DescribeMacro{\TUChoice}\hskip-\marginparsep\texttt{\darg{\ameta{text}}} A generic
+%tooltip for radio buttons and check boxes for MS and MS questions. The default
+%is |\TUChoice{Choice}|.
+%\changes{v8.8.5}{2021/10/03}{Added \string\cs{TUChoice}}
+% \begin{macrocode}
+\def\TUChoice#1{\def\TU@Choice{#1}}
+\TUChoice{Choice}
+% \end{macrocode}
+% \begin{macrocode}
+\def\@@Ans@sq@f@Defaults{%
+ \BC{0 0 0}\Ff{\FfNoToggleToOff}\W{1}%\F{\FPrint}
+ \textSize{12}\textColor{0 g}\TU{\TU@Choice} % dpsx
}
% \end{macrocode}
-% For short quizzes, refine the type of responses: turn off the alert
+% For short-quizzes, refine the type of responses: turn off the alert
% message (the default is on); or have a (red) `\texttt{x}' make an
% incorrect answer, and a (green) check mark a correct answer.
% \begin{macrocode}
@@ -6493,7 +6565,8 @@ updateTally("*oField.*thequestionno");%
\mbox{\expandafter\radio@@Button\expandafter{\rbf@Opts}%
{mc.\oField.\thequestionno}%
{\RadioFieldSize}{\RadioFieldSize}%
- {\Ans@choice\alph{quizno}}{\eq@protect\A}%
+ {\alph{quizno}}{\eq@protect\A}%
+% {\Ans@choice\alph{quizno}}{\eq@protect\A}%
{\eq@setWidgetProps\eq@Radio@driver}%
{\@@Ans@sq@f@Defaults\Ans@sq@f@Actions\every@RadioButton
\every@sqRadioButton}}%
@@ -6509,14 +6582,13 @@ updateTally("*oField.*thequestionno");%
% Created in support of \textsf{eqExam} to give multiple selection for the
% online and email options. Otherwise, it defaults to a radio button field.
% \begin{macrocode}
-%
%</package>
%<*eqexam>
\let\Ans@ck@sq@f\Ans@sq@f
%</eqexam>
%<*package>
\def\@@Ans@ck@sq@f@Defaults{%
- \BC{0 0 0}\Ff{\FfNoToggleToOff}
+ \BC{0 0 0}\Ff{\FfNoToggleToOff}\TU{\TU@Choice} % dpsx
\F{\FPrint}\textSize{12}\textColor{0 g}\W{1}
}
\begingroup
@@ -6529,11 +6601,18 @@ updateTally("*oField.*thequestionno");%
% \begin{macrocode}
\begin{defineJS}[\makeesc\*\makecmt\%]{\Ans@ck@sq@f@ActionsTrue}
var fName=event.target.name;
-var g=this.getField("mc.*oField.*thequestionno");
+var g=this.getField("mck.*oField.*thequestionno");
var a=g.getArray();
+% dpsx
+var h=this.getField("mcq.*oField.*thequestionno");
+var b=h.getArray();
+% \end{macrocode}
+% (2021/10/03) Work with the tooltop of \texttt{mcq} rather than the export value
+% of \texttt{mck}.
+% \begin{macrocode}
for (var i=0; i<a.length; i++)
- if ( (a[i].isBoxChecked(0)) && %
-(a[i].value.charAt(0)==0) )
+ if ( (a[i].isBoxChecked(0)) && (b[i].userName=="0" ) )
+%(a[i].value.charAt(0)==0) )
a[i].checkThisBox(0,false);%
*ifx*@sqTurnOffAlerts*eq@One
OnBlurRespBox(true,"*oField");*else
@@ -6551,8 +6630,12 @@ var f=this.getField("corr.*oField.*thequestionno");
if (f==null) {
if ( (qzSolnDest != "") && !solnAfter ) {
for (var i=0; i<a.length; i++){
- if ((a[i].exportValues[0].charAt(0)==1) && %
-(!a[i].isBoxChecked(0))) break;
+% if ((a[i].exportValues[0].charAt(0)==1) && % dpsx %
+% \end{macrocode}
+% (2021/10/03) Work with the tooltop of \texttt{mcq} rather than the export value
+% of \texttt{mck}.
+% \begin{macrocode}
+ if ((b[i].userName=="1") && (!a[i].isBoxChecked(0))) break;
}
}
if (i>=a.length) jmpToNamedDest("*oField","*@qzsolndest",%
@@ -6567,10 +6650,18 @@ if (f==null) {
% \begin{macrocode}
\begin{defineJS}[\makeesc\*\makecmt\%]{\Ans@ck@sq@f@ActionsFalse}
var fName=event.target.name;
-var g=this.getField("mc.*oField.*thequestionno");
+var g=this.getField("mck.*oField.*thequestionno");
var a=g.getArray();
+% dpsx
+var h=this.getField("mcq.*oField.*thequestionno");
+var b=h.getArray();
for (var i=0; i<a.length; i++) {
- if (a[i].value.charAt(0)==0) {
+% if (a[i].value.charAt(0)==0) {
+% \end{macrocode}
+% (2021/10/03) Work with the tooltop of \texttt{mcq} rather than the export value
+% of \texttt{mck}.
+% \begin{macrocode}
+ if (b[i].userName=="0") {
if ( fName != a[i].name )
a[i].checkThisBox(0,false);
}
@@ -6609,14 +6700,25 @@ updateTally("*oField.*thequestionno");*fi%
\hangindent\eq@tmplength\hangafter\@ne % dps
\insertGrayLetters % 6.3d
\mbox{\expandafter\check@@Box\expandafter{\rbf@Opts}%
- {mc.\oField.\thequestionno.\arabic{quizno}}%
+ {mck.\oField.\thequestionno.\arabic{quizno}}%
{\RadioFieldSize}{\RadioFieldSize}
- {\Ans@choice\alph{quizno}}{\eq@protect\A}%
+ {\alph{quizno}}{\eq@protect\A}%
+% {\Ans@choice\alph{quizno}}{\eq@protect\A}% dpsx
{\eq@setWidgetProps\eq@Check@driver}%
{\@@Ans@ck@sq@f@Defaults\Ans@ck@sq@f@Actions\every@CheckBox
\every@sqCheckBox}}%
- \Ans@proofing{\RadioFieldSize}%
- \eq@hspanner\ignorespaces
+ \def\late@options{\BC{}}%
+ \if\Ans@choice\eq@One % dpsx
+ \eq@addExpandTo\late@options{\TU{1}}\else
+ \eq@addExpandTo\late@options{\TU{0}}\fi
+ \makebox[0pt][r]{\check@@Box{}% dpsx
+ {mcq.\oField.\thequestionno.\arabic{quizno}}%
+ {0pt}{0pt}{Yes}{}% \@tempdimb
+ {\eq@setWidgetProps\eq@Check@driver}%
+ {\Ans@c@f@Defaults\every@RadioButton
+ \every@qRadioButton\late@options}}% dpsx
+ \Ans@proofing{\RadioFieldSize}\eq@hspanner
+ \ignorespaces
}
% \end{macrocode}
% \end{macro}
@@ -6842,6 +6944,7 @@ updateTally("*oField.*thequestionno");*fi%
% \end{macrocode}
% \end{macro}
% \subsubsection{Link Style}
+%
% \begin{macro}{\Ans@l}
% For the forms version of the \texttt{quiz} environment.
% dps 12/19/03 removed the notify because we are not embedding a radio button field
@@ -6849,7 +6952,8 @@ updateTally("*oField.*thequestionno");*fi%
\let\qRadionActionsHook\@empty
\def\Ans@@l@Actions{\A{\JS{%
this.getField("mc.\curr@quiz.\thequestionno").value\eqSP
- =\eqSP"\Ans@choice\alph{quizno}";\jsR
+ =\eqSP"\alph{quizno}";\jsR
+% =\eqSP"\Ans@choice\alph{quizno}";\jsR // dpsx
RecordPointValue([0,\eqPTs,\eq@pPTs],\thequestionno);\jsR
RecordProblemType("\eqQT",\thequestionno);\jsR
ProcessQuestion(\Ans@choice,"\alph{quizno}",\thequestionno,%
@@ -6858,9 +6962,26 @@ updateTally("*oField.*thequestionno");*fi%
\ifeq@noquizsolutions\else,1\fi\fi\fi);\qRadionActionsHook}}%
}
\def\Ans@r@l@Defaults{%
- \BC{}\S{S}\W{1}\Ff{\FfNoToggleToOff}\F{\FPrint}
+ \BC{}\S{S}\W{1}\Ff{\FfNoToggleToOff}\F{\FPrint}\TU{\TU@Choice} % dpsx
\textSize{12}\textColor{0 g}\Ff{\FfReadOnly}
}
+% \end{macrocode}
+% (2021/10/03) Changes are needed to radio buttons and checkboxes (Commands: \cs{Ans@l},\cs{Ans@ck@l}, \cs{Ans@@f}, and \cs{Ans@@ck@f})
+% of the \env{answers} and \env{manswers} environments. AA/AR has changed the way they display the tooltip: changed
+% from `\ameta{tooltip}' to `\ameta{tooltip}\texttt:\,\ameta{export-value}'. Unfortunately, the \ameta{export-value}
+% contains code that signals whether this field is a correct choice or not: an export value that begins with a
+% one (1) indicates a correct choice, which one that begins with a zero (0) marks an incorrect choice. When the student passes
+% his mouse cursor over a choice, he sees `1a' or `0b'; seeing enough of these patterns, their meaning will become known.
+%
+% The workaround is to move the binary flag to the tooltip of the underlying checkbox, which is readonly, hence,
+% there is not over display of this field. In the fields listed above, we insert \cs{TU{1}} or \cs{TU{0}}
+% into each of the checkboxes whose names begin with \texttt{mcq}.
+%
+% The final step is to change the JavaScript to look at the \texttt{mcq} fields rather than
+% the \texttt{mc} or \texttt{mck} fields.
+% \changes{v8.8.5}{2021/10/03}{Changes required by changes in the display of
+% tooltip for choice fields}
+% \begin{macrocode}
\def\Ans@l{\leavevmode\if\eq@listType1\stepcounter{quizno}%
\else\refstepcounter{quizno}\fi\PBS\raggedright
\settowidth{\eq@tmplength}{\eq@lw@l}\sbox{\eq@tmpbox}{\eq@l@l}%
@@ -6873,7 +6994,8 @@ updateTally("*oField.*thequestionno");*fi%
\def\late@options{\BC{}}%
\if\Ans@choice\eq@One\relax\eq@recordAnsChoice\fi
\makebox[0pt][l]{\radio@@Button{}{mc.\curr@quiz.\thequestionno}%
- {\eq@tmpdima}{\RadioFieldSize}{\Ans@choice\alph{quizno}}%
+ {\eq@tmpdima}{\RadioFieldSize}{\alph{quizno}}% dpsx
+% {\eq@tmpdima}{\RadioFieldSize}{\Ans@choice\alph{quizno}}%
{\eq@protect\A}{\eq@setWidgetProps\eq@l@check@driver}%
{\Ans@r@l@Defaults\every@RadioButton
\every@qRadioButton\late@options}}%
@@ -6899,11 +7021,15 @@ updateTally("*oField.*thequestionno");*fi%
\fi
\def\late@options{\BC{}}%
\if\Ans@choice\eq@One
+ \eq@addExpandTo\late@options{\TU{1}}%
\ifx\@qzsolndest\@empty\else
\ifeq@noquizsolutions\else
- \edef\late@options{\noexpand\BC{\solution@Color}}%
+ \eq@addExpandTo\late@options{%
+ \BC{\solution@Color}}%
\fi
\fi
+ \else
+ \eq@addExpandTo\late@options{\TU{0}}%
\fi
\makebox[0pt][r]{\check@@Box{}%
{mcq.\curr@quiz.\thequestionno.\arabic{quizno}}%
@@ -6942,10 +7068,14 @@ updateTally("*oField.*thequestionno");*fi%
\ifeq@noquizsolutions\else,1\fi\fi\fi);\jsR
}}}%
}
+% \end{macrocode}
+% \begin{macrocode}
\def\Ans@ck@l@Defaults{%
- \BC{}\S{S}\W{1}\H{N}\Ff{\FfNoToggleToOff}
+ \BC{}\S{S}\W{1}\H{N}\Ff{\FfNoToggleToOff}\TU{\TU@Choice} % dpsx
\textSize{12}\textColor{0 g}\Ff{\FfReadOnly}
}
+% \end{macrocode}
+% \begin{macrocode}
\def\Ans@ck@l{\leavevmode
\if\eq@listType1\stepcounter{quizno}%
\else\refstepcounter{quizno}\fi
@@ -6957,7 +7087,8 @@ updateTally("*oField.*thequestionno");*fi%
\def\link@@Content{(\hfil\linkContentFormat\hfil)}%
\makebox[0pt][l]{%
\check@@Box{}{mck.\curr@quiz.\thequestionno.\arabic{quizno}}%
- {\eq@tmpdima}{\RadioFieldSize}{\Ans@choice\alph{quizno}}%
+ {\eq@tmpdima}{\RadioFieldSize}{\alph{quizno}}% dpsx
+% {\eq@tmpdima}{\RadioFieldSize}{\Ans@choice\alph{quizno}}%
{\eq@protect\A}{\eq@setWidgetProps\eq@l@check@driver}%
{\Ans@ck@l@Defaults\every@RadioButton
\every@qckCheckbox}}%
@@ -6967,7 +7098,7 @@ updateTally("*oField.*thequestionno");*fi%
{\set@LinkTextDefaults\Ans@ck@@l@Actions\every@Link}%
\ifnocorrections\else
\if\Ans@choice\eq@One
- \edef\Ans@c@l@Choice{\noexpand\DV{Yes}%
+ \edef\Ans@c@l@Choice{\noexpand\TU{1}\noexpand\DV{Yes}%
\ifx\@qzsolndest\@empty\noexpand\BC{}%
\noexpand\Ff{\FfReadOnly}%
\else % there is a solution
@@ -6980,7 +7111,7 @@ updateTally("*oField.*thequestionno");*fi%
\fi
}%
\else
- \def\Ans@c@l@Choice{\Ff{\FfReadOnly}\BC{}}%
+ \def\Ans@c@l@Choice{\TU{0}\Ff{\FfReadOnly}\BC{}}%
\fi
\makebox[0pt][r]{\check@@Box{}%
{mcq.\curr@quiz.\thequestionno.\arabic{quizno}}%
@@ -7005,7 +7136,7 @@ updateTally("*oField.*thequestionno");*fi%
\refstepcounter{quizno}\fi
\PBS\raggedright\Ans@@f}
\def\Ans@r@f@Defaults{%
- \BC{0 0 0}\S{S}\W{1}\Ff{\FfNoToggleToOff}
+ \BC{0 0 0}\S{S}\W{1}\Ff{\FfNoToggleToOff}\TU{\TU@Choice} % dpsx
\F{\FPrint}\textSize{12}\textColor{0 g}
}
% \end{macrocode}
@@ -7065,7 +7196,8 @@ updateTally("*oField.*thequestionno");*fi%
\if\Ans@choice\eq@One\eq@recordAnsChoice\fi
\mbox{\expandafter\radio@@Button\expandafter{\rbf@Opts}%
{mc.\curr@quiz.\thequestionno}%
- {\RadioFieldSize}{\RadioFieldSize}{\Ans@choice\alph{quizno}}%
+ {\RadioFieldSize}{\RadioFieldSize}{\alph{quizno}}% dpsx
+% {\RadioFieldSize}{\RadioFieldSize}{\Ans@choice\alph{quizno}}%
{\eq@protect\A}{\eq@setWidgetProps\eq@Radio@driver}%
{\Ans@r@f@Defaults\Ans@r@f@Actions\every@RadioButton
\every@qRadioButton\insert@circlesymbol}}%
@@ -7089,11 +7221,15 @@ updateTally("*oField.*thequestionno");*fi%
% \begin{macrocode}
\ifaeb@usecircles\def\late@options{\BC{}}\fi
\if\Ans@choice\eq@One
+ \eq@addExpandTo\late@options{\TU{1}}%
\ifx\@qzsolndest\@empty\else
\ifeq@noquizsolutions\else
- \edef\late@options{\noexpand\BC{\solution@Color}}%
+ \eq@addExpandTo\late@options{%
+ \BC{\solution@Color}}%
\fi
\fi
+ \else
+ \eq@addExpandTo\late@options{\TU{0}}%
\fi
\makebox[0pt][r]{\check@@Box{}%
{mcq.\curr@quiz.\thequestionno.\arabic{quizno}}%
@@ -7120,8 +7256,11 @@ updateTally("*oField.*thequestionno");*fi%
\else\refstepcounter{quizno}\fi
\if\Ans@choice\eq@One\eq@recordAnsChoice\fi
\PBS\raggedright\Ans@@ck@f}
+% \end{macrocode}
+% \begin{macrocode}
\def\Ans@ck@f@Defaults{%
\BC{0 0 0}\S{S}\W{1}\Ff{\FfNoToggleToOff}
+ \TU{\TU@Choice} % dpsx
\textSize{12}\textColor{0 g}
}
% \end{macrocode}
@@ -7178,7 +7317,8 @@ updateTally("*oField.*thequestionno");*fi%
\textColor{\qz@chksymbcol}}%
\mbox{\expandafter\check@@Box\expandafter{\cbf@Opts}%
{mck.\curr@quiz.\thequestionno.\arabic{quizno}}%
- {\RadioFieldSize}{\RadioFieldSize}{\Ans@choice\alph{quizno}}%
+ {\RadioFieldSize}{\RadioFieldSize}{\alph{quizno}}% dpsx
+% {\RadioFieldSize}{\RadioFieldSize}{\Ans@choice\alph{quizno}}%
{\eq@protect\A}{\eq@setWidgetProps\eq@Check@driver}%
{\Ans@ck@f@Defaults\Ans@ck@f@Actions\every@RadioButton
\every@qckCheckbox}}%
@@ -7196,10 +7336,14 @@ updateTally("*oField.*thequestionno");*fi%
\fi
\let\late@options\@empty
\if\Ans@choice\eq@One
+ \eq@addExpandTo\late@options{\TU{1}}%
\ifx\@qzsolndest\@empty\else
\ifeq@noquizsolutions\else
- \edef\late@options{\noexpand\BC{\solution@Color}}\fi
+ \eq@addExpandTo\late@options{%
+ \BC{\solution@Color}}\fi
\fi
+ \else
+ \eq@addExpandTo\late@options{\TU{0}}%
\fi
% \end{macrocode}
% The top most checkbox
@@ -8007,7 +8151,7 @@ updateTally("*oField.*thequestionno");*fi%
% \end{macrocode}
% \begin{macrocode}
\let\insert@circlesymbol\@empty
-\def\useMCCircles{\useForms
+\def\useMCCircles{%\useForms
\ifaeb@usecircles\else
\global\aeb@usecirclestrue
\gdef\insert@circlesymbol{\symbolchoice{circle}}%
@@ -8144,14 +8288,25 @@ updateTally("*oField.*thequestionno");*fi%
%{
% Added \string\cs{requireAlertBox} to turn off the ``Do not show this message again'' checkbox for objective questions.
%}
-%The alert box displays the message \cs{doNotShowAgainMsg} which by default is
-%``Do not show this message again''
+%The alert box displays the message \DescribeMacro{\doNotShowAgainMsg}\cs{doNotShowAgainMsg}, which by default is
+%``Do not show this message again''. This message appear when \DescribeMacro{\allowNoAlertBox}\cs{allowNoAlertBox} (the default)
+% is in effect.
% \begin{macrocode}
\def\requireAlertBox{\def\bcheckboxused{false}}
\def\allowNoAlertBox{\def\bcheckboxused{true}}
\allowNoAlertBox
% \end{macrocode}
% \end{macro}
+% When \DescribeMacro{\useCkBxAlertsOn}\cs{useCkBxAlertsOn} is expanded in the preamble, alerts
+% generated by links (usually a short-quiz) uses a check box that allows its dismissal
+% subsequently. \DescribeMacro{\useCkBxAlertsOff}\cs{useCkBxAlertsOff} reverts the behavior
+% to alert boxes with no check box, the old default.
+% \changes{v8.8.5}{2021/10/03}{Added \string\cs{useCkBxAlertsOn}}
+% \begin{macrocode}
+\def\useCkBxAlertsOn{\def\buseckbx{true}} % dpsx
+\def\useCkBxAlertsOff{\def\buseckbx{false}}
+\useCkBxAlertsOn
+% \end{macrocode}
% \subsection{Math Fill-In Questions}
% \begin{macro}{\RespBox}
% \begin{macro}{\RespBoxMath}
@@ -9474,7 +9629,8 @@ if ( typeof *oField == "undefined" )
*oField = new Object;
if (typeof appAlerts["*oField"] == "undefined")
appAlerts["*oField"] = new Object;
-this.resetForm(new Array("mc.*oField","obj.*oField",%
+% dpsx
+this.resetForm(new Array("mc.*oField","mck.*oField","obj.*oField",%
"tally.*oField","grpobj.*oField"));
var f = this.getField("obj.*oField");
if ( f != null ) f.strokeColor=*ifx*defaultColorJSLoc*@empty%
@@ -10700,6 +10856,23 @@ aCorrectAns[!currQuiz.Grp["!thequestionno"].offset],!oField);!fi
\def\every@eqIcon{}
% \end{macrocode}
%
+% \subsection{Utility macro to dynamically modify appearances}
+%
+% This internal command is used to dynamically modify the appearance of form fields.
+% \begin{macro}{\eq@addExpandTo}\hskip-\marginparsep\texttt{\darg{\ameta{\cs{CMD}}}\darg{\ameta{KVPs}}}
+% The \cs{eq@addExpandTo} is a utility command that adds eforms key-value pairs to the
+% end of the macro \texttt{\ameta{\cs{CMD}}}. The second argument of the KVP is expanded first.
+% Used to dynamically modify appearances of a form field.
+% \changes{v8.8.5}{2021/10/03}{Added \string\cs{eq@addExpandTo}}
+% \begin{macrocode}
+\def\eq@addExpandTo#1#2{\bgroup\let\protect\noexpand
+ \toks@=\expandafter{#1}\protectedKeys*{p@Keys}{#2}%
+ \edef\x{\@nameuse{p@Keys}}\toks2=\expandafter{\x}%
+ \xdef#1{\the\toks@\the\toks2}\egroup
+}
+% \end{macrocode}
+% \end{macro}
+
% \subsection{Additional Format and Action keys}
%
% \begin{macro}{\AddAAFormat}
@@ -13061,7 +13234,8 @@ function clearAllSubQuizzes() {
\begin{newsegment}{Eq: Support for Multi-Selection}
function ProcessMultiSelection(key,letterresp,probno,%
quizno,qtfield,pts,ppts) {
- var f = this.getField("mck."+qtfield+"."+probno);
+% var f = this.getField("mck."+qtfield+"."+probno); // dpsx
+ var f = this.getField("mcq."+qtfield+"."+probno);
% \end{macrocode}
% For the multiple selection problem, the formats for the \texttt{RightWrong} and \texttt{ProbValue}
% arrays are as follows:
@@ -13092,7 +13266,12 @@ quizno,qtfield,pts,ppts) {
% \begin{macrocode}
var nTotalCorrect = 0;
for ( var i=0; i<g.length; i++ )
- nTotalCorrect += (1*g[i].exportValues[0].charAt(0));
+% \end{macrocode}
+% (2021/10/03) Work with the tool tip of \texttt{mcq} rather than the export value
+% of \texttt{mck}.
+% \begin{macrocode}
+ nTotalCorrect += (1*g[i].userName);
+% nTotalCorrect += (1*g[i].exportValues[0].charAt(0)); // dpsx
ProbValue[probno] = new Array();
RightWrong[probno] = new Array();
ProbValue[probno] = [nTotalCorrect,pts,[]];
@@ -13295,11 +13474,15 @@ app.clearTimeOut(oNoPeekTimer);",5);
} else this.pageNum = rtnPage-1;
}
% \end{macrocode}
-% When the user exits a fill-in shortquiz field, this function is called.
+% When the user exits a fill-in short-quiz field, this function is called.
% It immediately notifies user of whether their answer is right
% or wrong, and changes the color of the boundary field.
% \begin{macrocode}
-var oCB=\bcheckboxused
+var bCB=\bcheckboxused
+% \end{macrocode}
+% (2021/10/03) Boolean to use extended alert boxes for MC and MS, short-quiz.
+% \begin{macrocode}
+var bUseCkBx=\buseckbx; // dpsx
function OnBlurRespBox (retn)
{
var qname = arguments[1];
@@ -13311,7 +13494,11 @@ function OnBlurRespBox (retn)
appAlerts[qname] = {bAfterValue: false, %
cMsg: "\doNotShowAgainMsg"};
var respMsg = (retn) ? \eqsqrtmsg\space : \eqsqwgmsg;
- if ( (event.target == this) || !oCB)
+% \end{macrocode}
+% If \texttt{event.target} is the Doc object, the function has been called from
+% a link; if called from a field action \texttt{event.target} is a Field object.
+% \begin{macrocode}
+ if ( !bUseCkBx && ( (event.target == this) || !bCB ) ) // dpsx
eqAppAlert({ cMsg: respMsg, nIcon: 3, cTitle: cTitle });
else {
if ( ! appAlerts[arguments[1]].bAfterValue )
@@ -13335,11 +13522,12 @@ oCheckbox: appAlerts[qname]});
}
}
function jmpToNamedDest(fName,cDest,bAlert) {
- if ( (typeof appAlerts[fName]!="undefined" %
+ if (cDest == "") return;
+ if ( (typeof appAlerts[fName]!="undefined" %
&& appAlerts[fName].bAfterValue) || bAlert==0)
- app.setTimeOut("this.gotoNamedDest(\""+cDest+"\")",500);
- else
- this.gotoNamedDest(cDest);
+ app.setTimeOut("this.gotoNamedDest(\""+cDest+"\")",500);
+ else
+ this.gotoNamedDest(cDest);
}
% \end{macrocode}
% Description: This is the default function for determining whether
diff --git a/macros/latex/contrib/acrotex/insdljs.dtx b/macros/latex/contrib/acrotex/insdljs.dtx
index b32a727083..dc756a1ed2 100644
--- a/macros/latex/contrib/acrotex/insdljs.dtx
+++ b/macros/latex/contrib/acrotex/insdljs.dtx
@@ -608,7 +608,10 @@
% \changes{v2.3a}{2016/07/31}{Added luatex85 definition of \string\cs{pdfpageref}}
% \begin{macrocode}
\ifpdf\ifx\pdfextension\@undefined\else
+ \protected\def\pdfcatalog{\pdfextension catalog } % l3
\protected\def\pdfnames{\pdfextension names }
+ \protected\def\pdfobj{\pdfextension obj } % l3
+ \protected\def\pdflastobj{\numexpr\pdffeedback lastobj\relax} % l3
\def\pdfpageref{\pdffeedback pageref}\fi\fi
% \end{macrocode}
% The critical JavaScript files are no longer distributed with this package,
@@ -700,10 +703,10 @@
\def\AEB@psMrk{[%]
\space}
\ifx\dl@reqJS\dl@YES
- \def\dl@@reqJS{/Type/Requirement/S/EnableJavaScripts}
+ \def\dl@@reqJS{/Requirements[<</Type/Requirement/S/EnableJavaScripts>>]}
\ifpdf\pdfcatalog{\dl@@reqJS}\else
- \ifxetex\immediate\@pdfm@mark{put @catalog <<\dl@@reqJS>>}\else
- \literalps@out{\AEB@psMrk{Catalog} <<\dl@@reqJS>> /PUT pdfmark}\fi\fi
+ \ifxetex\immediate\special{pdf:put @catalog <<\dl@@reqJS>>}\else
+ \literalps@out{\AEB@psMrk{Catalog} <<\dl@@reqJS>> /PUT\space pdfmark}\fi\fi
\fi
% \end{macrocode}
% Added switch to mark whether djs is inserted
@@ -1324,7 +1327,7 @@
\edef\addActionObj{\the\pdflastobj\space 0 R}}%
\else\ifxetex
\def\aeb@addActionCode{\immediate
- \@pdfm@mark{obj @objAddActionObj
+ \special{pdf:obj @objAddActionObj
<< \aebpopentoks\aebp@rightDelimiters >> }}%
\def\addActionObj{@objAddActionObj}%
\else % postscript
@@ -1348,7 +1351,7 @@
\aeb@addActionCode
\ifpdf\pdfcatalog{\dljs@OpenActions}\else
\ifxetex\immediate
- \@pdfm@mark{put @catalog <<\dljs@OpenActions>>}\else
+ \special{pdf:put @catalog <<\dljs@OpenActions>>}\else
\literalps@out{\AEB@psMrk
{Catalog} <<\dljs@OpenActions>> /PUT pdfmark}\fi\fi\egroup}
% \end{macrocode}
@@ -1398,11 +1401,11 @@
% For \textsf{dvipdfm}
% \begin{macrocode}
\def\@OAction@dvipdfm{\ifx\isOpenAction\dl@YES
- \@pdfm@mark{put @thispage << /AA << /O << \theFirstAction\space
+ \special{pdf:put @thispage << /AA << /O << \theFirstAction\space
\opentoks\@rightDelimiters >> \@CloseAction >> >>}\fi
}
\def\@POAction@dvipdfm{%
- \@pdfm@mark{put @thispage << /AA << \@thisOpenAction
+ \special{pdf:put @thispage << /AA << \@thisOpenAction
\@thisCloseAction >> >>}%
}
% \end{macrocode}
@@ -2227,7 +2230,7 @@
% \begin{macrocode}
\ifpdf\pdfcatalog{\dljs@willDidActions}\else
\ifxetex\immediate
- \@pdfm@mark{put @catalog <<\dljs@willDidActions>>}\else
+ \special{pdf:put @catalog <<\dljs@willDidActions>>}\else
\literalps@out{\AEB@psMrk
{Catalog} <<\dljs@willDidActions>> /PUT pdfmark}\fi\fi
}
@@ -2539,9 +2542,9 @@ if(typeof \detectdljs\space == "undefined")\jsR\jsT
% \begin{macrocode}
\def\setDLJSRef@dvipdfm
{%
- \immediate\@pdfm@mark{obj @objnames %
+ \immediate\special{pdf:obj @objnames %
<< /Names [\the\importfdftoks] >> }%
- \@pdfm@mark{put @names %
+ \special{pdf:put @names %
<< /JavaScript @objnames >> }%
}
% \end{macrocode}
diff --git a/macros/latex/contrib/denisbdoc/README.md b/macros/latex/contrib/denisbdoc/README.md
index 4c41602027..6bce9c15cb 100644
--- a/macros/latex/contrib/denisbdoc/README.md
+++ b/macros/latex/contrib/denisbdoc/README.md
@@ -1,4 +1,4 @@
-denisbdoc - A personal package for documenting classes and packages, v. 0.9.1
+denisbdoc - A personal package for documenting classes and packages, v. 0.9.2
=============================================================================
**The sole purpose of this (quick 'n dirty) `denisbdoc` package is for
diff --git a/macros/latex/contrib/denisbdoc/denisbdoc.dtx b/macros/latex/contrib/denisbdoc/denisbdoc.dtx
index af502881fe..9216617e6b 100644
--- a/macros/latex/contrib/denisbdoc/denisbdoc.dtx
+++ b/macros/latex/contrib/denisbdoc/denisbdoc.dtx
@@ -3,7 +3,7 @@
\iffalse
%</internal>
%<*readme>
-denisbdoc - A personal package for documenting classes and packages, v. 0.9.1
+denisbdoc - A personal package for documenting classes and packages, v. 0.9.2
=============================================================================
**The sole purpose of this (quick 'n dirty) `denisbdoc` package is for
@@ -31,7 +31,7 @@ This package is currently not documented.
\preamble
-----------------------------------------------------------------------------
denisbdoc --- A personal dirty package for documenting personal classes,
- version 0.9.1
+ version 0.9.2
Maintained by Denis Bitouzé
E-mail: denis.bitouze@univ-littoral.fr
@@ -41,7 +41,7 @@ See http://www.latex-project.org/lppl.txt
\endpreamble
\postamble
-Copyright (C) 2015-2020 by
+Copyright (C) 2015-2021 by
Denis Bitouzé <denis.bitouze@univ-littoral.fr>
It may be distributed and/or modified under the conditions of
@@ -126,6 +126,7 @@ This work consists of the file denisbdoc.dtx
%\changes{v0.8}{2020/03/27}{Eighth CTAN version}
%\changes{v0.9}{2020/05/31}{Nineth CTAN version}
%\changes{v0.9.1}{2020/10/14}{Further CTAN version}
+%\changes{v0.9.2}{2021-10-13}{Further CTAN version}
%
%\begin{abstract}
% ...
@@ -196,7 +197,7 @@ This work consists of the file denisbdoc.dtx
%
% The usual preliminaries.
% \begin{macrocode}
-\ProvidesExplPackage {denisbdoc} {2020/10/14} {0.9.1}
+\ProvidesExplPackage {denisbdoc} {2021-10-13} {0.9.2}
{A personal package for documenting packages}
% \end{macrocode}
%
@@ -243,7 +244,9 @@ This work consists of the file denisbdoc.dtx
% \begin{macrocode}
\sys_if_engine_pdftex:TF
{
- % \RequirePackage{cmap}
+ \RequirePackage{cmap} % Necessary for the angle brackets generated by ×\meta×
+ % to be copied and pasted as they are, and not replaced
+ % by "h" and "i"
\RequirePackage[T1]{fontenc}
\RequirePackage[utf8]{inputenc}
% \end{macrocode}
@@ -279,7 +282,7 @@ This work consists of the file denisbdoc.dtx
\@ifclassloaded{beamer}{\@DBD@beamer@not@loaded@false}{\@DBD@beamer@not@loaded@true}
%
\if@DBD@beamer@not@loaded@
-\RequirePackage{parskip}%
+ \RequirePackage{parskip}%
\RequirePackage{marginnote}
\RequirePackage{mparhack}
\RequirePackage[inline]{enumitem}
@@ -288,6 +291,7 @@ This work consists of the file denisbdoc.dtx
\RequirePackage{calc}%
% \RequirePackage[lining]{libertine}%
\RequirePackage{siunitx}%
+\RequirePackage{pifont}
% \RequirePackage[a4paper]{geometry}%
\RequirePackage{booktabs}%
\RequirePackage{multirow}%
@@ -310,7 +314,10 @@ This work consists of the file denisbdoc.dtx
\RequirePackage{etoolbox}%
\RequirePackage{iflang}%
\RequirePackage{ifpdf}%
-\RequirePackage{amssymb}%
+\sys_if_engine_pdftex:T
+{
+ \RequirePackage{amssymb}%
+}
\if@DBD@beamer@not@loaded@
\RequirePackage{tocvsec2}%
\fi
@@ -882,7 +889,7 @@ This work consists of the file denisbdoc.dtx
norm*,lnorm*,llnorm*,lpnorm*,supnorm*,abs*,prt*,brk*,brc*,lrangle*,leqgeq*,%
pdfobjcompresslevel,chaptermark,PassOptionsToClass%
},%
- morekeywords={[1]% Environments' names
+ morekeywords=[1]{% Environments' names
tabular,tabulary,math,document,minipage,eqnarray,eqnarray*,align,align*,%
equation,gather,multline,flalign,equation*,gather*,multline*,flalign*,%
itemize,itemize*,enumerate,enumerate*,description,description*,%
@@ -1375,7 +1382,10 @@ This work consists of the file denisbdoc.dtx
% The \pkg{kpfonts} and \pkg{libertine}'s ttfamilies are not as nice as
% \pkg{lmodern}'s one to my taste. So let's use the latter.
% \begin{macrocode}
-\renewcommand{\ttdefault}{lmtt}
+\sys_if_engine_pdftex:T
+{
+ \renewcommand{\ttdefault}{lmtt}
+}
% \end{macrocode}
%
% \pkg{lmodern} doesn't provide extended bold italic typewritter, hence
@@ -1383,6 +1393,7 @@ This work consists of the file denisbdoc.dtx
% a italic context. To get rid of this warning, we silently substitute bold
% slanted to extended bold italic.
% \begin{macrocode}
+\sys_if_engine_pdftex:T
{%
\ttfamily%
\DeclareFontShape{T1}{lmtt}{bx}{it}{<-> ssub * lmtt/b/sl}{}%
@@ -1755,31 +1766,31 @@ This work consists of the file denisbdoc.dtx
}
\NewDocumentCommand{\texstudio}{ }
{
- \program{TeXstudio}\xspace
+ \program{TeXstudio}
}
\NewDocumentCommand{\emacs}{ }
{
- \program{Emacs}\xspace
+ \program{Emacs}
}
\NewDocumentCommand{\texlive}{ }
{
- \href{http://www.tug.org/texlive/}{\TeX{}\c_space_tl{}Live}\xspace
+ \href{http://www.tug.org/texlive/}{\TeX{}\c_space_tl{}Live}
}
\NewDocumentCommand{\miktex}{ }
{
- \href{http://www.tug.org/texlive/}{MiK\TeX}\xspace
+ \href{http://www.tug.org/texlive/}{MiK\TeX}
}
\NewDocumentCommand{\linux}{ }
{
- Linux\index{Linux}\xspace
+ Linux\index{Linux}
}
\NewDocumentCommand{\macos}{ }
{
- Mac OS\index{Mac OS}\xspace
+ Mac OS\index{Mac OS}
}
\NewDocumentCommand{\windows}{ }
{
- Windows\index{Windows}\xspace
+ Windows\index{Windows}
}
%
\cs_new_protected:Nn \_@@_links:nnn
@@ -2056,8 +2067,8 @@ This work consists of the file denisbdoc.dtx
% pasted as they are, and not replaced by "h" and "i"
% (cf. \url{https://tex.stackexchange.com/q/18146/18401}).
% \begin{macrocode}
-\newunicodechar{〈}{$\langle$}
-\newunicodechar{〉}{$\rangle$}
+\newunicodechar{⟨}{$\langle$}
+\newunicodechar{⟩}{$\rangle$}
% \end{macrocode}
%
% \begin{macrocode}
@@ -2687,11 +2698,10 @@ Nouv.~:}~#1}
% \PrintIndex
\endinput
-% Local Variables:
-% mode: doctex
-% eval: (doctex-mode)
-% TeX-engine: xetex
-% TeX-command-default: "TeX"
-% TeX-master: t
-% ispell-local-dictionary: "francais"
-% End:
+%%% Local Variables:
+%%% mode: doctex
+%%% TeX-engine: luatex
+%%% TeX-command-default: "TeX"
+%%% TeX-master: t
+%%% ispell-local-dictionary: "francais"
+%%% End:
diff --git a/macros/latex/contrib/easybook/easybook.dtx b/macros/latex/contrib/easybook/easybook.dtx
index fa75daded4..de0745cb46 100644
--- a/macros/latex/contrib/easybook/easybook.dtx
+++ b/macros/latex/contrib/easybook/easybook.dtx
@@ -1,5 +1,5 @@
%
-% Copyright (C) 2021 by Yi Qu <q1jx@foxmail.com>
+% Copyright (C) 2021 by Qu Yi <q1jx@foxmail.com>
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either
@@ -15,7 +15,7 @@
%<*class>
\NeedsTeXFormat{LaTeX2e}[2020/10/01]
\RequirePackage{l3keys2e}
-\ProvidesExplClass{easybook}{2021/10/10}{1.3H}
+\ProvidesExplClass{easybook}{2021/10/12}{1.3I}
{Typeset Chinese theses or books}
\bool_set_false:N \l__eb_compile_draft_bool
@@ -319,7 +319,7 @@
%<*package>
\NeedsTeXFormat{LaTeX2e}[2020/10/01]
\RequirePackage{l3keys2e,etoolbox}
-\ProvidesExplPackage{easybase}{2021/10/10}{1.3H}
+\ProvidesExplPackage{easybase}{2021/10/12}{1.3I}
{Typeset Chinese theses or books}
\cs_generate_variant:Nn \dim_set:Nn { NV }
@@ -1967,7 +1967,7 @@
postheadspace = 1em,
notebraces = {(}{)},
within = \bool_if:NT \l__eb_class_book_bool { chapter },
- headformat = \NAME\space\NUMBER\NOTE
+ headformat = \NAME\NUMBER\NOTE
}
\eb_at_end_preamble:n
{
@@ -2385,7 +2385,7 @@
}
%</package>
%<*tcolorbox>
-\ProvidesExplFile{eb-tcolorbox.cfg}{2021/10/10}{1.3H}
+\ProvidesExplFile{eb-tcolorbox.cfg}{2021/10/12}{1.3I}
{Customization of tcolorbox for easybook}
\tl_gset:Nn \eb@tc@line@skip { 0.5\baselineskip }
diff --git a/macros/latex/contrib/easybook/easybook.ins b/macros/latex/contrib/easybook/easybook.ins
index 7088d8688f..f664159f9f 100644
--- a/macros/latex/contrib/easybook/easybook.ins
+++ b/macros/latex/contrib/easybook/easybook.ins
@@ -1,5 +1,5 @@
%
-% Copyright (C) 2021 by Yi Qu <q1jx@foxmail.com>
+% Copyright (C) 2021 by Qu Yi <q1jx@foxmail.com>
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either
@@ -19,7 +19,7 @@
\usedir{tex/latex/easybook}
\preamble
-Copyright (C) 2021 by Yi Qu <q1jx@foxmail.com>
+Copyright (C) 2021 by Qu Yi <q1jx@foxmail.com>
This work may be distributed and/or modified under the
conditions of the LaTeX Project Public License, either
diff --git a/macros/latex/contrib/easybook/easybook.pdf b/macros/latex/contrib/easybook/easybook.pdf
index 65946962f3..70e56cf528 100644
--- a/macros/latex/contrib/easybook/easybook.pdf
+++ b/macros/latex/contrib/easybook/easybook.pdf
Binary files differ
diff --git a/macros/latex/contrib/easybook/easybook.tex b/macros/latex/contrib/easybook/easybook.tex
index 52c0a6f0c3..6989848387 100644
--- a/macros/latex/contrib/easybook/easybook.tex
+++ b/macros/latex/contrib/easybook/easybook.tex
@@ -6,14 +6,22 @@
enumitem,newtxmath,indentfirst,tabularray,
fancyvrb,geometry,hologo,pifont
}
-\colorlet{cnltxred}{violet}
+\definecolorscheme{blue}
+ {
+ cs => purple,
+ option => cnltxgreen,
+ cnltx => cnltxblue,
+ link => cnltxblue,
+ module => violet,
+ meta => black
+ }
\setcnltx
{
name = easybook,
color-scheme = blue,
title = EASYBOOK 使用手册,
- version = v1.3H,
- date = 2021/10/10,
+ version = v1.3I,
+ date = 2021/10/12,
authors = 瞿毅,
info = 排版简体中文学位论文和书籍,
email = q1jx@foxmail.com,
@@ -24,6 +32,7 @@
},
arg-format = \normalfont\small\itshape,
abstract-format = \small,
+ module-sep = \,$\Rightarrow$\,,
title-format = \huge\sffamily
}
\KOMAoptions{headsepline = 0.6pt,numbers = noenddot}
@@ -62,6 +71,7 @@
\IfBooleanTF{#2}{#4}{\IfBooleanTF{#1}{\Marg{#4}}{\splitmarg{#4}}}
}
}
+\newarg[\color{violet}\code]\Carg{\{}{\}}
\newsplitarg{\splitoarg}{[}{]}
\newsplitarg{\splitdarg}{(}{)}
\newsplitarg{\splitmarg}{\{}{\}}
@@ -297,7 +307,7 @@
\begin{options}
\kvsplit{biname}{英文目录前名字,英文目录后名字}\Module{chapter}\Default{Chapter\cs*{space}}
更改英文目录 \code{chapter} 级别的标题编号前后名字,类似于 C\TeX 的 \option*{name} 选项。
- \keyval-{binmuber}{英文目录数字输出命令}\Module{chapter}\Default{\cs*{arabic}\Marg{chapter}}
+ \keyval-{binmuber}{英文目录数字输出命令}\Default{\cs*{arabic}\Carg{chapter}}
更改英文目录 \code{chapter} 级别的标题编号输出格式,类似于 C\TeX 的 \option*{number} 选项。
\end{options}
@@ -376,7 +386,7 @@
统一调整页眉、定理盒子以及代码框等线条的粗细。
\keybool{uppercase}\Default{true}
使用 \cs*{rightmark} 及 \cs*{leftmark} 标题标记命令获取标题内容时英文是否大写。
- \kvsplit{brackets}{左括号,右括号}\Default{\Marg{(,)}}
+ \kvsplit{brackets}{左括号,右括号}\Default{\Carg{(,)}}
设置行间公式编号标签的括号,以英文逗号分隔,分别代表左右括号。
\kvsplit*{figurepath}{\meta{路径名1}\code{\}\{}\meta{路径名2}}\Default
设置插入图片的文件夹路径名,可以有多个路径名,每个路径包含在括号分隔,只有一个路径时需要包含在两层括号内。
@@ -384,15 +394,15 @@
\subsubsection{连接符}
\begin{options}
- \keyval-{figure-con}{图片连接符}\Module{style}\Default{\Marg{.}}
+ \keyval-{figure-con}{图片连接符}\Module{style}\Default{\Carg{.}}
设置图片题注编号的连接符。
- \keyval-{table-con}{表格连接符}\Default{\Marg{.}}
+ \keyval-{table-con}{表格连接符}\Default{\Carg{.}}
设置表格题注编号的连接符。
- \keyval-{listing-con}{代码连接符}\Default{\Marg{.}}
+ \keyval-{listing-con}{代码连接符}\Default{\Carg{.}}
设置代码题注编号的连接符。
- \keyval-{equation-con}{公式连接符}\Default{\Marg{.}}
+ \keyval-{equation-con}{公式连接符}\Default{\Carg{.}}
设置公式题注编号的连接符。
- \keyval-{number-con}{连接符}\Default{\Marg{.}}
+ \keyval-{number-con}{连接符}\Default{\Carg{.}}
统一设置上述所有编号的连接符。
\end{options}
@@ -485,7 +495,7 @@
\begin{options}
\keychoice{backend}{bibtex,biblatex}\Module{bibset}\Default{bibtex}
参考文献处理后端,默认用传统的 \hologo{BibTeX} 处理参考文献\footnote{使用 \hologo{BibTeX} 引擎时加载 \pkg*{natbib} 宏包,使用 \hologo{biber} 时将加载 \pkg*{biblatex} 宏包。}。
- \keychoice{bib-style}{numerical,authoryear,其它格式}\Default{numerical}
+ \keychoice{bib-style}{numerical,authoryear,other sty}\Default{numerical}
参考文献格式为中国的参考文献推荐标准 GB/T 7714-2015,有顺序编码制和著者-出版年制两种风格,理工科类一般使用顺序编码制,文科类一般使用著者-出版年制。若使用其它格式,使用 \hologo{BibTeX} 处理时需确保正确的 \code{bst} 文件,使用 \hologo{biber} 处理可使用 \pkg*{biblatex} 宏包支持的参考文献风格名称。
\keyval-{cite-style}{标注风格}\Default
标注参考文献的风格,选项 \keyis-{backend}{bibtex} 下可使用 \option{super}(数字上标标注,默认)或 \option{numbers}(数字标注)等 \pkg*{natbib} 宏包带有的标注风格,选项 \keyis-{backend}{biblatex} 下可使用 \pkg*{biblatex} 宏包支持的标注风格名称。
@@ -527,7 +537,7 @@
\begin{options}
\keybool{thmbox}\Module{thmset}\Default{false}
给定理环境使用彩色盒子。这个特殊选项在 \module*{thmset} 模块中使用 \pkg*{tcolorbox} 宏包来支持,\meta{盒子风格} 默认为 \code{tc-theorem}。新建定理命令的同名选项则包括 \code{L}、\code{M} 和 \code{S} 三个参数。
- \keychoice{within}{chapter,section,其它环境,空置}\Default{chapter}
+ \keychoice{within}{chapter,section,env,empty}\Default{chapter}
定理编号跟随的计数器,默认跟随章的编号,也可以跟随其它定理环境的编号,当计数器增加时定理编号会从零开始,空置时不跟随其它计数器编号。
\keyval-{headpunct}{代码}\Default
紧随定理标题末尾的标记代码,位于定理第一段内容的间距 \option{postheadspace} 之前,可以是字符或插入换行符 \cs*{newline} 等命令。
@@ -535,7 +545,7 @@
定理内容部分的字体,包括字体族、字体系列、字体尺寸和字体形状命令。
\keyval-{notefont}{字体命令}\Default
定理题注部分的字体,包括字体族、字体系列、字体尺寸和字体形状命令。
- \keyval-{headfont}{字体命令}\Default{\cs*{color}\Marg{ctex@emph}\cs*{sffamily}}
+ \keyval-{headfont}{字体命令}\Default{\cs*{color}\Carg{ctex@emph}\cs*{sffamily}}
定理标题部分的字体,包括字体族、字体系列、字体尺寸和字体形状命令。
\keyval-{headindent}{刚性长度}\Default{0em}
定理标题的缩进,默认无缩进,可用 \cs*{parindent} 命令设置为段落缩进。
@@ -545,9 +555,9 @@
定理环境后的间距,使用 \pkg*{tcolorbox} 的盒子环境包装后被覆盖。
\keyval-{postheadspace}{刚性长度}\Default{1em}
定理标题后与定理第一段内容的间距。
- \kvsplit*{notebraces}{\meta{左括号}\code{\}\{}\meta{右括号}}\Default{\Marg{(}\Marg{)}}
+ \kvsplit*{notebraces}{\meta{左括号}\code{\}\{}\meta{右括号}}\Default{\Carg{(}\Carg{)}}
设置定理题注两边的括号,两个必选参数分别代表左括号和右括号。
- \keyval-{headformat}{标题排列}\Default{\cs*{NAME}\cs*{space}\cs*{NUMBER}\cs*{NOTE}}
+ \keyval-{headformat}{标题排列}\Default{\cs*{NAME}\cs*{NUMBER}\cs*{NOTE}}
定理标题各组成元素的位置排列和格式。定理标题由定理名、编号和题注组成,\meta{标题排列} 中参数 \cs*{NAME}、\cs*{NUMBER} 和 \cs*{NOTE} 分别代表定理名、编号和题注。
\end{options}
@@ -634,7 +644,7 @@
标题标记命令 \cs*{sectionmark} 的内容,包括了标签选项 \option{sec-label} 的内容。
\keyval-{subsec-mark}{标题标记}
标题标记命令 \cs*{subsectionmark} 的内容,包括了标签选项 \option{subsec-label} 的内容。
- \kvsplit-{chap-label}{\oarg{数字输出命令}\marg{距离命令}}\Default{\cs*{hspace}\Marg{1em}}
+ \kvsplit-{chap-label}{\oarg{数字输出命令}\marg{距离命令}}\Default{\cs*{hspace}\Carg{1em}}
标题标记命令 \cs*{chaptermark} 内容的标签(标题有编号时),比标题标记选项更常用,可选参数是对应于章节编号计数器的输出命令,必选参数是编号与标题之间的距离命令:
\begin{ctexexam}
\hdrset
@@ -643,9 +653,9 @@
sec-mark = \CTEXifname{\CTEXthesection——}{}#1
}
\end{ctexexam}
- \kvsplit-{sec-label}{\oarg{数字输出命令}\marg{距离命令}}\Default{\cs*{hspace}\Marg{0.5em}}
+ \kvsplit-{sec-label}{\oarg{数字输出命令}\marg{距离命令}}\Default{\cs*{hspace}\Carg{0.5em}}
标题标记命令 \cs*{sectionmark} 内容的标签,用法与 \option{chap-label} 类似。
- \kvsplit-{subsec-label}{\oarg{数字输出命令}\marg{距离命令}}\Default{\cs*{hspace}\Marg{0.5em}}
+ \kvsplit-{subsec-label}{\oarg{数字输出命令}\marg{距离命令}}\Default{\cs*{hspace}\Carg{0.5em}}
标题标记命令内容 \cs*{subsectionmark} 的标签,用法与 \option{chap-label} 类似。
\keyval-{headrule}{横线命令}
绘制页眉横线的选项,可以使用 \cs*{hrule}、\cs*{rule} 或下述 \cs{markrule} 等画线命令来绘制横线。手动绘制横线时线条粗细选项 \module*{style/}\option{rulewidth} 会失效。
@@ -700,7 +710,7 @@
\end{ctexexam}
\keychoice{fnmark-pos}{normal,super}\Default{super}
设置脚注内容标记的位置,正常文本或是上标形式。
- \keychoice{fnmark-num}{plain,pifont,pifont*,pifont-sans,pifont-sans*,短编号}\Default{plain}
+ \keychoice{fnmark-num}{plain,pifont,pifont*,pifont-sans,pifont-sans*,short num}\Default{plain}
脚注正文标记编号的格式,默认为原生样式 \code{plain},还可以改为 \code{pifont} 的各个版本,从左往右依次为普通版、阴文衬线版、阳文无衬线版和阴文无衬线版,缺点是它们的编号仅包括 1-10。
短编号的形式与列表环境类似,不过增加了一个中文数字格式参数 \code{c}。原生样式 \code{plain} 等同于单独使用数字 \code{1} 参数。这个选项可以用在正文中改变其后脚注编号格式。
@@ -708,9 +718,9 @@
\hdrset{fnmark-num = 1} % 等于编号格式plain
\hdrset{fnmark-num = (a)}
\end{ctexexam}
- \keychoice{fntext-num}{plain,pifont,pifont*,pifont-sans,pifont-sans*,短编号}\Default{plain}
+ \keychoice{fntext-num}{plain,pifont,pifont*,pifont-sans,pifont-sans*,short num}\Default{plain}
脚注内容标记编号的格式,用法与 \option{fnmark-num} 一样,所以脚注内容与正文标记编号格式\textbf{可以不同}。
- \keychoice{fnboth-num}{plain,pifont,pifont*,pifont-sans,pifont-sans*,短编号}\Default{plain}
+ \keychoice{fnboth-num}{plain,pifont,pifont*,pifont-sans,pifont-sans*,short num}\Default{plain}
同时设定脚注正文标记编号 \option{fnmark-num} 与脚注内容标记编号 \option{fntext-num} 的格式。目前脚注编号格式选项对于迷你页环境 \env*{minipage} 无效,其中的脚注保持默认英文字母的编号形式。
\keyval-{fnmark-form}{格式代码}\Default
脚注标记的格式,一般配合选项 \keyis-{fnmark-num}{plain} 使用,例如配合 \pkg*{circledsteps} 宏包的带圈符号命令 \cs*{Circled} 给脚注标记添加圆圈:
@@ -953,7 +963,7 @@
习题标题盒子背景颜色,可以使用 \pkg*{xcolor} 自定义颜色或使用色库。
\keyval-{title}{环境标题}\Default{习题}
习题的标题,可以匹配中英文模式,习题环境使用 \parg{} 参数时无效。
- \keyval-{number}{习题编号格式}\Default{\Marg{1.}}
+ \keyval-{number}{习题编号格式}\Default{\Carg{1.}}
标题编号输出选项 \option{number} 为短编号形式,应当包含 \code{A}、\code{a}、\code{I}、\code{i}、或 \code{1} 其中一个符号。
\keyval-{numsep}{编号与标题的间距}\Default{0.5em}
习题标题编号与后方标题文本的间距,习题环境使用星号参数时无效。
@@ -1111,7 +1121,7 @@
\begin{options}
\keyval-{width}{符号宽度}\Default{2em}
设置适当的符号宽度可以防止文字重叠和边界溢出等问题。
- \keyval-{delim}{引导符}\Default{\Marg{——}}
+ \keyval-{delim}{引导符}\Default{\Carg{——}}
全局的符号对照引导符,\cs{symb} 局部的 \meta{引导符} 和对齐方式是基于这个符号的宽度。
\keyval-{space}{符号间隙}\Default{0.25em}
符号间隙为引导符两侧与符号和说明文字间的距离。
diff --git a/macros/latex/contrib/nwejm/README.md b/macros/latex/contrib/nwejm/README.md
index a4a1e3ee1d..ac9ca0586c 100644
--- a/macros/latex/contrib/nwejm/README.md
+++ b/macros/latex/contrib/nwejm/README.md
@@ -8,7 +8,7 @@ new journal "North-Western European Journal of Mathematics".
Release
-------
-2020-03-18 v1.0.1
+2021-10-12 v1.0.2
Development
-----------
diff --git a/macros/latex/contrib/nwejm/doc/examples/article-in-dutch.pdf b/macros/latex/contrib/nwejm/doc/examples/article-in-dutch.pdf
index 7feb9e7aec..58642fe609 100644
--- a/macros/latex/contrib/nwejm/doc/examples/article-in-dutch.pdf
+++ b/macros/latex/contrib/nwejm/doc/examples/article-in-dutch.pdf
Binary files differ
diff --git a/macros/latex/contrib/nwejm/doc/examples/article-in-english.pdf b/macros/latex/contrib/nwejm/doc/examples/article-in-english.pdf
index d2903f5369..be7d4dbd55 100644
--- a/macros/latex/contrib/nwejm/doc/examples/article-in-english.pdf
+++ b/macros/latex/contrib/nwejm/doc/examples/article-in-english.pdf
Binary files differ
diff --git a/macros/latex/contrib/nwejm/doc/examples/article-in-french.pdf b/macros/latex/contrib/nwejm/doc/examples/article-in-french.pdf
index 41d01bc30f..15decf8727 100644
--- a/macros/latex/contrib/nwejm/doc/examples/article-in-french.pdf
+++ b/macros/latex/contrib/nwejm/doc/examples/article-in-french.pdf
Binary files differ
diff --git a/macros/latex/contrib/nwejm/doc/examples/article-in-german.pdf b/macros/latex/contrib/nwejm/doc/examples/article-in-german.pdf
index 6efa40cd70..f7f8fb9e3f 100644
--- a/macros/latex/contrib/nwejm/doc/examples/article-in-german.pdf
+++ b/macros/latex/contrib/nwejm/doc/examples/article-in-german.pdf
Binary files differ
diff --git a/macros/latex/contrib/nwejm/doc/examples/issue.pdf b/macros/latex/contrib/nwejm/doc/examples/issue.pdf
index accb174241..e16f6d58f1 100644
--- a/macros/latex/contrib/nwejm/doc/examples/issue.pdf
+++ b/macros/latex/contrib/nwejm/doc/examples/issue.pdf
Binary files differ
diff --git a/macros/latex/contrib/nwejm/doc/examples/sample.pdf b/macros/latex/contrib/nwejm/doc/examples/sample.pdf
index f88087ab2c..af2d60cdaf 100644
--- a/macros/latex/contrib/nwejm/doc/examples/sample.pdf
+++ b/macros/latex/contrib/nwejm/doc/examples/sample.pdf
Binary files differ
diff --git a/macros/latex/contrib/nwejm/doc/nwejm-fr.pdf b/macros/latex/contrib/nwejm/doc/nwejm-fr.pdf
index 904ea3ea75..7bcce82706 100644
--- a/macros/latex/contrib/nwejm/doc/nwejm-fr.pdf
+++ b/macros/latex/contrib/nwejm/doc/nwejm-fr.pdf
Binary files differ
diff --git a/macros/latex/contrib/nwejm/source/nwejm.dtx b/macros/latex/contrib/nwejm/source/nwejm.dtx
index 01bab653f0..86bfb0627b 100644
--- a/macros/latex/contrib/nwejm/source/nwejm.dtx
+++ b/macros/latex/contrib/nwejm/source/nwejm.dtx
@@ -13,7 +13,7 @@ new journal "North-Western European Journal of Mathematics".
Release
-------
-2020-03-18 v1.0.1
+2021-10-12 v1.0.2
Development
-----------
@@ -44,7 +44,7 @@ https://github.com/dbitouze/nwejm.
\input l3docstrip.tex
\Msg{********************************************************}
\Msg{* Installation}
-\Msg{* Class: nwejm 2020-03-18 v1.0.1}
+\Msg{* Class: nwejm 2021-10-12 v1.0.2}
\Msg{* for the journal}
\Msg{* "North-Western European Journal of Mathematics" (DB)}
\Msg{********************************************************}
@@ -61,7 +61,7 @@ License:| Released under the LaTeX Project Public License v1.3c or later
\endpreamble
\postamble
-Copyright (C) 2015-2020 by Denis Bitouze <denis.bitouze@univ-littoral.fr>
+Copyright (C) 2015-2021 by Denis Bitouze <denis.bitouze@univ-littoral.fr>
This work may be distributed and/or modified under the
conditions of the LaTeX Project Public License (LPPL), either
@@ -174,6 +174,12 @@ Running "make install" installs the files in the local TeX tree.
%
%\maketitle
%
+% \changes{v1.0.2}{2021-10-12}{%
+% \begin{itemize}
+% \item Fix gh \#4 (\url{https://git.io/JKLYW}).
+% \item Fix bug in case of other engine than \hologo{pdfTeX}.
+% \end{itemize}
+% }%
% \changes{v1.0.1}{2020-03-18}{%
% \begin{itemize}
% \item Fix bugs due to \Package{expl3} changes.
@@ -317,8 +323,8 @@ Running "make install" installs the files in the local TeX tree.
\ProvidesExplClass
%<class> {nwejm}
%<class-article> {nwejmart}
- {2020-03-18}
- {1.0.1}
+ {2021-10-12}
+ {1.0.2}
{
Class for the journal "North-Western European Journal of Mathematics".
}
@@ -373,8 +379,8 @@ Running "make install" installs the files in the local TeX tree.
can~be~used~only~in~document~body~and~not~in~preamble!}%
\msg_new:nnn{nwejmart}{Article~setup~not~consistent}{The~ article~ setup~
concerning~ the~ option~ `#1'~ has~ changed~ after~ its~ 1st~ use.~ Please~
- use~ \articlesetup~ command~ just~ once,~ just~ after~ the~ beginning~ of~
- the~ document.}%
+ use~ `\string\articlesetup'~ command~ just~ once,~ just~ after~ the~
+ beginning~ of~ the~ document.}%
\msg_new:nnn{
%<class-article> nwejmart
%<class> nwejm
@@ -442,13 +448,11 @@ Running "make install" installs the files in the local TeX tree.
\bool_gset_true:N \g_@@_language_specified_bool%
\PassOptionsToPackage{main=#1}{babel}
\PassOptionsToPackage{#1}{varioref}
- \AtBeginDocument{
+ \AddToHook{begindocument/before}{%
\LoadDictionaryFor{#1}{nwejm}
- }
- \AtEndPreamble{%
\FCloadlang{#1}
}
- \AfterEndPreamble{%
+ \AddToHook{begindocument/end}{%
\selectlanguage{#1}
}
}
@@ -574,7 +578,7 @@ Running "make install" installs the files in the local TeX tree.
% We load the dictionaries containing the translations needed for theorems and
% the like.
% \begin{macrocode}
-\AtBeginDocument{
+\AddToHook{begindocument/before}{
\LoadDictionaryFor{french}{nwejm}
\LoadDictionaryFor{english}{nwejm}
\LoadDictionaryFor{dutch}{nwejm}
@@ -608,23 +612,37 @@ Running "make install" installs the files in the local TeX tree.
\RequirePackage[l2tabu,orthodox]{nag}
% \end{macrocode}
%
-% \item In case of \hologo{pdfTeX} engine, we enforce \pkg{inputenc} to be
-% loaded with its \docAuxKey*{utf8} option. Otherwise \pkg{fontspec},
-% convenient for both \hologo{XeLaTeX} and \hologo{LuaLaTeX}, is loaded with
-% ligatures à la \TeX{} by default enabled.
+% \item In case of \hologo{pdfTeX} engine, we enforce \pkg{fontenc} to be
+% loaded with its \docAuxKey*{T1} option. Otherwise \pkg{fontspec},
+% convenient for both \hologo{XeLaTeX} and \hologo{LuaLaTeX}, is loaded by the
+% \pkg{unicode-math} package.
% \begin{macrocode}
\sys_if_engine_pdftex:TF
- {
- \RequirePackage[utf8]{inputenc}
- }{
- \RequirePackage{fontspec}
- \DeclareTextCommandDefault{\nobreakspace}{\leavevmode\nobreak\ }
- }
+{
% \end{macrocode}
%
% \item Standard package for selecting font encodings:
% \begin{macrocode}
-\RequirePackage[T1]{fontenc}
+ \RequirePackage[T1]{fontenc}
+% \end{macrocode}
+%
+% \item Load of main font to be used:
+% \begin{macrocode}
+ \RequirePackage[easyscsl,noDcommand]{kpfonts}
+}{
+% \end{macrocode}
+%
+% \item Unicode mathematics support for \hologo{XeTeX} and \hologo{LuaTeX}:
+% \begin{macrocode}
+ \RequirePackage{unicode-math}
+% \end{macrocode}
+%
+% \item OTF version of the Kp-fonts for both roman and sans-serif font, but
+% LatinModern for the monospaced one.
+% \begin{macrocode}
+ \RequirePackage[noDcommand]{kpfonts-otf}
+ \setmonofont[Scale = MatchLowercase]{Latin Modern Mono}
+}
% \end{macrocode}
%
% \item Formatting both header and footers (pagestyle), and sections headers:
@@ -704,9 +722,7 @@ Running "make install" installs the files in the local TeX tree.
% \end{macrocode}
%
% \item Extension to \Pkg{amsmath}: correct various bugs/defeciencies in amsmath
-% and useful tools for mathematical typesetting\footnote{The \Pkg{mathtools}
-% loads \pkg{amsmath}, hence it's not necessary to load the
-% latter. It has to be loaded before \pkg{datatool} and \pkg{kpfonts}.}:
+% and useful tools for mathematical typesetting:
% \begin{macrocode}
\RequirePackage{mathtools}
% \end{macrocode}
@@ -716,22 +732,11 @@ Running "make install" installs the files in the local TeX tree.
\RequirePackage[amsmath,thmmarks,fleqn]{ntheorem}
% \end{macrocode}
%
-% \item Support for using RSFS fonts in maths:
-% \begin{macrocode}
-\RequirePackage{rsfso}
-% \end{macrocode}
-%
% \item Vector arrows:
% \begin{macrocode}
\RequirePackage{esvect}
% \end{macrocode}
%
-% Load of main font to be used:
-% \begin{macrocode}
-\RequirePackage[easyscsl,noDcommand]{kpfonts}
-% %<class-article>\RequirePackage[noDcommand]{kpfonts}
-% \end{macrocode}
-%
% \item Flexible and easy interface to page dimensions:
% \begin{macrocode}
\RequirePackage{geometry}
@@ -909,7 +914,7 @@ Running "make install" installs the files in the local TeX tree.
% \item Hypertext marks:
% \begin{macrocode}
\RequirePackage[pdfencoding=unicode,final]{hyperref}%
-\AtEndPreamble{%
+\AddToHook{begindocument/before}{%
\hypersetup{hidelinks,hypertexnames=false,breaklinks}%
}%
% \end{macrocode}
@@ -1872,7 +1877,7 @@ Running "make install" installs the files in the local TeX tree.
% \begin{macrocode}
\box_new:N \l_@@_journal_logo_box
\box_new:N \l_@@_journal_name_box
- \AfterEndPreamble{%
+ \AddToHook{begindocument/end}{%
\hbox_set:Nn \l_@@_journal_name_box
{
\bfseries%
@@ -1937,7 +1942,7 @@ Running "make install" installs the files in the local TeX tree.
% \end{itemize}
%
% \begin{macrocode}
-\AtBeginDocument{%
+\AddToHook{begindocument}{%
\graphicspath{{\c_@@_issue_images_path_string_tl//}{../\c_@@_issue_images_path_string_tl//}}
% \glsdisablehyper
}
@@ -1955,7 +1960,7 @@ Running "make install" installs the files in the local TeX tree.
% to be different.
% \end{itemize}
% \begin{macrocode}
-%<class-article> \AfterEndPreamble{\g_@@_mainmatter_switch_tl}
+%<class-article> \AddToHook{begindocument/end}{\g_@@_mainmatter_switch_tl}
% \end{macrocode}
%
% \section{Options}
@@ -2737,10 +2742,10 @@ Running "make install" installs the files in the local TeX tree.
rectangle (current~page.south~east);
% laboratory logo
\node[anchor=south~east] at ([xshift=-10mm]current~page~text~area.south~east)
- {\includegraphics[height=.66\c_@@_logos_rectangle_height_dim]{logo-painleve}} ;
+ {\includegraphics[height=.5\c_@@_logos_rectangle_height_dim]{logo-painleve}} ;
% university logo
\node[anchor=south~west] at (current~page~text~area.south~west)
- {\includegraphics[height=.66\c_@@_logos_rectangle_height_dim]{logo-ul1-ufr-math}} ;
+ {\includegraphics[height=.5\c_@@_logos_rectangle_height_dim]{ul-fst-math}} ;
% crop marks
\draw [white]
([xshift=2.5mm]current~page~text~area.north~east) --
@@ -2872,7 +2877,7 @@ Running "make install" installs the files in the local TeX tree.
%<class-article>
%<class-article>\file_if_exist:nT { \c_@@_main_file_name_tl.aux }
%<class-article>{\externaldocument[@@-]{\c_@@_main_file_name_tl}
-%<class-article> \AfterEndPreamble{\setcounter{page}{\number\numexpr\getpagerefnumber{@@-\currfilebase}}}
+%<class-article> \AddToHook{begindocument/end}{\setcounter{page}{\number\numexpr\getpagerefnumber{@@-\currfilebase}}}
%<class-article>}
% \end{macrocode}
%
@@ -3292,6 +3297,14 @@ Running "make install" installs the files in the local TeX tree.
}
% \end{macrocode}
%
+% \begin{macrocode}
+%</class|class-article>
+% \end{macrocode}
+%
+% \begin{macrocode}
+%<*class>
+% \end{macrocode}
+%
% \subsection{Input variant}
%
% We create a variant of the "\input" macro to be use for the input of each
@@ -3301,6 +3314,7 @@ Running "make install" installs the files in the local TeX tree.
% \url{https://tex.stackexchange.com/q/475788/18401}).
% \begin{macrocode}
\NewDocumentCommand \inputarticle { O{english} m } {%
+ \int_gincr:N \g_@@_articles_int
\newrefsection
\renewcommand*{\glspluralsuffix}{s}
\renewcommand*{\glsacrpluralsuffix}{\glspluralsuffix}
@@ -3309,6 +3323,7 @@ Running "make install" installs the files in the local TeX tree.
\str_case:nn {#1} {
{english} {
\selectlanguage{english}
+ % \shorthandoff{"}%
\renewcommand*{\glossaryname}{Glossary}%
\renewcommand*{\acronymname}{Acronyms}%
\renewcommand*{\entryname}{Notation}%
@@ -3320,6 +3335,7 @@ Running "make install" installs the files in the local TeX tree.
}
{german} {
\selectlanguage{ngerman}
+ % \shorthandon{"}%
\renewcommand*{\glossaryname}{Glossar}%
\renewcommand*{\acronymname}{Akronyme}%
\renewcommand*{\entryname}{Bezeichnung}%
@@ -3331,6 +3347,7 @@ Running "make install" installs the files in the local TeX tree.
}
{ngerman} {
\selectlanguage{ngerman}
+ % \shorthandon{"}%
\renewcommand*{\glossaryname}{Glossar}%
\renewcommand*{\acronymname}{Akronyme}%
\renewcommand*{\entryname}{Bezeichnung}%
@@ -3342,6 +3359,7 @@ Running "make install" installs the files in the local TeX tree.
}
{french} {
\selectlanguage{french}
+ % \shorthandoff{"}%
% \end{macrocode}
%
% Though we switch to \pkg{babel}'s ×french×, footnotes are not displayed as
@@ -3363,6 +3381,7 @@ Running "make install" installs the files in the local TeX tree.
}
{dutch} {
\selectlanguage{dutch}
+ % \shorthandon{"}%
\renewcommand*{\glossaryname}{Woordenlijst}%
\renewcommand*{\acronymname}{Acroniemen}%
\renewcommand*{\entryname}{Benaming}%
@@ -3406,6 +3425,11 @@ Running "make install" installs the files in the local TeX tree.
}
}
% \end{macrocode}
+% We ensure the sections' counter will be printed as arabic numerals (in case
+% ×\appendix× has been used in a previous article):
+% \begin{macrocode}
+ \gdef\thesection{\@arabic\c@section}
+% \end{macrocode}
% We reset all acronyms entries.
% \begin{macrocode}
\glsresetall
@@ -3413,6 +3437,14 @@ Running "make install" installs the files in the local TeX tree.
}
% \end{macrocode}
%
+% \begin{macrocode}
+%</class>
+% \end{macrocode}
+%
+% \begin{macrocode}
+%<*class|class-article>
+% \end{macrocode}
+%
% \section{(Re)Definition of document commands that identify the article}
%
% The names of the authors of the different articles will appear at several
@@ -3424,7 +3456,7 @@ Running "make install" installs the files in the local TeX tree.
% This can be done only at the beginning of the document, in order to know the
% characteristics of the current issue.
% \begin{macrocode}
-\AtBeginDocument{%
+\AddToHook{begindocument}{%
% \end{macrocode}
%
% We first create a token list containing the date of the current issue formated
@@ -3476,7 +3508,6 @@ Running "make install" installs the files in the local TeX tree.
% We increment the "\g_@@_articles_int" integer that counts the number of
% articles in order to provide for each of them a unique bibliographic key.
% \begin{macrocode}
- \int_gincr:N \g_@@_articles_int
\tl_gclear:N \g_@@_short_title_tl
\tl_gclear:N \g_@@_header_title_tl
\tl_gclear:N \g_@@_short_subtitle_tl
@@ -3977,7 +4008,7 @@ Running "make install" installs the files in the local TeX tree.
% instead of begin of the document in order some settings needed in preamble are
% taken in account.
% \begin{macrocode}
-%<class>\AtEndPreamble{\file_input:n {\c_@@_configuration_file_string_tl}}
+%<class>\AddToHook{begindocument/before}{\file_input:n {\c_@@_configuration_file_string_tl}}
% \end{macrocode}
%
% \subsection{Miscellaneous}
@@ -4353,7 +4384,7 @@ Running "make install" installs the files in the local TeX tree.
% \begin{macrocode}
\RenewDocumentCommand \newtheorem { O{} m }
{
- \AtBeginDocument{
+ \AddToHook{begindocument}{
\tl_clear:N \l_@@_newtheorem_style_tl
\tl_clear:N \l_@@_newtheorem_title_tl
\tl_clear:N \l_@@_newtheorem_french_title_tl
@@ -4582,7 +4613,7 @@ Running "make install" installs the files in the local TeX tree.
}
}
}
-\AfterEndPreamble{
+\AddToHook{begindocument/end}{
\ifcurrentbaselanguage{french}{\g_@@_french_crefname_tl}{}
}
% \end{macrocode}
@@ -5197,7 +5228,7 @@ Running "make install" installs the files in the local TeX tree.
% breaks fall where they may, even in the middle of a multi-line equation. If
% needed, the ×\\*× command can be used to prohibit a pagebreak after a given line.
% \begin{macrocode}
-\AtEndPreamble{\allowdisplaybreaks}
+\AddToHook{begindocument/before}{\allowdisplaybreaks}
% \end{macrocode}
%
% The drawback of ×\allowdisplaybreaks× macro is it may happen we haven't
@@ -5626,7 +5657,7 @@ Running "make install" installs the files in the local TeX tree.
% header and footer on the page (and the following ones until the next article)
% where the bibliography appears).
% \begin{macrocode}
-\AtEndPreamble{%
+\AddToHook{begindocument/before}{%
\defbibheading{_@@_subbibliography}[\refname]{%
\section*{#1}
}%
@@ -5731,18 +5762,21 @@ Running "make install" installs the files in the local TeX tree.
% is not robust in \pkg{kpfonts} code
% (cf. \url{https://groups.google.com/d/msg/fr.comp.text.tex/hIi97ipK5qA/WJoPwvH-p1UJ}).
% \begin{macrocode}
-\ifkp@easyscsl
-\DeclareRobustCommand{\itshape}{\not@math@alphabet\itshape\mathit%
- \ifthenelse{\equal{\f@shape}{\scdefault}}{\fontshape{scsl}}{%
- \fontshape\itdefault}\selectfont}
-\fi
+\sys_if_engine_pdftex:T
+{
+ \ifkp@easyscsl
+ \DeclareRobustCommand{\itshape}{\not@math@alphabet\itshape\mathit%
+ \ifthenelse{\equal{\f@shape}{\scdefault}}{\fontshape{scsl}}{%
+ \fontshape\itdefault}\selectfont}
+ \fi
% \end{macrocode}
%
% We replace the \pkg{kpfonts}' \enquote{mathfrak} by the one from
% \enquote{eufrak}, as the former doesn't provide Euler Fraktur digits.
% \begin{macrocode}
-\DeclareMathAlphabet\mathfrak{U}{euf}{m}{n}
-\SetMathAlphabet\mathfrak{bold}{U}{euf}{b}{n}
+ \DeclareMathAlphabet\mathfrak{U}{euf}{m}{n}
+ \SetMathAlphabet\mathfrak{bold}{U}{euf}{b}{n}
+}
% \end{macrocode}
%
% \subsection{Related to \Pkg{hyperref}}
@@ -5825,7 +5859,7 @@ Running "make install" installs the files in the local TeX tree.
% \end{macrocode}
%
% \begin{macrocode}
-\AfterEndPreamble{%
+\AddToHook{begindocument/end}{%
% \end{macrocode}
%
% If the cover production is asked, we automatically load some libraries, make
@@ -5855,18 +5889,18 @@ Running "make install" installs the files in the local TeX tree.
% Because articles' title are displayed thanks to the ×\chapter× command, we
% have to format its layout.
% \begin{macrocode}
-\AfterEndPreamble{%
+\AddToHook{begindocument/end}{%
\titleformat{\chapter}[block]
{\normalfont\centering}{}{0pt}{}
\titlespacing*{\chapter}{0pt}{0pt}{0pt}
}
% \end{macrocode}
%
-% \Pkg{xy} performs category code changes of ×@× ×\AtBeginDocument× and this
+% \Pkg{xy} performs category code changes of ×@× ×\AddToHook{begindocument}× and this
% cause troubles (see \url{tex.stackexchange.com/q/303238/18401}). Hence, we
% prohibit it.
% \begin{macrocode}
-\AtEndPreamble{%
+\AddToHook{begindocument/before}{%
\@ifpackageloaded{xy}{%
\msg_error:nn{
%<class-article> nwejmart
@@ -5877,6 +5911,16 @@ Running "make install" installs the files in the local TeX tree.
}
% \end{macrocode}
%
+% % By default, we switch the shorthand character ×"× off used by the Dutch and
+% % German languages as they are source of many troubles, especially with the
+% % ×tikzcd× environments.
+% % \begin{macrocode}
+% \AddToHook{begindocument/end}{%
+% \shorthandoff{"}%
+% \usetikzlibrary{babel}%
+% }
+% % \end{macrocode}
+%
% We now leave the \LaTeX3{} programming environment.
% \begin{macrocode}
\ExplSyntaxOff
@@ -6734,7 +6778,6 @@ $clean_ext = "synctex.gz* run.xml tex.bak bbl bcf fdb_latexmk run tdo listing st
#include:booktabs
#include:mathtools
#include:ntheorem
-#include:rsfso
#include:esvect
#include:kpfonts
#include:translations
@@ -6945,8 +6988,7 @@ dutch
% \Finale
%%% Local Variables:
-%%% mode: tex
-%%% eval: (doctex-mode)
+%%% mode: doctex
%%% ispell-local-dictionary: "english"
%%% TeX-command-default: "TeX"
%%% TeX-master: t
diff --git a/macros/latex/contrib/tugboat/ltubguid.ltx b/macros/latex/contrib/tugboat/ltubguid.ltx
index d2947c0389..da93ceac25 100644
--- a/macros/latex/contrib/tugboat/ltubguid.ltx
+++ b/macros/latex/contrib/tugboat/ltubguid.ltx
@@ -1,4 +1,4 @@
-% $Id: ltubguid.ltx 375 2021-06-25 14:40:52Z karl $
+% $Id: ltubguid.ltx 386 2021-09-28 22:25:51Z karl $
% ltubguid.ltx - documentation for ltugboat classes.
%
% Copyright 1994-2021 TeX Users Group.
@@ -528,11 +528,14 @@ Two caveats about these optional arguments:
defines the \verb|verbatim| environment, as discussed next.
\end{itemize}
-Authors may wish to use a more featureful verbatim package, such as such
-as \pkgname{verbatim}~\cite{Schoepf:verbatim:1996},
-\pkgname{listings}~\cite{pkg:listings}, or
+Authors may wish to use a more featureful verbatim package, such as
+\pkgname{listings}~\cite{pkg:listings} or
\pkgname{fancyvrb}~\cite{pkg:fancyvrb}. This is ok; it just means the
-\TUB\ optional-argument feature is not available.
+\TUB\ optional-argument feature is not available. On the other hand,
+please do not use the \pkgname{minted} package if possible; it is much
+harder to customize and correct at the \TeX\ level, and the shell escape
+requirement is troublesome. In any case, we will almost always wish to
+print code listings in simple black, not colored or even grayscaled.
If you use the \pkgname{listings} package, please specify:
\begin{verbatim}[\small]
@@ -721,21 +724,28 @@ As mentioned above, please load either \texttt{url} or (preferably)
\texttt{hyperref} so that reasonable line breaking of urls can happen.
Furthermore, for the printed (visible) \TUB\ page, nowadays we typically
-omit a leading \texttt{http://} or \texttt{https://}. But for the link
-to actually work in the output \PDF\ or \HTML, the protocol is required
-(or it appears to be a local filesystem path). Therefore the
+prefer to omit a leading \texttt{http://} or \texttt{https://}. But for
+the link to actually work in the output \PDF\ or \HTML, the protocol is
+required (or it appears to be a local filesystem path). Therefore the
\texttt{ltugboat} class provides (as of version 2.23, released
March~2020) commands \cs{tbsurl} for \texttt{https} and \cs{tbhurl} for
-\texttt{http}.\footnote{They are simple two-line wrapper around
-\cs{hyper@linkurl}, and are due to Ulrike Fischer.
+\texttt{http}.\footnote{They are wrappers around \cs{hyper@linkurl}, and
+are due to Ulrike Fischer.
\url{https://github.com/latex3/hyperref/issues/125}\raggedright}
For example, \verb|\tbsurl{tug.org}| typesets the text
`\texttt{tug.org}' (with the usual url line breaks) as a link to
\url{https://tug.org}.
-Similarly, \verb|\tbhurl{mirror.ctan.org}| typesets the text
-`\texttt{mirror.ctan.org}' as a link to \url{http://mirror.ctan.org}.
+Similarly, \verb|\tbhurl{example.org}| typesets the text
+`\texttt{example.org}' as a link to \url{http://example.org}.
+
+The correct protocol can be explicitly specified, and will also be
+stripped for display. That is, \verb|\tbsurl{https://tug.org}| also
+works. This can be particularly useful for bibliographies. However, an
+incorrect protocol (\texttt{http} with \cs{tbsurl} or the converse) will
+not be stripped, and will generate an invalid url. That's ok because
+such an inconsistent specification cannot be handled reliably.
\cs{tbsurl} and \cs{tbhurl} only add the protocol and make live links if
\texttt{hyperref} is loaded. Without \texttt{hyperref}, they are merely
@@ -745,8 +755,8 @@ output, the printed url without the protocol suffices. (When a user
copies/pastes url text into a browser, it will normally work.)
For \texttt{ftp}, \texttt{rsync}, and other protocols, it is best to
-include them explicitly and use \cs{url}:\\ \verb|\url{ftp://tug.org}|,\\
-\verb|\url{rsync://tug.org}|, etc.
+always include them explicitly and use \cs{url}:\\
+\verb|\url{ftp://tug.org}|,\\ \verb|\url{rsync://tug.org}|, etc.
\subsection{Url shortcuts}
\label{sec:urlshortcuts}
@@ -801,7 +811,11 @@ four authors (thanks to Mico Loretan and Oren Patashnik).
\textsf{@inproceedings} allows for citing a part, written by author~X,
of a publication written by author~Y, and not just edited by~Y.
-\item Defines an \textsf{@online} entry type as an alias for \textsf{@misc}.
+\item For the \textsf{@misc} entry type, \textsf{editor} is accepted as
+well as \textsf{author}.
+
+\item Defines entry types \textsf{@online} and \textsf{@software} as
+aliases for \textsf{@misc}.
\item Defines an \textsf{@ctan} entry type to reference packages on
\CTAN, following the fields output by the \pkgname{ctanbib} script (in
@@ -886,7 +900,7 @@ date.
\label{fig:citation-macros}
\end{figure}
-Note that, if Tom, Dick, and Harry are a prolific team, there can
+Furthermore, if Tom, Dick, and Harry are a prolific team, there can
easily be more than one reference to their work in one year. In such
a case, the citations will be (Tom, Dick, and Harry, 1990a), (Tom,
Dick, and Harry, 1990b), and so on. These extra `a', `b', etc., tags
diff --git a/macros/latex/contrib/tugboat/ltubguid.pdf b/macros/latex/contrib/tugboat/ltubguid.pdf
index ea48ea3b36..02091c20d9 100644
--- a/macros/latex/contrib/tugboat/ltubguid.pdf
+++ b/macros/latex/contrib/tugboat/ltubguid.pdf
Binary files differ
diff --git a/macros/latex/contrib/tugboat/tugboat.bst b/macros/latex/contrib/tugboat/tugboat.bst
index 7fadb59d35..806a63ad57 100644
--- a/macros/latex/contrib/tugboat/tugboat.bst
+++ b/macros/latex/contrib/tugboat/tugboat.bst
@@ -1,25 +1,29 @@
-%%% $Id: tugboat.bst 375 2021-06-25 14:40:52Z karl $
+%%% $Id: tugboat.bst 379 2021-08-29 17:31:15Z karl $
%%% TUGboat changes are public domain.
%%%
%%% Modified for TUGboat from abbrvurl.bst:
-%%% New entry types @ctan (see ctanbib) and @online (alias for @misc).
+%%% New entry types: @ctan (see ctanbib);
+%%% @online and @software (aliases for @misc).
+%%% For @misc, the editor field is accepted along with author.
%%% New field bookauthor for @incollection and @inproceedings.
%%% Abbreviate "page(s)" to "p(p).",
%%% "volume" to "vol.",
-%%% "editor(s)" to "ed(s)".
+%%% "editor(s)" to "ed(s).",
+%%% "edition" to "ed.".
%%% Output "Ph.D." rather than "PhD".
%%% Output "No." and "no." for number field.
%%% Omit spaces between author initials, like "A.B. Smith".
-%%% Set urlintro="".
-%%% Always use https://doi.org/ for the doi url, and omit doi: prefix
-%%% (todo: doi urls not linked correctly).
-%%% Truncate long author lists in format.names (max.names, trunc.num)
-%%% and omit "and" from author lists, per Oren P.
+%%% Set urlintro="" and onlinestring="".
+%%% Always use https://doi.org/ for the doi url; omit "doi:" from output.
+%%% Truncate long author lists in format.names (max.names, trunc.num);
+%%% omit "and" from author lists, per Oren P.
%%% Use \emph instead of \em so we get automatic italic corrections.
%%% New fields for editors:
%%% "journaltie" - ~ instead of space after journal name.
%%% "newpage" - force page break after entry;
-%%% "prebibitem" - material output before \bibitem, with newline appended.
+%%% "nowarning" - if set, omit empty field warnings from output.check.
+%%% "prebibitem" - material output before \bibitem, with newline appended
+%%% (for example, section headings).
%%% "urlnewline" - force line break before url value;
%%%
%%% --karl, originally created 24jul18.
@@ -76,8 +80,10 @@ ENTRY
date % ctan
urldate % ctan
version % ctan
+ %
journaltie % tub
newpage % tub
+ nowarning % tub
prebibitem % tub
urlnewline % tub
}
@@ -107,13 +113,13 @@ FUNCTION {init.urlbst.variables}
% String constants, which you _might_ want to tweak.
"" 'urlintro := % prefix before URL; typically "Available from:" or "URL":
- "online" 'onlinestring := % indication that resource is online; typically "online"
+ "" 'onlinestring := % indication that resource is online; typically "online"
"cited " 'citedstring := % indicator of citation date; typically "cited "
"[link]" 'linktextstring := % dummy link text; typically "[link]"
"http://arxiv.org/abs/" 'eprinturl := % prefix to make URL from eprint ref
"arXiv:" 'eprintprefix := % text prefix printed before eprint ref; typically "arXiv:"
"https://doi.org/" 'doiurl := % prefix to make URL from DOI
- "doi:" 'doiprefix := % text prefix printed before DOI ref; typically "doi:"
+ "" 'doiprefix := % text prefix printed before DOI ref; typically "doi:"
"http://www.ncbi.nlm.nih.gov/pubmed/" 'pubmedurl := % prefix to make URL from PUBMED
"PMID:" 'pubmedprefix := % text prefix printed before PUBMED ref; typically "PMID:"
@@ -318,7 +324,12 @@ FUNCTION {output}
FUNCTION {output.check}
{ 't :=
duplicate$ empty$
- { pop$ "empty " t * " in " * cite$ * warning$ }
+ { pop$
+ nowarning empty$
+ { "empty " t * " in " * cite$ * warning$ }
+ 'skip$
+ if$
+ }
{ t 'last.output.check :=
output.nonnull }
if$
@@ -656,8 +667,8 @@ FUNCTION {format.edition}
{ edition empty$
{ "" }
{ output.state mid.sentence =
- { edition "l" change.case$ " edition" * }
- { edition "t" change.case$ " edition" * }
+ { edition "l" change.case$ " ed." * }
+ { edition "t" change.case$ " ed." * }
if$
}
if$
@@ -940,7 +951,7 @@ FUNCTION {format.eprint}
FUNCTION {format.doi}
{ doi empty$
{ "" }
- { doi doiurl make.href }
+ { doiprefix doi * doiurl doi * make.href }
if$
}
@@ -1291,7 +1302,18 @@ FUNCTION {mastersthesis}
FUNCTION {misc}
{ output.bibitem
- format.authors output
+ % originally just:
+ % format.authors output
+ author empty$
+ {
+ editor empty$
+ 'skip$
+ { format.editors output.nonnull }
+ if$
+ }
+ { format.authors output.nonnull }
+ if$
+ %
title howpublished new.block.checkb
title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst
format.title output
@@ -1307,6 +1329,9 @@ FUNCTION {misc}
FUNCTION {online}
{ misc }
+FUNCTION {software}
+{ misc }
+
FUNCTION {phdthesis}
{ output.bibitem
format.authors "author" output.check
@@ -1615,8 +1640,14 @@ FUNCTION {presort}
{ type$ "proceedings" =
'editor.organization.sort
{ type$ "manual" =
- 'author.organization.sort
- 'author.sort
+ { author.organization.sort }
+ { type$ "online" =
+ type$ "misc" =
+ or
+ { author.editor.sort }
+ { author.sort }
+ if$
+ }
if$
}
if$
diff --git a/macros/latex/contrib/tugboat/tugboat.dtx b/macros/latex/contrib/tugboat/tugboat.dtx
index 6b627b723e..a37201087c 100644
--- a/macros/latex/contrib/tugboat/tugboat.dtx
+++ b/macros/latex/contrib/tugboat/tugboat.dtx
@@ -1,5 +1,5 @@
% \iffalse (this is a meta-comment (so they say))
-% $Id: tugboat.dtx 376 2021-06-27 16:27:44Z karl $
+% $Id: tugboat.dtx 392 2021-10-12 21:31:32Z karl $
% tugboat.dtx - main source for LaTeX TUGboat classes.
%
% Copyright 1994-2021 TeX Users Group.
@@ -28,7 +28,7 @@
%<ltugboatsty>\ProvidesPackage{ltugboat}
%<ltugprocsty>\ProvidesPackage{ltugproc}
%<ltugcomn> \ProvidesPackage{ltugcomn}
- [2021-06-27 v2.25
+ [2021-10-12 v2.26
%<ltugboatcls> TUGboat journal class%
%<ltugproccls> TUG conference proceedings class%
%<ltugboatsty|ltugprocsty> TUG compatibility package%
@@ -346,11 +346,20 @@
% We want to use \texttt{hyperref}'s \cs{texorpdfstring}, e.g., in the
% \texttt{draft} option above. If \texttt{hyperref} is not loaded,
% define our own trivial fallback to expand to the \TeX\ (first) argument.
+%
+% Similarly, disable \acro if we have hyperref, commonly used in sections.
% \begin{macrocode}
\AtBeginDocument{%
\ifx\undefined\texorpdfstring
\DeclareRobustCommand{\texorpdfstring}[2]{#1}%
\fi
+ %
+ \ifx\undefined\pdfstringdefDisableCommands\else
+ \pdfstringdefDisableCommands{%
+ \let\acro\relax
+ % lots more could be added.
+ }%
+ \fi
}
% \end{macrocode}
%
@@ -706,6 +715,7 @@
\def\Ghostscript{Ghost\-script}
\def\GNU{\acro{GNU}}
\def\GUI{\acro{GUI}}
+\DeclareRobustCommand{\HarfBuzz}{Harf\discretionary{-}{}{\kern.077em}Buzz}
\def\Hawaii{Hawai`i}
\def\HTML{\acro{HTML}}
\def\HTTP{\acro{HTTP}}
@@ -896,7 +906,7 @@
\ifdim \fontdimen1\font>0pt
% XeTeX logo needs tinkering when slanted/italic font.
\def\XekernbeforeE{-.11em}%
- \def\XekernafterE{-.11em}%
+ \def\XekernafterE{-.16em}%
\dp1=-.17ex
\fi
\lower\dp0\hbox{\raise\dp1\hbox{\kern\XekernbeforeE\tubreflect{E}}}%
@@ -1198,13 +1208,36 @@
\else
% This hyperref hook-in is due to Ulrike Fischer.
% \url{https://github.com/latex3/hyperref/issues/125}.
+ % \tb[sh]url@ are defined next.
\DeclareRobustCommand*{\tbsurl}{\hyper@normalise\tbsurl@}%
- \def\tbsurl@#1{\hyper@linkurl{\Hurl{#1}}{https://#1}}%
\DeclareRobustCommand*{\tbhurl}{\hyper@normalise\tbhurl@}
- \def\tbhurl@#1{\hyper@linkurl{\Hurl{#1}}{http://#1}}%
\fi
}
%
+% Outside \AtBeginDocument, back at the top level of the dtx,
+% turn on expl syntax for the main definitions of \tb[sh]url. We want
+% to auto-remove an explicit protocol in case it
+% was given. Only the correct protocol is removed, the incorrect
+% protocol (\tbsurl{http://}) generates an invalid link. That's ok
+% because the link wouldn't be correct anyway.
+\ExplSyntaxOn
+\def\tbsurl@#1 % https
+ {
+ \str_set:Nn\l_tmpa_str{#1}
+ \str_remove_once:Nn\l_tmpa_str{https://}
+ \expandafter\hyper@linkurl\expandafter{\expandafter\Hurl\expandafter
+ {\l_tmpa_str}}{https://\l_tmpa_str}
+ }
+
+\def\tbhurl@#1 % http
+ {
+ \str_set:Nn\l_tmpa_str{#1}
+ \str_remove_once:Nn\l_tmpa_str{http://}
+ \expandafter\hyper@linkurl\expandafter{\expandafter\Hurl\expandafter
+ {\l_tmpa_str}}{http://\l_tmpa_str}
+ }
+\ExplSyntaxOff
+%
% Make \! work in text mode.
\DeclareRobustCommand{\!}{\ifmmode\mskip-\thinmuskip \else\kern-0.16667em \fi}
%
@@ -1837,7 +1870,7 @@
\def\|{\unskip\hfil\break}%
\def\\{\endgraf}%
\def\phone{\rm Phone: }%
- \def\tubmultipleaffilauthor{\\\hspace*{1em}}%
+ \def\tubmultipleaffilauthor{\unskip,\\\hspace*{1em}}%
\rm\@signature}%
}%
\ifnum\authornumber<0 \endgroup\fi
@@ -1847,14 +1880,16 @@
%
% The idea here is that if multiple authors share affiliation
% information, we need only typeset the affiliation once. We separate by
-% commas for the \cs{maketitle}, and put on separate lines in the
-% \cs{makesignature}. Similarly, within \cs{netaddress},
-% |!tubmultipleaffilnet| separates with a space before and after the
-% comma, while . (All this per bb.) See |tb122childs-trotter.ltx| for an
-% example.
+% commas for the \cs{maketitle}, and put on separate lines, also with commas,
+% in the \cs{makesignature}.
+%
+% Similarly, within \cs{netaddress}, |!tubmultipleaffilnet| separates
+% with a space before and after the
+% comma. (All this per bb.) See |tb122childs-trotter.ltx|,
+% |tb131sojka-czech.ltx| for examples.
%
% \begin{macrocode}
-\def\tubmultipleaffilauthor{\unskip, \ignorespaces}%
+\def\tubmultipleaffilauthor{\unskip,\ \ignorespaces}%
\def\tubmultipleaffilnet{\unskip\textrm{\,,\ \ignorespaces}}
% \end{macrocode}
%
@@ -2772,11 +2807,15 @@
% \end{macrocode}
%
% Also use \cs{tubcaptionfonts} for the caption
-% labels, and put the label itself (e.g., ``Figure 1'') in bold.
+% labels, and put the label (e.g., ``Figure 1'') in bold.
+% If the \texttt{listings} package is being used, bold for its
+% label too; this \cs{def} is too early, but maybe listings will
+% play nice later.
%
% \begin{macrocode}
\def\fnum@figure{{\tubcaptionfonts \bf \figurename\nobreakspace\thefigure}}
\def\fnum@table{{\tubcaptionfonts \bf \tablename\nobreakspace\thetable}}
+\def\lstlistingnamestyle{\bfseries}
% \end{macrocode}
%
% Let's reduce the default space above captions a bit, and give it some
@@ -3009,7 +3048,7 @@
%
% Finally, if |microtype| is loaded, we want it to be deactivated in
% verbatim blocks. It often manipulates a leading |\| rather too much,
-% and messes with the visible fixed-width alignment.
+% thus messing with the visible fixed-width alignment.
% \begin{macrocode}
\AtBeginDocument{%
\@ifpackageloaded{microtype}
@@ -3356,6 +3395,7 @@
% \begin{macrocode}
%
\def\tubdoiprefix{10.47397/tb} % the number crossref assigned us
+\def\tubabovedoi{} % fudge spacing or whatever.
%
\def\tubtypesetdoi{\iftubomitdoioption\else % if not explicit omission ...
\iftubfinaloption % do this if [final], even if pageno>900
@@ -3364,6 +3404,7 @@
doi.org/\tubdoiprefix/\volno-\issno/\jobname}%
\scriptsize
\vskip\baselineskip
+ \tubabovedoi
\iftubsecondcolstart \moveright \tubcolwidthandgutter \fi
\rlap{\expandafter\tbsurl\expandafter{\thedoi}}%
\vss
@@ -3556,7 +3597,7 @@
% \subsection{Initialization}
%
% If we're going to use Harvard-style bibliographies, we set up the
-% bibliography style: the user doesn't get any choice.
+% bibliography style: the user doesn't get any choice. (Not recommended.)
%
% \begin{macrocode}
\if@Harvardcite
diff --git a/macros/latex/contrib/tugboat/tugboat.pdf b/macros/latex/contrib/tugboat/tugboat.pdf
index 0962006255..97c1f134f8 100644
--- a/macros/latex/contrib/tugboat/tugboat.pdf
+++ b/macros/latex/contrib/tugboat/tugboat.pdf
Binary files differ
diff --git a/macros/latex/contrib/yathesis/CHANGELOG.md b/macros/latex/contrib/yathesis/CHANGELOG.md
index a490efc9b8..3884fe6683 100644
--- a/macros/latex/contrib/yathesis/CHANGELOG.md
+++ b/macros/latex/contrib/yathesis/CHANGELOG.md
@@ -1,5 +1,12 @@
# [Unreleased]
+# [1.0.9] - 2021-10-13
+
+## Fixed
+- Bug gh #90 (https://git.io/JKO3L).
+- Bug gh #87 (https://git.io/JKO3Z).
+- Bug gh #86 (https://git.io/JKO3W).
+
# [1.0.8] - 2021-07-13
## Fixed
@@ -96,7 +103,6 @@
## Fixed
- Bug gh #73.
-
# [1.0.0] - 2020-03-26
## Added
@@ -115,7 +121,6 @@
## Fixed
- Several bug fixes (among others gh #65 and #67).
-
# [0.99u] - 2019-03-28
## Added
@@ -140,43 +145,36 @@
## Fixed
- Several bug fixes (among others gh #43).
-
# [0.99t] - 2018-07-09
## Fixed
- Several bug fixes.
-
# [0.99s] - 2018-06-22
## Fixed
- Several bug fixes (among others gh #58 and #60).
-
# [0.99s] - 2018-06-21
## Fixed
- Several bug fixes (among others gh #59).
-
# [0.99r] - 2018-06-02
## Fixed
- Several bug fixes.
-
# [0.99q] - 2018-05-04
## Removed
- Useless files on CTAN (no functional changes).
-
# [0.99q] - 2018-04-10
## Fixed
- Several bug fixes (among others gh #57).
-
# [0.99p] - 2016-12-08
## Added
@@ -188,7 +186,6 @@
## Changed
- Documentation revised and extended.
-
# [0.99o] - 2016-10-30
## Added
@@ -206,14 +203,12 @@
## Fixed
- Several bug fixes.
-
# [0.99n] - 2016-06-11
## Changed
- Documentation revised and extended.
- Reorganization and change of names of specimens and templates.
-
# [0.99m] - 2016-05-22
## Added
@@ -221,12 +216,10 @@
- Specimens and templates included in the PDF of the documentation as `.zip`
archive.
-
## Changed
- Documentation revised and extended.
- Reorganization and change of names of specimens and templates.
-
# [0.99l] - 2014-10-23
## Changed
@@ -248,7 +241,6 @@
## Fixed
- Several bug fixes.
-
# [0.99j] - 2014-07-18
## Added
diff --git a/macros/latex/contrib/yathesis/README.md b/macros/latex/contrib/yathesis/README.md
index cf129bfa68..c799aa10d3 100644
--- a/macros/latex/contrib/yathesis/README.md
+++ b/macros/latex/contrib/yathesis/README.md
@@ -1,6 +1,6 @@
-----------------------------------------------------------------------
-- `yathesis` --- Yet Another Thesis Class, version 1.0.8
+- `yathesis` --- Yet Another Thesis Class, version 1.0.9
- E-mail: `denis.bitouze@univ-littoral.fr`
- Released under the LaTeX Project Public License v1.3c or later. See
http://www.latex-project.org/lppl.txt
diff --git a/macros/latex/contrib/yathesis/doc/yathesis-fr.pdf b/macros/latex/contrib/yathesis/doc/yathesis-fr.pdf
index 6533156b70..e7bf632e75 100644
--- a/macros/latex/contrib/yathesis/doc/yathesis-fr.pdf
+++ b/macros/latex/contrib/yathesis/doc/yathesis-fr.pdf
Binary files differ
diff --git a/macros/latex/contrib/yathesis/exemples/specimen/latexmkrc b/macros/latex/contrib/yathesis/exemples/specimen/latexmkrc
index 334747a898..6a0624c807 100644
--- a/macros/latex/contrib/yathesis/exemples/specimen/latexmkrc
+++ b/macros/latex/contrib/yathesis/exemples/specimen/latexmkrc
@@ -20,4 +20,4 @@ $makeindex = 'texindy -L french';
push @generated_exts, 'acn', 'acr', 'alg', 'bbl', 'bcf', 'fls', 'gl*', 'idx',
'ind', 'ist', 'sbl*', 'sl*', 'sym*' ;
-$clean_ext .= 'synctex.gz* run.xml tex.bak out bbl bcf fdb_latexmk run tdo listing *~ lo* unq mw' ;
+$clean_ext .= 'synctex.gz* run.xml tex.bak out bbl bcf fdb_latexmk run tdo listing *~ lo* unq mw xdy' ;
diff --git a/macros/latex/contrib/yathesis/exemples/specimen/these.pdf b/macros/latex/contrib/yathesis/exemples/specimen/these.pdf
index 4a7f76b770..e7c4b46576 100644
--- a/macros/latex/contrib/yathesis/exemples/specimen/these.pdf
+++ b/macros/latex/contrib/yathesis/exemples/specimen/these.pdf
Binary files differ
diff --git a/macros/latex/contrib/yathesis/exemples/specimen/these.tex b/macros/latex/contrib/yathesis/exemples/specimen/these.tex
index 9226936fc9..5963e4e08e 100644
--- a/macros/latex/contrib/yathesis/exemples/specimen/these.tex
+++ b/macros/latex/contrib/yathesis/exemples/specimen/these.tex
@@ -184,11 +184,11 @@
%
% Date de la soutenance, au format {jour}{mois}{année} donnés sous forme de
% nombres
-\date{1}{1}{2015}
+\date{1}{1}{2022}
%
% (Facultatif) Date de la soumission, au format {jour}{mois}{année} donnés sous
% forme de nombres
-\submissiondate{1}{10}{2014}
+\submissiondate{1}{10}{2021}
%
% (Facultatif) Sujet pour les méta-données du PDF
\subject[Chaotic Laugh]{Rire chaotique}
diff --git a/macros/latex/contrib/yathesis/source/yathesis-samples-templates.dtx b/macros/latex/contrib/yathesis/source/yathesis-samples-templates.dtx
index 7bb5006f4d..50d1e95d9c 100644
--- a/macros/latex/contrib/yathesis/source/yathesis-samples-templates.dtx
+++ b/macros/latex/contrib/yathesis/source/yathesis-samples-templates.dtx
@@ -332,14 +332,14 @@
% nombres
%COMMENT
%<flat-template|characteristics-master>\date{}{}{}
-%<characteristics-sample|flat-sample>\date{1}{1}{2015}
+%<characteristics-sample|flat-sample>\date{1}{1}{2022}
%<<COMMENT
%
% (Facultatif) Date de la soumission, au format {jour}{mois}{année} donnés sous
% forme de nombres
%COMMENT
%<flat-template|characteristics-master>%\submissiondate{}{}{}
-%<characteristics-sample|flat-sample>\submissiondate{1}{10}{2014}
+%<characteristics-sample|flat-sample>\submissiondate{1}{10}{2021}
%<<COMMENT
%
% (Facultatif) Sujet pour les méta-données du PDF
diff --git a/macros/latex/contrib/yathesis/source/yathesis.dtx b/macros/latex/contrib/yathesis/source/yathesis.dtx
index 7b59e2b682..75a07ebde0 100644
--- a/macros/latex/contrib/yathesis/source/yathesis.dtx
+++ b/macros/latex/contrib/yathesis/source/yathesis.dtx
@@ -23,7 +23,7 @@
%<*readme>
-----------------------------------------------------------------------
-- `yathesis` --- Yet Another Thesis Class, version 1.0.8
+- `yathesis` --- Yet Another Thesis Class, version 1.0.9
- E-mail: `denis.bitouze@univ-littoral.fr`
- Released under the LaTeX Project Public License v1.3c or later. See
http://www.latex-project.org/lppl.txt
@@ -62,6 +62,270 @@ Typesetting the documentation of the class requires:
latexmk -norc -r ./latexmkrc yathesis-fr
%</readme>
+%<*changelog>
+# [Unreleased]
+
+# [1.0.9] - 2021-10-13
+
+## Fixed
+- Bug gh #90 (https://git.io/JKO3L).
+- Bug gh #87 (https://git.io/JKO3Z).
+- Bug gh #86 (https://git.io/JKO3W).
+
+# [1.0.8] - 2021-07-13
+
+## Fixed
+- Bug gh #85 (https://git.io/JCTjv).
+- Bug gh #84 (https://git.io/JCTpu).
+- Bug gh #83 (https://git.io/JYfz8).
+
+## Changed
+- The fix of #85 above renders ineffective the `\includeonly` command when the
+ option `\localbibs` is used. This is an incompatible change but only for
+ a command that is used only temporarily, so we don't increment the major
+ version number.
+- Again expose `\listoflistings` in the samples.
+
+# [1.0.7] - 2021-03-24
+
+## Removed
+- Useless and confusing file in the samples removed (no functional changes).
+
+## Changed
+- Don't expose `\listoflistings` in the samples (bug gh #83,
+ https://git.io/JYfz8).
+
+# [1.0.6] - 2021-03-23
+
+## Added
+- Command allowing, for each chapter, to specify a text inserted between its
+ head and its possible automatic local table of contents (issue gh #82,
+ https://git.io/JYeVe).
+
+## Changed
+- Table listing the members of the committee:
+ - with \textwidth as width,
+ - with 3 and not 4 columns in case president is not specified.
+- Documentation revised.
+
+## Fixed
+- Bug gh #81 (https://git.io/JYeVY).
+
+# [1.0.5] - 2021-02-05
+
+## Changed
+- The class now relies on the new LaTeX core hooks.
+- Documentation revised.
+
+## Fixed
+- Setting the main language was not taken into account by some packages
+ (e.g. `csquotes`).
+
+# [1.0.4] - 2020-10-14
+
+## Changed
+- Documentation revised.
+- The class now relies on `datetime2` and not on `datetime`.
+
+## Fixed
+- Bug gh #76 (https://git.io/JTTpX).
+- Bug gh #77 (https://git.io/JTTpu).
+- Bug gh #78 (https://git.io/JTTpQ).
+
+# [1.0.3] - 2020-06-16
+
+## Changed
+- Documentation revised.
+- Specimens improved.
+- Package `titlesec` used instead of `titleps`: possible (hopefully slight) layout discrepancies.
+
+## Fixed
+- Bug gh #74 (https://git.io/Jf64U).
+- Bug gh #65 (https://git.io/Jf64k), continuation and (hopefully) ending.
+
+# [1.0.2] - 2020-04-13
+
+## Changed
+
+- Specimens now highlight the automatic local tocs and local bibs features of
+ the class.
+- Verso of the asbtract page now with empty footer.
+- Completion file for TeXstudio improved and updated.
+
+## Fixed
+- Switches between pages styles robustified.
+- Bug #65 now for bibtex as well.
+- French rules were applied to glossaries and acronyms even in case of
+ `mainlanguage=english`.
+- Subtitles were too close to multiline titles.
+
+# [1.0.1] - 2020-03-28
+
+## Changed
+- Documentation revised.
+- Specimens improved.
+
+## Fixed
+- Bug gh #73.
+
+
+# [1.0.0] - 2020-03-26
+
+## Added
+- (Partial) CHANGELOG file (following https://keepachangelog.com/en/1.0.0/).
+- Semantic versionning (following https://semver.org/).
+- Colophon automatically added to the thesis, with possibility to:
+ - remove it,
+ - change:
+ - its location from 2nd cover to 3rd one,
+ - its content.
+
+## Changed
+- `\disclaimer` replaced by (and alias of) `\disclaimertext`.
+- Warnings and error messages now contain (expected) accented characters.
+
+## Fixed
+- Several bug fixes (among others gh #65 and #67).
+
+
+# [0.99u] - 2019-03-28
+
+## Added
+- `\maketitle` option `noaim` for (slight) customization of the title pages.
+- `\institute`, `\coinstitute` and `\company` option `nologo` for (slight)
+ customization of the title pages (gh #51).
+
+## Changed
+- Documentation revised and extended.
+- Key expressions "Titre de la thèse" and "Titre de l’habilitation à diriger les
+ recherches" (and English equivalents) now empty.
+- Key expression "Directeurs" (and English equivalent) introducing the list of
+ the "HDR" directors now replaced by "Habilitation dirigée par" (and English
+ equivalent).
+- Options `noinstitute`, `nodoctoralschool`, `nolaboratory`, `nodate`,
+ `noacademicfield`: now turn off on title pages the display of the
+ corresponding elements (as well as the co-institute for `noinstitute` and
+ specialty for `noacademicfield`).
+- On the title page (s) in French, automatic gender agreement in expressions
+ keys introducing the groups member of the committee.
+
+## Fixed
+- Several bug fixes (among others gh #43).
+
+
+# [0.99t] - 2018-07-09
+
+## Fixed
+- Several bug fixes.
+
+
+# [0.99s] - 2018-06-22
+
+## Fixed
+- Several bug fixes (among others gh #58 and #60).
+
+
+# [0.99s] - 2018-06-21
+
+## Fixed
+- Several bug fixes (among others gh #59).
+
+
+# [0.99r] - 2018-06-02
+
+## Fixed
+- Several bug fixes.
+
+
+# [0.99q] - 2018-05-04
+
+## Removed
+- Useless files on CTAN (no functional changes).
+
+
+# [0.99q] - 2018-04-10
+
+## Fixed
+- Several bug fixes (among others gh #57).
+
+
+# [0.99p] - 2016-12-08
+
+## Added
+- `\chapter` and `\section` have an extra optional argument for an alternative
+ title in header different from the one in the ToC.
+- Simplification of the use of all starred structuring commands (their
+ substructuring commands don't need to be starred).
+
+## Changed
+- Documentation revised and extended.
+
+
+# [0.99o] - 2016-10-30
+
+## Added
+- Automatic local (by chapter) tables of contents (thanks to Jean-François
+ Burnol's etoc and help): option `localtocs` (gh #45).
+- Automatic local (by chapter) bibliographies: option `localbibs`.
+
+## Changed
+- Documentation revised and revised and extended. (index of concepts).
+- English translation of "MCF" ("Associate Professor" instead of "Lecturer").
+
+## Removed
+- Useless warning from `iflang` package.
+
+## Fixed
+- Several bug fixes.
+
+
+# [0.99n] - 2016-06-11
+
+## Changed
+- Documentation revised and extended.
+- Reorganization and change of names of specimens and templates.
+
+
+# [0.99m] - 2016-05-22
+
+## Added
+- Documentation can be compiled with `pdflatex`.
+- Specimens and templates included in the PDF of the documentation as `.zip`
+ archive.
+
+
+## Changed
+- Documentation revised and extended.
+- Reorganization and change of names of specimens and templates.
+
+
+# [0.99l] - 2014-10-23
+
+## Changed
+- Documentation revised and extended.
+- Reorganization and change of names of specimens and templates.
+
+# [0.99k] - 2014-10-01
+
+## Added
+- Macro \submissiondate
+
+## Changed
+- Documentation revised and extended.
+- Page numbers on first page of each chapters (with numberred pages).
+
+## Removed
+- Class option `bookmark`.
+
+## Fixed
+- Several bug fixes.
+
+
+# [0.99j] - 2014-07-18
+
+## Added
+- Initial CTAN release of the `yathesis` class (2014-07-27).
+%</changelog>
%<*internal>
\fi
\def\nameofplainTeX{plain}
@@ -70,8 +334,8 @@ Typesetting the documentation of the class requires:
\fi
%</internal>
%<*class|install>
-\def\yathesisversion{1.0.8}
-\def\yathesisdate{2021-07-13}
+\def\yathesisversion{1.0.9}
+\def\yathesisdate{2021-10-13}
%</class|install>
%<*install>
\input docstrip.tex
@@ -137,6 +401,10 @@ This work consists of the file yathesis.dtx
\nopreamble\nopostamble
\file{README.md}{\from{\jobname.dtx}{readme}}
}%
+\generate{
+ \nopreamble\nopostamble
+ \file{CHANGELOG.md}{\from{\jobname.dtx}{changelog}}
+}%
\usedir{tex/latex/\YAD@classname}
\generate{%
\file{\YAD@classname.cls}{\from{\jobname.dtx}{class}}
@@ -1852,9 +2120,9 @@ This work consists of the file yathesis.dtx
% On fait en sorte que la clé "corporation", obsolète et remplacée par la clé
% "corps", soit un alias de ce dernier.
% \begin{macrocode}
- % \ifthenelse{\equal{\cmdKV@YAD@corporation}{}}{%
+ % \YAD@ifemptyorundef{\cmdKV@YAD@corporation}{%
% }{%
- % \ifthenelse{\equal{\cmdKV@YAD@corps}{}}{%
+ % \YAD@ifemptyorundef{\cmdKV@YAD@corps}{%
% \yadsetup{#1,corps=\cmdKV@YAD@corporation}%
% }{%
% }%
@@ -2263,7 +2531,7 @@ This work consists of the file yathesis.dtx
\ifthenelse{\DTLiseq{\YAD@committeemember@corps}{}}{%
\YAD@committeemember@affiliation%
}{%
- \ifthenelse{\equal{\YAD@committeemember@sepcorpaffil}{}}{%
+ \YAD@ifemptyorundef{\YAD@committeemember@sepcorpaffil}{%
\YAD@if@starts@with@vowel{\YAD@committeemember@affiliation}{\YAD@al}{\YAD@au}\YAD@committeemember@affiliation%
}{%
\YAD@committeemember@sepcorpaffil\YAD@committeemember@affiliation%
@@ -2530,7 +2798,7 @@ This work consists of the file yathesis.dtx
}%
% \boolfalse{YAD@nolink}%
\yadsetup{##1}%
- \ifthenelse{\equal{\cmdKV@YAD@url}{}}{%
+ \YAD@ifemptyorundef{\cmdKV@YAD@url}{%
\ifdraft{%
\YAD@reach@file{%
\YAD@texte%
@@ -2561,7 +2829,7 @@ This work consists of the file yathesis.dtx
% \begin{macrocode}
\csdef{print#2address}{%
\yadsetup{##1}%
- \ifthenelse{\equal{\cmdKV@YAD@address}{}}{%
+ \YAD@ifemptyorundef{\cmdKV@YAD@address}{%
\YAD@reach@file{\YAD@generic@argument@translate{address#2}}%
}{%
\YAD@reach@file{\cmdKV@YAD@address}%
@@ -2573,7 +2841,7 @@ This work consists of the file yathesis.dtx
% \begin{macrocode}
\csdef{print#2telephone}{%
\yadsetup{##1}%
- \ifthenelse{\equal{\cmdKV@YAD@telephone}{}}{%
+ \YAD@ifemptyorundef{\cmdKV@YAD@telephone}{%
\YAD@reach@file{\YAD@generic@argument@translate{telephone#2}}%
}{%
\YAD@reach@file{\cmdKV@YAD@telephone}%
@@ -2585,7 +2853,7 @@ This work consists of the file yathesis.dtx
% \begin{macrocode}
\csdef{print#2fax}{%
\yadsetup{##1}%
- \ifthenelse{\equal{\cmdKV@YAD@fax}{}}{%
+ \YAD@ifemptyorundef{\cmdKV@YAD@fax}{%
\YAD@reach@file{\YAD@generic@argument@translate{fax#2}}%
}{%
\YAD@reach@file{\cmdKV@YAD@fax}%
@@ -2598,7 +2866,7 @@ This work consists of the file yathesis.dtx
% \begin{macrocode}
\csdef{print#2email}{%
\YAD@reach@file{%
- \ifthenelse{\equal{\cmdKV@YAD@email}{}}{%
+ \YAD@ifemptyorundef{\cmdKV@YAD@email}{%
% \ifbool{YAD@nolink}{%
% \YAD@generic@argument@translate{#2email}%
% }{%
@@ -2647,11 +2915,12 @@ This work consists of the file yathesis.dtx
}{%
}%
\renewcommand*\YAD@logo{%
- \ifthenelse{\equal{\cmdKV@YAD@logo}{}}{%
+ \YAD@ifemptyorundef{\cmdKV@YAD@logo}{%
\YAD@reach@file{\YAD@generic@argument@translate{logo#2}}%
}{%
\YAD@reach@file{%
\includegraphics[height=\cmdKV@YAD@logoheight]{\cmdKV@YAD@logo}%
+ \renewcommand*\cmdKV@YAD@logo{}%
}%
}%
}%
@@ -2660,7 +2929,7 @@ This work consists of the file yathesis.dtx
% \ifbool{YAD@nolink}{%
% \YAD@logo%
% }{%
- \ifthenelse{\equal{\cmdKV@YAD@url}{}}{%
+ \YAD@ifemptyorundef{\cmdKV@YAD@url}{%
% \YAD@href{www.#2.fr}{
\YAD@logo%
% }%
@@ -2670,7 +2939,7 @@ This work consists of the file yathesis.dtx
% }%
\fi%
\setlength\cmdKV@YAD@logoheight{\YAD@default@logoheight}%
- \boolfalse{YAD@nologo}
+ \boolfalse{YAD@nologo}%
\booltrue{YAD@logo@before}%
}%
}%
@@ -3139,7 +3408,7 @@ This work consists of the file yathesis.dtx
% est exprimée en les même termes que le \Package{tocvsec2} (désormais non
% chargé). On lui applique le style de page propre à la partie liminaire du
% document, notamment début de la prise en compte des chapitres et sections
-% (numérotés ou pas) dans la table des matières.
+% (numérotés ou pas) dans la table des matières.
%
% \begin{macro}{\tableofcontents}
% \begin{macrocode}
@@ -3320,7 +3589,7 @@ This work consists of the file yathesis.dtx
% \end{macrocode}
% \end{macro}
% Par défaut, au début du document rien n'est numéroté et les chapitres ne
-% débutent pas par des tables des matières locales.
+% débutent pas par des tables des matières locales.
% \begin{macrocode}
\AddToHook{begindocument}{%
\setcounter{secnumdepth}{-10}%
@@ -5001,7 +5270,7 @@ This work consists of the file yathesis.dtx
% Les commandes et styles suivants, ainsi que toute la machinerie permettant de
% faire débuter les chapitres par leurs tables des matières locales s'appuient
% sur le \pkg{etoc} de Jean-François Burnol (qui a aimablement fourni le code
-% suivant).
+% suivant).
% \begin{macrocode}
% it will be easy to globally shift the TOC horizontally if needed
\def\YAD@leftmargin {0pt}
@@ -5083,14 +5352,14 @@ This work consists of the file yathesis.dtx
\fi
\cleardoublepage%
}%
- %
+ %
\etocsetstyle{part} {} {\addpenalty {-\@highpenalty}%
\addvspace \YAD@bigvskip \leavevmode {\large
\bfseries % use a group to limit font change
\interlinepenalty\@M \etocifnumbered{\etocnumber\hspace{1em}}{}%
\etocname \nobreak\hfil\makebox[-\parfillskip][r]{\etocpage}}\par
\nobreak } {} {}
- %
+ %
\etocsetstyle{chapter} {\advance\leftskip\YAD@numwidthB\relax} {\addpenalty
{-\@highpenalty }%
\vskip \YAD@globalmedvskip\relax
@@ -5101,7 +5370,7 @@ This work consists of the file yathesis.dtx
\bfseries\etocname
\nobreak\hfil\makebox[-\parfillskip][r]{\etocpage}\par }%
\penalty \@highpenalty } {} {\advance\leftskip-\YAD@numwidthB\relax}
- %
+ %
\YAD@setlinestyle {section}{\YAD@numwidthC}%
\YAD@setlinestyle {subsection}{\YAD@numwidthD}%
\YAD@setlinestyle {subsubsection}{\YAD@numwidthE}%
@@ -5170,7 +5439,7 @@ This work consists of the file yathesis.dtx
\leavevmode\leaders\hrule\@height\p@\hfill\kern\z@\par
\bigskip \if@restonecol \twocolumn \fi
}
- % %
+ % %
\etocsetstyle{section} {%
\advance\leftskip\YAD@numwidthC\relax%
} {%
@@ -5194,7 +5463,7 @@ This work consists of the file yathesis.dtx
{} {%
\advance\leftskip-\YAD@numwidthC\relax%
}
- % %
+ % %
\YAD@setlinestyle {subsection}{\YAD@numwidthD}%
\YAD@setlinestyle {subsubsection}{\YAD@numwidthE}%
\YAD@setlinestyle {paragraph}{\YAD@numwidthF}%
@@ -5211,7 +5480,7 @@ This work consists of the file yathesis.dtx
%
% \begin{macrocode}
\newcommand*\YAD@computenumwidths@ [2] {% #1 pour `etoc' ou `local', #2=pour le
- % \kern
+ % \kern
\begingroup
\def\YAD@numwidthB {0pt}%
\def\YAD@numwidthC {0pt}%
@@ -5238,7 +5507,7 @@ This work consists of the file yathesis.dtx
\etocsetstyle{subparagraph}{}
{\setbox0\hbox{\etocthenumber\kern#2}}
{\ifdim\wd0>\YAD@numwidthG\edef\YAD@numwidthG{\the\wd0}\fi}{}%
- %
+ %
\etocsettocstyle{}
{\global\let\YAD@numwidthB\YAD@numwidthB
\global\let\YAD@numwidthC\YAD@numwidthC
@@ -5517,7 +5786,11 @@ This work consists of the file yathesis.dtx
\let\YAD@ORI@sectionmark\sectionmark%
\renewcommand\sectionmark[1]{}%
\YAD@ORI@section{#3}%
- \YAD@ORI@sectionmark{#2}%
+ \ifbool{YAD@nonnumbered@section}{%
+ \YAD@ORI@sectionmark{#2}%
+ }{%
+ \YAD@ORI@sectionmark{\thesection. #2}%
+ }%
\let\sectionmark\YAD@ORI@sectionmark%
}%
}{%
@@ -5527,7 +5800,11 @@ This work consists of the file yathesis.dtx
\let\YAD@ORI@sectionmark\sectionmark%
\renewcommand\sectionmark[1]{}%
\YAD@ORI@section[#1]{#3}%
- \YAD@ORI@sectionmark{#2}%
+ \ifbool{YAD@nonnumbered@section}{%
+ \YAD@ORI@sectionmark{#2}%
+ }{%
+ \YAD@ORI@sectionmark{\thesection. #2}%
+ }%
\let\sectionmark\YAD@ORI@sectionmark%
}%
}%
diff --git a/macros/latex/required/babel/base/README.md b/macros/latex/required/babel/base/README.md
index 93074fc20a..7a150533d2 100644
--- a/macros/latex/required/babel/base/README.md
+++ b/macros/latex/required/babel/base/README.md
@@ -1,4 +1,4 @@
-## Babel 3.63
+## Babel 3.64
This package manages culturally-determined typographical (and other)
rules, and hyphenation patterns for a wide range of languages. Many
@@ -8,9 +8,9 @@ is a set of ini files for about 250 languages.
The latest stable version is available on <https://ctan.org/pkg/babel>.
-Changes in version 3.63 are described in:
+Changes in version 3.64 are described in:
-https://latex3.github.io/babel/news/whats-new-in-babel-3.63.html
+https://latex3.github.io/babel/news/whats-new-in-babel-3.64.html
Apart from the manual, you can find information on some aspects of babel at:
@@ -46,6 +46,16 @@ respective authors.
### Summary of Latest changes
```
+3.64 2021-10-13
+ * Added a few counters to CJK.
+ * Restored the previous behavior of \selectlanguage with
+ relation to \write (see #114).
+ * Fixes:
+ - babel errors on document option 'chinese' (#141).
+ - name.babel in ini files set inconsistently (#149).
+ * Now babel.def and babel.sty are separate files (for
+ Plain-based formats and LaTeX, respectively).
+
3.63 2021-07-22
* Fixes a severe bug with CJK and XeTeX introduced in 3.62.
diff --git a/macros/latex/required/babel/base/babel.dtx b/macros/latex/required/babel/base/babel.dtx
index 28b1a76683..6fe5db94f2 100644
--- a/macros/latex/required/babel/base/babel.dtx
+++ b/macros/latex/required/babel/base/babel.dtx
@@ -32,7 +32,7 @@
%
% \iffalse
%<*filedriver>
-\ProvidesFile{babel.dtx}[2021/07/22 v3.63 The Babel package]
+\ProvidesFile{babel.dtx}[2021/10/13 v3.64 The Babel package]
\documentclass{ltxdoc}
\GetFileInfo{babel.dtx}
\usepackage{fontspec}
@@ -788,9 +788,11 @@ group.
|\text...| is heavily overloaded in \LaTeX{} and conflicts with
existing macros may arise (|\textlatin|, |\textbar|, |\textit|,
|\textcolor| and many others). The same applies to environments,
- because |arabic| conflicts with |\arabic|. Except if there is a
- reason for this ‘syntactical sugar’, the best option is to stick to
- the default selectors or to define your own alternatives.
+ because |arabic| conflicts with |\arabic|. Furthermore, and because of
+ this overloading, detecting the language of a chunk of text by
+ external tools can become unfeasible. Except if there is a reason for
+ this ‘syntactical sugar’, the best option is to stick to the default
+ selectors or to define your own alternatives.
\end{warning}
\begin{example}
@@ -2278,7 +2280,7 @@ to select fonts in addition to the three basic families.
\textit{Package fontspec Warning: 'Language 'LANG' not available for
font 'FONT' with script 'SCRIPT' 'Default' language used instead'}.
- \textbf{This is \textit{not} and error.} This warning is shown by
+ \textbf{This is \textit{not} an error.} This warning is shown by
\textsf{fontspec}, not by \babel. It can be irrelevant for English,
but not for many other languages, including Urdu and Turkish. This is
a useful and harmless warning, and if everything is fine with your
@@ -2290,7 +2292,7 @@ to select fonts in addition to the three basic families.
standard families} \textit{Package babel Info: The following fonts
are not babel standard families}.
- \textbf{This is \textit{not} and error.} \babel{} assumes that if you
+ \textbf{This is \textit{not} an error.} \babel{} assumes that if you
are using |\babelfont| for a family, very likely you want to define
the rest of them. If you don't, you can find some inconsistencies
between families. This checking is done at the beginning of the
@@ -4859,7 +4861,7 @@ corresponding place. A selective list follows:
\item Active chars where not reset at the end of language options, and
that lead to incompatibilities between languages.
-\item |\textormath| raised and error with a conditional.
+\item |\textormath| raised an error with a conditional.
\item |\aliasshorthand| didn't work (or only in a few and very specific
cases).
@@ -5024,8 +5026,8 @@ help from Bernd Raichle, for which I am grateful.
% \section{Tools}
%
% \begin{macrocode}
-%<<version=3.63>>
-%<<date=2021/07/22>>
+%<<version=3.64>>
+%<<date=2021/10/13>>
% \end{macrocode}
%
% \textbf{Do not use the following macros in \texttt{ldf} files. They
@@ -5111,9 +5113,13 @@ help from Bernd Raichle, for which I am grateful.
\def\bbl@exp#1{%
\begingroup
\let\\\noexpand
- \def\<##1>{\expandafter\noexpand\csname##1\endcsname}%
+ \let\<\bbl@exp@en
+ \let\[\bbl@exp@ue
\edef\bbl@exp@aux{\endgroup#1}%
\bbl@exp@aux}
+\def\bbl@exp@en#1>{\expandafter\noexpand\csname#1\endcsname}%
+\def\bbl@exp@ue#1]{%
+ \unexpanded\expandafter\expandafter\expandafter{\csname#1\endcsname}}%
% \end{macrocode}
% \end{macro}
%
@@ -5146,7 +5152,7 @@ help from Bernd Raichle, for which I am grateful.
% \begin{macro}{\bbl@ifunset}
% To check if a macro is defined, we create a new macro, which does
% the same as |\@ifundefined|. However, in an $\epsilon$-tex engine,
-% it is based on |\ifcsname|, which is more efficient, and do not
+% it is based on |\ifcsname|, which is more efficient, and does not
% waste memory.
%
% \begin{macrocode}
@@ -5157,7 +5163,7 @@ help from Bernd Raichle, for which I am grateful.
\else
\expandafter\@secondoftwo
\fi}
- \bbl@ifunset{ifcsname}%
+ \bbl@ifunset{ifcsname}% TODO. A better test?
{}%
{\gdef\bbl@ifunset#1{%
\ifcsname#1\endcsname
@@ -5358,7 +5364,8 @@ help from Bernd Raichle, for which I am grateful.
%
% The following adds some code to |\extras...| both before and after,
% while avoiding doing it twice. It's somewhat convoluted, to deal with
-% |#|'s.
+% |#|'s. Used to deal with alph, Alph and frenchspacing when there are
+% already changes (with |\babel@save|).
%
% \begin{macrocode}
\def\bbl@extras@wrap#1#2#3{% 1:in-test, 2:before, 3:after
@@ -5446,21 +5453,16 @@ help from Bernd Raichle, for which I am grateful.
%
% \subsection{The Package File (\LaTeX, \texttt{babel.sty})}
%
-% This file also takes care of a number of compatibility issues with
-% other packages an defines a few aditional package options. Apart from
-% all the language options below we also have a few options that
-% influence the behavior of language definition files.
-%
-% Many of the following options don't do anything themselves, they are
-% just defined in order to make it possible for babel and language
-% definition files to check if one of them was specified by the user.
-%
-% The first two options are for debugging.
-%
% \begin{macrocode}
%<*package>
\NeedsTeXFormat{LaTeX2e}[2005/12/01]
\ProvidesPackage{babel}[<@date@> <@version@> The Babel package]
+% \end{macrocode}
+%
+% Start with some “private” debugging tool, and then define macros for
+% errors.
+%
+% \begin{macrocode}
\@ifpackagewith{babel}{debug}
{\providecommand\bbl@trace[1]{\message{^^J[ #1 ]}}%
\let\bbl@debug\@firstofone
@@ -5475,64 +5477,43 @@ help from Bernd Raichle, for which I am grateful.
\directlua{ Babel = Babel or {}
Babel.debug = false }%
\fi}
+\def\bbl@error#1#2{%
+ \begingroup
+ \def\\{\MessageBreak}%
+ \PackageError{babel}{#1}{#2}%
+ \endgroup}
+\def\bbl@warning#1{%
+ \begingroup
+ \def\\{\MessageBreak}%
+ \PackageWarning{babel}{#1}%
+ \endgroup}
+\def\bbl@infowarn#1{%
+ \begingroup
+ \def\\{\MessageBreak}%
+ \GenericWarning
+ {(babel) \@spaces\@spaces\@spaces}%
+ {Package babel Info: #1}%
+ \endgroup}
+\def\bbl@info#1{%
+ \begingroup
+ \def\\{\MessageBreak}%
+ \PackageInfo{babel}{#1}%
+ \endgroup}
+% \end{macrocode}
+%
+% This file also takes care of a number of compatibility issues with
+% other packages an defines a few aditional package options. Apart from
+% all the language options below we also have a few options that
+% influence the behavior of language definition files.
+%
+% Many of the following options don’t do anything themselves, they are
+% just defined in order to make it possible for babel and language
+% definition files to check if one of them was specified by the user.
+%
+% But first, include here the \textit{Basic macros} defined above.
+%
+% \begin{macrocode}
<@Basic macros@>
- % Temporarily repeat here the code for errors. TODO.
- \def\bbl@error#1#2{%
- \begingroup
- \def\\{\MessageBreak}%
- \PackageError{babel}{#1}{#2}%
- \endgroup}
- \def\bbl@warning#1{%
- \begingroup
- \def\\{\MessageBreak}%
- \PackageWarning{babel}{#1}%
- \endgroup}
- \def\bbl@infowarn#1{%
- \begingroup
- \def\\{\MessageBreak}%
- \GenericWarning
- {(babel) \@spaces\@spaces\@spaces}%
- {Package babel Info: #1}%
- \endgroup}
- \def\bbl@info#1{%
- \begingroup
- \def\\{\MessageBreak}%
- \PackageInfo{babel}{#1}%
- \endgroup}
-\def\bbl@nocaption{\protect\bbl@nocaption@i}
-% TODO - Wrong for \today !!! Must be a separate macro.
-\def\bbl@nocaption@i#1#2{% 1: text to be printed 2: caption macro \langXname
- \global\@namedef{#2}{\textbf{?#1?}}%
- \@nameuse{#2}%
- \edef\bbl@tempa{#1}%
- \bbl@sreplace\bbl@tempa{name}{}%
- \bbl@warning{%
- \@backslashchar#1 not set for '\languagename'. Please,\\%
- define it after the language has been loaded\\%
- (typically in the preamble) with\\%
- \string\setlocalecaption{\languagename}{\bbl@tempa}{..}\\%
- Reported}}
-\def\bbl@tentative{\protect\bbl@tentative@i}
-\def\bbl@tentative@i#1{%
- \bbl@warning{%
- Some functions for '#1' are tentative.\\%
- They might not work as expected and their behavior\\%
- may change in the future.\\%
- Reported}}
-\def\@nolanerr#1{%
- \bbl@error
- {You haven't defined the language '#1' yet.\\%
- Perhaps you misspelled it or your installation\\%
- is not complete}%
- {Your command will be ignored, type <return> to proceed}}
-\def\@nopatterns#1{%
- \bbl@warning
- {No hyphenation patterns were preloaded for\\%
- the language '#1' into the format.\\%
- Please, configure your TeX system to add them and\\%
- rebuild the format. Now I will use the patterns\\%
- preloaded for \bbl@nulllanguage\space instead}}
- % End of errors
\@ifpackagewith{babel}{silent}
{\let\bbl@info\@gobble
\let\bbl@infowarn\@gobble
@@ -5601,7 +5582,7 @@ help from Bernd Raichle, for which I am grateful.
\global\let\@ifl@ter@@\@ifl@ter
\def\@ifl@ter#1#2#3#4#5{\global\let\@ifl@ter\@ifl@ter@@}%
\endinput}{}%
-% \end{macrocode}
+% \end{macrocode}
%
% \subsection{\texttt{key=value} options and other general option}
%
@@ -5714,8 +5695,12 @@ help from Bernd Raichle, for which I am grateful.
\bbl@xin@{\string=}{\CurrentOption}%
\ifin@
\expandafter\bbl@tempa\CurrentOption\bbl@tempa
- \else
- \bbl@add@list\bbl@language@opts{\CurrentOption}%
+ \else
+ \bbl@xin@{,\CurrentOption,}{,\bbl@language@opts,}%
+ \ifin@
+ \bbl@exp{\\\bbl@replace\\\bbl@language@opts{,\CurrentOption,}{}}%
+ \fi
+ \edef\bbl@language@opts{\bbl@language@opts,\CurrentOption,}
\fi}
% \end{macrocode}
%
@@ -5726,8 +5711,16 @@ help from Bernd Raichle, for which I am grateful.
% \end{macrocode}
%
% \begin{macrocode}
-\ifx\bbl@opt@provide\@nnil\else % Tests. Ignore.
+\ifx\bbl@opt@provide\@nnil
+ \let\bbl@opt@provide\@empty % %%% MOVE above
+\else
\chardef\bbl@iniflag\@ne
+ \bbl@exp{\\\bbl@forkv{\@nameuse{@raw@opt@babel.sty}}}{%
+ \in@{,provide,}{,#1,}%
+ \ifin@
+ \def\bbl@opt@provide{#2}%
+ \bbl@replace\bbl@opt@provide{;}{,}%
+ \fi}
\fi
%
% \end{macrocode}
@@ -5813,10 +5806,13 @@ help from Bernd Raichle, for which I am grateful.
\ifx\bbl@opt@safe\@undefined
\def\bbl@opt@safe{BR}
\fi
+% \end{macrocode}
+%
+% Make sure the language set with `main` is the last one.
+%
+% \begin{macrocode}
\ifx\bbl@opt@main\@nnil\else
- \edef\bbl@language@opts{%
- \ifx\bbl@language@opts\@empty\else\bbl@language@opts,\fi
- \bbl@opt@main}
+ \edef\bbl@language@opts{\bbl@language@opts,\bbl@opt@main,}
\fi
% \end{macrocode}
%
@@ -5837,1285 +5833,35 @@ help from Bernd Raichle, for which I am grateful.
\expandafter\@secondoftwo
\fi}
\fi
-% \end{macrocode}
-%
-% \textbf{Common definitions.} \textit{In progress.} Still based on
-% |babel.def|, but the code should be moved here.
-%
-% \begin{macrocode}
-\input babel.def
-% \end{macrocode}
-%
-% \subsection{Cross referencing macros}
-%
-% The \LaTeX\ book states:
-% \begin{quote}
-% The \emph{key} argument is any sequence of letters, digits, and
-% punctuation symbols; upper- and lowercase letters are regarded as
-% different.
-% \end{quote}
-% When the above quote should still be true when a document is
-% typeset in a language that has active characters, special care
-% has to be taken of the category codes of these characters when
-% they appear in an argument of the cross referencing macros.
-%
-% When a cross referencing command processes its argument, all
-% tokens in this argument should be character tokens with category
-% `letter' or `other'.
-%
-% The following package options control which macros are to be
-% redefined.
-%
-% \begin{macrocode}
-%<<*More package options>>
-\DeclareOption{safe=none}{\let\bbl@opt@safe\@empty}
-\DeclareOption{safe=bib}{\def\bbl@opt@safe{B}}
-\DeclareOption{safe=ref}{\def\bbl@opt@safe{R}}
-%<</More package options>>
-% \end{macrocode}
-%
-% \begin{macro}{\@newl@bel}
-%
-% First we open a new group to keep the changed setting of
-% |\protect| local and then we set the |@safe@actives| switch to
-% true to make sure that any shorthand that appears in any of the
-% arguments immediately expands to its non-active self.
-%
-% \begin{macrocode}
-\bbl@trace{Cross referencing macros}
-\ifx\bbl@opt@safe\@empty\else
- \def\@newl@bel#1#2#3{%
- {\@safe@activestrue
- \bbl@ifunset{#1@#2}%
- \relax
- {\gdef\@multiplelabels{%
- \@latex@warning@no@line{There were multiply-defined labels}}%
- \@latex@warning@no@line{Label `#2' multiply defined}}%
- \global\@namedef{#1@#2}{#3}}}
-% \end{macrocode}
-%
-% \end{macro}
-%
-% \begin{macro}{\@testdef}
-%
-% An internal \LaTeX\ macro used to test if the labels that have
-% been written on the |.aux| file have changed. It is called by
-% the |\enddocument| macro.
-%
-% \begin{macrocode}
- \CheckCommand*\@testdef[3]{%
- \def\reserved@a{#3}%
- \expandafter\ifx\csname#1@#2\endcsname\reserved@a
- \else
- \@tempswatrue
- \fi}
-% \end{macrocode}
-%
-% Now that we made sure that |\@testdef| still has the same definition
-% we can rewrite it. First we make the shorthands `safe'. Then we use
-% |\bbl@tempa| as an `alias' for the macro that contains the label
-% which is being checked. Then we define |\bbl@tempb| just as
-% |\@newl@bel| does it. When the label is defined we replace the
-% definition of |\bbl@tempa| by its meaning. If the label didn't
-% change, |\bbl@tempa| and |\bbl@tempb| should be identical macros.
-%
-% \begin{macrocode}
- \def\@testdef#1#2#3{% TODO. With @samestring?
- \@safe@activestrue
- \expandafter\let\expandafter\bbl@tempa\csname #1@#2\endcsname
- \def\bbl@tempb{#3}%
- \@safe@activesfalse
- \ifx\bbl@tempa\relax
- \else
- \edef\bbl@tempa{\expandafter\strip@prefix\meaning\bbl@tempa}%
- \fi
- \edef\bbl@tempb{\expandafter\strip@prefix\meaning\bbl@tempb}%
- \ifx\bbl@tempa\bbl@tempb
- \else
- \@tempswatrue
- \fi}
-\fi
-% \end{macrocode}
-%
-% \end{macro}
-%
-% \begin{macro}{\ref}
-% \begin{macro}{\pageref}
-%
-% The same holds for the macro |\ref| that references a label and
-% |\pageref| to reference a page. We make them robust as well (if
-% they weren't already) to prevent problems if they should become
-% expanded at the wrong moment.
-%
-% \begin{macrocode}
-\bbl@xin@{R}\bbl@opt@safe
-\ifin@
- \bbl@redefinerobust\ref#1{%
- \@safe@activestrue\org@ref{#1}\@safe@activesfalse}
- \bbl@redefinerobust\pageref#1{%
- \@safe@activestrue\org@pageref{#1}\@safe@activesfalse}
-\else
- \let\org@ref\ref
- \let\org@pageref\pageref
-\fi
-% \end{macrocode}
-%
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\@citex}
-%
-% The macro used to cite from a bibliography, |\cite|, uses an
-% internal macro, |\@citex|.
-% It is this internal macro that picks up the argument(s),
-% so we redefine this internal macro and leave |\cite| alone. The
-% first argument is used for typesetting, so the shorthands need
-% only be deactivated in the second argument.
-%
-% \begin{macrocode}
-\bbl@xin@{B}\bbl@opt@safe
-\ifin@
- \bbl@redefine\@citex[#1]#2{%
- \@safe@activestrue\edef\@tempa{#2}\@safe@activesfalse
- \org@@citex[#1]{\@tempa}}
-% \end{macrocode}
-%
-% Unfortunately, the packages \pkg{natbib} and \pkg{cite} need a
-% different definition of |\@citex|...
-% To begin with, \pkg{natbib} has a definition for |\@citex| with
-% \emph{three} arguments... We only know that a package is loaded
-% when |\begin{document}| is executed, so we need to postpone the
-% different redefinition.
-%
-% \begin{macrocode}
- \AtBeginDocument{%
- \@ifpackageloaded{natbib}{%
-% \end{macrocode}
-%
-% Notice that we use |\def| here instead of |\bbl@redefine| because
-% |\org@@citex| is already defined and we don't want to overwrite
-% that definition (it would result in parameter stack overflow
-% because of a circular definition).
-%
-% (Recent versions of \pkg{natbib} change dynamically |\@citex|, so PR4087
-% doesn't seem fixable in a simple way. Just load \pkg{natbib} before.)
-%
-% \begin{macrocode}
- \def\@citex[#1][#2]#3{%
- \@safe@activestrue\edef\@tempa{#3}\@safe@activesfalse
- \org@@citex[#1][#2]{\@tempa}}%
- }{}}
-% \end{macrocode}
-%
-% The package \pkg{cite} has a definition of |\@citex| where the
-% shorthands need to be turned off in both arguments.
-%
-% \begin{macrocode}
- \AtBeginDocument{%
- \@ifpackageloaded{cite}{%
- \def\@citex[#1]#2{%
- \@safe@activestrue\org@@citex[#1]{#2}\@safe@activesfalse}%
- }{}}
-% \end{macrocode}
-%
-% \end{macro}
-%
-% \begin{macro}{\nocite}
-%
-% The macro |\nocite| which is used to instruct BiB\TeX\ to
-% extract uncited references from the database.
-%
-% \begin{macrocode}
- \bbl@redefine\nocite#1{%
- \@safe@activestrue\org@nocite{#1}\@safe@activesfalse}
-% \end{macrocode}
-%
-% \end{macro}
-%
-% \begin{macro}{\bibcite}
-%
-% The macro that is used in the |.aux| file to
-% define citation labels. When packages such as \pkg{natbib} or
-% \pkg{cite} are not loaded its second argument is used to typeset the
-% citation label. In that case, this second argument can contain
-% active characters but is used in an environment where
-% |\@safe@activestrue| is in effect. This switch needs to be reset
-% inside the |\hbox| which contains the citation label. In order to
-% determine during \file{.aux} file processing which definition of
-% |\bibcite| is needed we define |\bibcite| in such a way that it
-% redefines itself with the proper definition. We call
-% |\bbl@cite@choice| to select the proper definition for |\bibcite|.
-% This new definition is then activated.
-%
-% \begin{macrocode}
- \bbl@redefine\bibcite{%
- \bbl@cite@choice
- \bibcite}
-% \end{macrocode}
-%
-% \end{macro}
-%
-% \begin{macro}{\bbl@bibcite}
-%
-% The macro |\bbl@bibcite| holds the definition of |\bibcite|
-% needed when neither \pkg{natbib} nor \pkg{cite} is loaded.
-%
-% \begin{macrocode}
- \def\bbl@bibcite#1#2{%
- \org@bibcite{#1}{\@safe@activesfalse#2}}
-% \end{macrocode}
-%
-% \end{macro}
-%
-% \begin{macro}{\bbl@cite@choice}
-%
-% The macro |\bbl@cite@choice| determines which definition of
-% |\bibcite| is needed. First we give |\bibcite| its default
-% definition.
-%
-% \begin{macrocode}
- \def\bbl@cite@choice{%
- \global\let\bibcite\bbl@bibcite
- \@ifpackageloaded{natbib}{\global\let\bibcite\org@bibcite}{}%
- \@ifpackageloaded{cite}{\global\let\bibcite\org@bibcite}{}%
- \global\let\bbl@cite@choice\relax}
-% \end{macrocode}
-%
-% When a document is run for the first time, no \file{.aux} file is
-% available, and |\bibcite| will not yet be properly defined. In
-% this case, this has to happen before the document starts.
-%
-% \begin{macrocode}
- \AtBeginDocument{\bbl@cite@choice}
-% \end{macrocode}
-%
-% \end{macro}
-%
-% \begin{macro}{\@bibitem}
-%
-% One of the two internal \LaTeX\ macros called by |\bibitem|
-% that write the citation label on the |.aux| file.
-%
-% \begin{macrocode}
- \bbl@redefine\@bibitem#1{%
- \@safe@activestrue\org@@bibitem{#1}\@safe@activesfalse}
-\else
- \let\org@nocite\nocite
- \let\org@@citex\@citex
- \let\org@bibcite\bibcite
- \let\org@@bibitem\@bibitem
-\fi
-% \end{macrocode}
-%
-% \end{macro}
-%
-% \subsection{Marks}
-%
-% \begin{macro}{\markright}
-% Because the output routine is asynchronous, we must pass the
-% current language attribute to the head lines. To achieve this we
-% need to adapt the definition of |\markright| and |\markboth|
-% somewhat. However, headlines and footlines can contain text
-% outside marks; for that we must take some actions in the output
-% routine if the 'headfoot' options is used.
-%
-% We need to make some redefinitions to the output routine
-% to avoid an endless loop and to correctly handle the page number
-% in bidi documents.
-%
-% \begin{macrocode}
-\bbl@trace{Marks}
-\IfBabelLayout{sectioning}
- {\ifx\bbl@opt@headfoot\@nnil
- \g@addto@macro\@resetactivechars{%
- \set@typeset@protect
- \expandafter\select@language@x\expandafter{\bbl@main@language}%
- \let\protect\noexpand
- \ifcase\bbl@bidimode\else % Only with bidi. See also above
- \edef\thepage{%
- \noexpand\babelsublr{\unexpanded\expandafter{\thepage}}}%
- \fi}%
- \fi}
- {\ifbbl@single\else
- \bbl@ifunset{markright }\bbl@redefine\bbl@redefinerobust
- \markright#1{%
- \bbl@ifblank{#1}%
- {\org@markright{}}%
- {\toks@{#1}%
- \bbl@exp{%
- \\\org@markright{\\\protect\\\foreignlanguage{\languagename}%
- {\\\protect\\\bbl@restore@actives\the\toks@}}}}}%
-% \end{macrocode}
-%
-% \end{macro}
-%
-% \begin{macro}{\markboth}
-% \begin{macro}{\@mkboth}
-% The definition of |\markboth| is equivalent to that of
-% |\markright|, except that we need two token registers. The
-% documentclasses \cls{report} and \cls{book} define and set the
-% headings for the page. While doing so they also store a copy of
-% |\markboth| in |\@mkboth|. Therefore we need to check whether
-% |\@mkboth| has already been set. If so we neeed to do that again
-% with the new definition of |\markboth|. (As of Oct 2019, \LaTeX{}
-% stores the definition in an intermediate macro, so it's not
-% necessary anymore, but it's preserved for older versions.)
-%
-% \begin{macrocode}
- \ifx\@mkboth\markboth
- \def\bbl@tempc{\let\@mkboth\markboth}
- \else
- \def\bbl@tempc{}
- \fi
- \bbl@ifunset{markboth }\bbl@redefine\bbl@redefinerobust
- \markboth#1#2{%
- \protected@edef\bbl@tempb##1{%
- \protect\foreignlanguage
- {\languagename}{\protect\bbl@restore@actives##1}}%
- \bbl@ifblank{#1}%
- {\toks@{}}%
- {\toks@\expandafter{\bbl@tempb{#1}}}%
- \bbl@ifblank{#2}%
- {\@temptokena{}}%
- {\@temptokena\expandafter{\bbl@tempb{#2}}}%
- \bbl@exp{\\\org@markboth{\the\toks@}{\the\@temptokena}}}
- \bbl@tempc
- \fi} % end ifbbl@single, end \IfBabelLayout
-% \end{macrocode}
-%
-% \end{macro}
-% \end{macro}
-%
-% \subsection{Preventing clashes with other packages}
-%
-% \subsubsection{\pkg{ifthen}}
-%
-% \begin{macro}{\ifthenelse}
-%
-% Sometimes a document writer wants to create a special effect
-% depending on the page a certain fragment of text appears on. This
-% can be achieved by the following piece of code:
-%\begin{verbatim}
-% \ifthenelse{\isodd{\pageref{some:label}}}
-% {code for odd pages}
-% {code for even pages}
-%\end{verbatim}
-% In order for this to work the argument of |\isodd| needs to be
-% fully expandable. With the above redefinition of |\pageref| it is
-% not in the case of this example. To overcome that, we add some
-% code to the definition of |\ifthenelse| to make things work.
-%
-% We want to revert the definition of |\pageref| and |\ref| to
-% their original definition for the first argument of |\ifthenelse|,
-% so we first need to store their current meanings.
-%
-% Then we can set the |\@safe@actives| switch and call the original
-% |\ifthenelse|. In order to be able to use shorthands in the
-% second and third arguments of |\ifthenelse| the resetting of the
-% switch \emph{and} the definition of |\pageref| happens inside
-% those arguments.
-%
-% \begin{macrocode}
-\bbl@trace{Preventing clashes with other packages}
-\bbl@xin@{R}\bbl@opt@safe
-\ifin@
- \AtBeginDocument{%
- \@ifpackageloaded{ifthen}{%
- \bbl@redefine@long\ifthenelse#1#2#3{%
- \let\bbl@temp@pref\pageref
- \let\pageref\org@pageref
- \let\bbl@temp@ref\ref
- \let\ref\org@ref
- \@safe@activestrue
- \org@ifthenelse{#1}%
- {\let\pageref\bbl@temp@pref
- \let\ref\bbl@temp@ref
- \@safe@activesfalse
- #2}%
- {\let\pageref\bbl@temp@pref
- \let\ref\bbl@temp@ref
- \@safe@activesfalse
- #3}%
- }%
- }{}%
- }
-% \end{macrocode}
-%
-% \end{macro}
-%
-% \subsubsection{\pkg{varioref}}
-%
-% \begin{macro}{\@@vpageref}
-% \begin{macro}{\vrefpagenum}
-% \begin{macro}{\Ref}
-%
-% When the package varioref is in use we need to modify its
-% internal command |\@@vpageref| in order to prevent problems when
-% an active character ends up in the argument of |\vref|. The same
-% needs to happen for |\vrefpagenum|.
-%
-% \begin{macrocode}
- \AtBeginDocument{%
- \@ifpackageloaded{varioref}{%
- \bbl@redefine\@@vpageref#1[#2]#3{%
- \@safe@activestrue
- \org@@@vpageref{#1}[#2]{#3}%
- \@safe@activesfalse}%
- \bbl@redefine\vrefpagenum#1#2{%
- \@safe@activestrue
- \org@vrefpagenum{#1}{#2}%
- \@safe@activesfalse}%
-% \end{macrocode}
-%
-% The package \pkg{varioref} defines |\Ref| to be a robust command
-% wich uppercases the first character of the reference text. In
-% order to be able to do that it needs to access the expandable form
-% of |\ref|. So we employ a little trick here. We redefine the
-% (internal) command \verb*|\Ref | to call |\org@ref| instead of
-% |\ref|. The disadvantage of this solution is that whenever the
-% definition of |\Ref| changes, this definition needs to be updated
-% as well.
-%
-% \begin{macrocode}
- \expandafter\def\csname Ref \endcsname#1{%
- \protected@edef\@tempa{\org@ref{#1}}\expandafter\MakeUppercase\@tempa}
- }{}%
- }
-\fi
-% \end{macrocode}
-%
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \subsubsection{\pkg{hhline}}
-%
-% \begin{macro}{\hhline}
-%
-% Delaying the activation of the shorthand characters has introduced
-% a problem with the \pkg{hhline} package. The reason is that it
-% uses the `:' character which is made active by the french support
-% in \babel. Therefore we need to \emph{reload} the package when
-% the `:' is an active character. Note that this happens
-% \emph{after} the category code of the @-sign has been changed to
-% other, so we need to temporarily change it to letter again.
-%
-% \begin{macrocode}
-\AtEndOfPackage{%
- \AtBeginDocument{%
- \@ifpackageloaded{hhline}%
- {\expandafter\ifx\csname normal@char\string:\endcsname\relax
- \else
- \makeatletter
- \def\@currname{hhline}\input{hhline.sty}\makeatother
- \fi}%
- {}}}
-% \end{macrocode}
-%
-% \end{macro}
-%
-% \subsubsection{\pkg{hyperref}}
-%
-% \begin{macro}{\pdfstringdefDisableCommands}
-%
-% A number of interworking problems between \pkg{babel} and
-% \pkg{hyperref} are tackled by \pkg{hyperref} itself. The
-% following code was introduced to prevent some annoying warnings
-% but it broke bookmarks. This was quickly fixed in \pkg{hyperref},
-% which essentially made it no-op. However, it will not removed for
-% the moment because \pkg{hyperref} is expecting it. TODO. Still
-% true? Commented out in 2020/07/27.
-%
-% \begin{macrocode}
-% \AtBeginDocument{%
-% \ifx\pdfstringdefDisableCommands\@undefined\else
-% \pdfstringdefDisableCommands{\languageshorthands{system}}%
-% \fi}
-% \end{macrocode}
-%
-% \end{macro}
-%
-% \subsubsection{\pkg{fancyhdr}}
-%
-% \begin{macro}{\FOREIGNLANGUAGE}
-%
-% The package \pkg{fancyhdr} treats the running head and fout lines
-% somewhat differently as the standard classes. A symptom of this is
-% that the command |\foreignlanguage| which \babel\ adds to the
-% marks can end up inside the argument of |\MakeUppercase|. To
-% prevent unexpected results we need to define |\FOREIGNLANGUAGE|
-% here.
-%
-% \begin{macrocode}
-\DeclareRobustCommand{\FOREIGNLANGUAGE}[1]{%
- \lowercase{\foreignlanguage{#1}}}
-% \end{macrocode}
-%
-% \end{macro}
-%
-% \begin{macro}{\substitutefontfamily}
-%
-% This command is deprecated. Use the tools provides by \LaTeX.
-% The command |\substitutefontfamily| creates an
-% \file{.fd} file on the fly. The first argument is an encoding
-% mnemonic, the second and third arguments are font family names.
-%
-% \begin{macrocode}
-\def\substitutefontfamily#1#2#3{%
- \lowercase{\immediate\openout15=#1#2.fd\relax}%
- \immediate\write15{%
- \string\ProvidesFile{#1#2.fd}%
- [\the\year/\two@digits{\the\month}/\two@digits{\the\day}
- \space generated font description file]^^J
- \string\DeclareFontFamily{#1}{#2}{}^^J
- \string\DeclareFontShape{#1}{#2}{m}{n}{<->ssub * #3/m/n}{}^^J
- \string\DeclareFontShape{#1}{#2}{m}{it}{<->ssub * #3/m/it}{}^^J
- \string\DeclareFontShape{#1}{#2}{m}{sl}{<->ssub * #3/m/sl}{}^^J
- \string\DeclareFontShape{#1}{#2}{m}{sc}{<->ssub * #3/m/sc}{}^^J
- \string\DeclareFontShape{#1}{#2}{b}{n}{<->ssub * #3/bx/n}{}^^J
- \string\DeclareFontShape{#1}{#2}{b}{it}{<->ssub * #3/bx/it}{}^^J
- \string\DeclareFontShape{#1}{#2}{b}{sl}{<->ssub * #3/bx/sl}{}^^J
- \string\DeclareFontShape{#1}{#2}{b}{sc}{<->ssub * #3/bx/sc}{}^^J
- }%
- \closeout15
- }
-\@onlypreamble\substitutefontfamily
-% \end{macrocode}
-%
-% \end{macro}
-%
-% \subsection{Encoding and fonts}
-%
-% Because documents may use non-ASCII font encodings, we make sure
-% that the logos of \TeX\ and \LaTeX\ always come out in the right
-% encoding. There is a list of non-ASCII encodings. Requested
-% encodings are currently stored in |\@fontenc@load@list|. If a
-% non-ASCII has been loaded, we define versions of |\TeX| and |\LaTeX|
-% for them using |\ensureascii|. The default ASCII encoding is set,
-% too (in reverse order): the ``main'' encoding (when the document
-% begins), the last loaded, or |OT1|.
-%
-% \begin{macro}{\ensureascii}
-%
-% \begin{macrocode}
-\bbl@trace{Encoding and fonts}
-\newcommand\BabelNonASCII{LGR,X2,OT2,OT3,OT6,LHE,LWN,LMA,LMC,LMS,LMU}
-\newcommand\BabelNonText{TS1,T3,TS3}
-\let\org@TeX\TeX
-\let\org@LaTeX\LaTeX
-\let\ensureascii\@firstofone
-\AtBeginDocument{%
- \def\@elt#1{,#1,}%
- \edef\bbl@tempa{\expandafter\@gobbletwo\@fontenc@load@list}%
- \let\@elt\relax
- \let\bbl@tempb\@empty
- \def\bbl@tempc{OT1}%
- \bbl@foreach\BabelNonASCII{% LGR loaded in a non-standard way
- \bbl@ifunset{T@#1}{}{\def\bbl@tempb{#1}}}%
- \bbl@foreach\bbl@tempa{%
- \bbl@xin@{#1}{\BabelNonASCII}%
- \ifin@
- \def\bbl@tempb{#1}% Store last non-ascii
- \else\bbl@xin@{#1}{\BabelNonText}% Pass
- \ifin@\else
- \def\bbl@tempc{#1}% Store last ascii
- \fi
- \fi}%
- \ifx\bbl@tempb\@empty\else
- \bbl@xin@{,\cf@encoding,}{,\BabelNonASCII,\BabelNonText,}%
- \ifin@\else
- \edef\bbl@tempc{\cf@encoding}% The default if ascii wins
- \fi
- \edef\ensureascii#1{%
- {\noexpand\fontencoding{\bbl@tempc}\noexpand\selectfont#1}}%
- \DeclareTextCommandDefault{\TeX}{\ensureascii{\org@TeX}}%
- \DeclareTextCommandDefault{\LaTeX}{\ensureascii{\org@LaTeX}}%
- \fi}
-% \end{macrocode}
-%
-% \end{macro}
-%
-% Now comes the old deprecated stuff (with a little change in 3.9l,
-% for \textsf{fontspec}). The first thing we need to do is to
-% determine, at |\begin{document}|, which latin fontencoding to use.
-%
-% \begin{macro}{\latinencoding}
-% When text is being typeset in an encoding other than `latin'
-% (\texttt{OT1} or \texttt{T1}), it would be nice to still have
-% Roman numerals come out in the Latin encoding.
-% So we first assume that the current encoding at the end
-% of processing the package is the Latin encoding.
-%
-% \begin{macrocode}
-\AtEndOfPackage{\edef\latinencoding{\cf@encoding}}
-% \end{macrocode}
-%
-% But this might be overruled with a later loading of the package
-% \pkg{fontenc}. Therefore we check at the execution of
-% |\begin{document}| whether it was loaded with the \Lopt{T1}
-% option. The normal way to do this (using |\@ifpackageloaded|) is
-% disabled for this package. Now we have to revert to parsing the
-% internal macro |\@filelist| which contains all the filenames
-% loaded.
-%
-% \begin{macrocode}
-\AtBeginDocument{%
- \@ifpackageloaded{fontspec}%
- {\xdef\latinencoding{%
- \ifx\UTFencname\@undefined
- EU\ifcase\bbl@engine\or2\or1\fi
- \else
- \UTFencname
- \fi}}%
- {\gdef\latinencoding{OT1}%
- \ifx\cf@encoding\bbl@t@one
- \xdef\latinencoding{\bbl@t@one}%
- \else
- \def\@elt#1{,#1,}%
- \edef\bbl@tempa{\expandafter\@gobbletwo\@fontenc@load@list}%
- \let\@elt\relax
- \bbl@xin@{,T1,}\bbl@tempa
- \ifin@
- \xdef\latinencoding{\bbl@t@one}%
- \fi
- \fi}}
-% \end{macrocode}
-%
-% \end{macro}
-%
-% \begin{macro}{\latintext}
-% Then we can define the command |\latintext| which is a
-% declarative switch to a latin font-encoding. Usage of this macro
-% is deprecated.
-%
-% \begin{macrocode}
-\DeclareRobustCommand{\latintext}{%
- \fontencoding{\latinencoding}\selectfont
- \def\encodingdefault{\latinencoding}}
-% \end{macrocode}
-%
-% \end{macro}
-%
-% \begin{macro}{\textlatin}
-% This command takes an argument which is then typeset using the
-% requested font encoding. In order to avoid many encoding switches
-% it operates in a local scope.
-%
-% \begin{macrocode}
-\ifx\@undefined\DeclareTextFontCommand
- \DeclareRobustCommand{\textlatin}[1]{\leavevmode{\latintext #1}}
-\else
- \DeclareTextFontCommand{\textlatin}{\latintext}
-\fi
-% \end{macrocode}
-%
-% For several functions, we need to execute some code with
-% |\selectfont|. With \LaTeX\ 2021-06-01, there is a hook for this
-% purpose, but in older versions the \LaTeX{} command is patched (the
-% latter solution will be eventually removed).
-%
-% \begin{macrocode}
-\bbl@ifformatlater{2021-06-01}%
- {\def\bbl@patchfont#1{\AddToHook{selectfont}{#1}}}
- {\def\bbl@patchfont#1{%
- \expandafter\bbl@add\csname selectfont \endcsname{#1}%
- \expandafter\bbl@toglobal\csname selectfont \endcsname}}
-% \end{macrocode}
-%
-% \end{macro}
-%
-% \subsection{Basic bidi support}
-%
-% \textbf{Work in progress.} This code is currently placed here for
-% practical reasons. It will be moved to the correct place soon, I
-% hope.
-%
-% It is loosely based on |rlbabel.def|, but most of it has been
-% developed from scratch. This \babel{} module (by Johannes Braams and
-% Boris Lavva) has served the purpose of typesetting R documents for
-% two decades, and despite its flaws I think it is still a good starting
-% point (some parts have been copied here almost verbatim), partly
-% thanks to its simplicity. I've also looked at \textsc{arabi} (by
-% Youssef Jabri), which is compatible with \babel{}.
-%
-% There are two ways of modifying macros to make them “bidi”, namely,
-% by patching the internal low-level macros (which is what I have done
-% with lists, columns, counters, tocs, much like |rlbabel| did), and
-% by introducing a “middle layer” just below the user interface
-% (sectioning, footnotes).
-%
-% \begin{itemize}
-% \item pdftex provides a minimal support for bidi text, and it
-% must be done by hand. Vertical typesetting is not possible.
-% \item \xetex{} is somewhat better, thanks to its font engine
-% (even if not always reliable) and a few additional tools. However,
-% very little is done at the paragraph level. Another challenging
-% problem is text direction does not honour \TeX{} grouping.
-% \item \luatex{} can provide the most complete solution, as we can
-% manipulate almost freely the node list, the generated lines,
-% and so on, but bidi text does not work out of the box and some
-% development is necessary. It also provides tools to properly
-% set left-to-right and right-to-left page layouts. As Lua\TeX-ja
-% shows, vertical typesetting is possible, too.
-% \end{itemize}
-%
-% \begin{macrocode}
-\bbl@trace{Loading basic (internal) bidi support}
-\ifodd\bbl@engine
-\else % TODO. Move to txtbabel
- \ifnum\bbl@bidimode>100 \ifnum\bbl@bidimode<200
- \bbl@error
- {The bidi method 'basic' is available only in\\%
- luatex. I'll continue with 'bidi=default', so\\%
- expect wrong results}%
- {See the manual for further details.}%
- \let\bbl@beforeforeign\leavevmode
- \AtEndOfPackage{%
- \EnableBabelHook{babel-bidi}%
- \bbl@xebidipar}
- \fi\fi
- \def\bbl@loadxebidi#1{%
- \ifx\RTLfootnotetext\@undefined
- \AtEndOfPackage{%
- \EnableBabelHook{babel-bidi}%
- \ifx\fontspec\@undefined
- \bbl@loadfontspec % bidi needs fontspec
- \fi
- \usepackage#1{bidi}}%
- \fi}
- \ifnum\bbl@bidimode>200
- \ifcase\expandafter\@gobbletwo\the\bbl@bidimode\or
- \bbl@tentative{bidi=bidi}
- \bbl@loadxebidi{}
- \or
- \bbl@loadxebidi{[rldocument]}
- \or
- \bbl@loadxebidi{}
- \fi
- \fi
-\fi
-% TODO? Separate:
-\ifnum\bbl@bidimode=\@ne
- \let\bbl@beforeforeign\leavevmode
- \ifodd\bbl@engine
- \newattribute\bbl@attr@dir
- \directlua{ Babel.attr_dir = luatexbase.registernumber'bbl@attr@dir' }
- \bbl@exp{\output{\bodydir\pagedir\the\output}}
- \fi
- \AtEndOfPackage{%
- \EnableBabelHook{babel-bidi}%
- \ifodd\bbl@engine\else
- \bbl@xebidipar
- \fi}
-\fi
-% \end{macrocode}
-%
-% Now come the macros used to set the direction when a language is
-% switched. First the (mostly) common macros.
-%
-% \begin{macrocode}
-\bbl@trace{Macros to switch the text direction}
-\def\bbl@alscripts{,Arabic,Syriac,Thaana,}
-\def\bbl@rscripts{% TODO. Base on codes ??
- ,Imperial Aramaic,Avestan,Cypriot,Hatran,Hebrew,%
- Old Hungarian,Old Hungarian,Lydian,Mandaean,Manichaean,%
- Manichaean,Meroitic Cursive,Meroitic,Old North Arabian,%
- Nabataean,N'Ko,Orkhon,Palmyrene,Inscriptional Pahlavi,%
- Psalter Pahlavi,Phoenician,Inscriptional Parthian,Samaritan,%
- Old South Arabian,}%
-\def\bbl@provide@dirs#1{%
- \bbl@xin@{\csname bbl@sname@#1\endcsname}{\bbl@alscripts\bbl@rscripts}%
- \ifin@
- \global\bbl@csarg\chardef{wdir@#1}\@ne
- \bbl@xin@{\csname bbl@sname@#1\endcsname}{\bbl@alscripts}%
- \ifin@
- \global\bbl@csarg\chardef{wdir@#1}\tw@ % useless in xetex
- \fi
- \else
- \global\bbl@csarg\chardef{wdir@#1}\z@
- \fi
- \ifodd\bbl@engine
- \bbl@csarg\ifcase{wdir@#1}%
- \directlua{ Babel.locale_props[\the\localeid].textdir = 'l' }%
- \or
- \directlua{ Babel.locale_props[\the\localeid].textdir = 'r' }%
- \or
- \directlua{ Babel.locale_props[\the\localeid].textdir = 'al' }%
- \fi
- \fi}
-\def\bbl@switchdir{%
- \bbl@ifunset{bbl@lsys@\languagename}{\bbl@provide@lsys{\languagename}}{}%
- \bbl@ifunset{bbl@wdir@\languagename}{\bbl@provide@dirs{\languagename}}{}%
- \bbl@exp{\\\bbl@setdirs\bbl@cl{wdir}}}
-\def\bbl@setdirs#1{% TODO - math
- \ifcase\bbl@select@type % TODO - strictly, not the right test
- \bbl@bodydir{#1}%
- \bbl@pardir{#1}%
- \fi
- \bbl@textdir{#1}}
-% TODO. Only if \bbl@bidimode > 0?:
-\AddBabelHook{babel-bidi}{afterextras}{\bbl@switchdir}
-\DisableBabelHook{babel-bidi}
-% \end{macrocode}
-%
-% Now the engine-dependent macros. TODO. Must be moved to the engine
-% files.
-%
-% \begin{macrocode}
-\ifodd\bbl@engine % luatex=1
-\else % pdftex=0, xetex=2
- \newcount\bbl@dirlevel
- \chardef\bbl@thetextdir\z@
- \chardef\bbl@thepardir\z@
- \def\bbl@textdir#1{%
- \ifcase#1\relax
- \chardef\bbl@thetextdir\z@
- \bbl@textdir@i\beginL\endL
- \else
- \chardef\bbl@thetextdir\@ne
- \bbl@textdir@i\beginR\endR
- \fi}
- \def\bbl@textdir@i#1#2{%
- \ifhmode
- \ifnum\currentgrouplevel>\z@
- \ifnum\currentgrouplevel=\bbl@dirlevel
- \bbl@error{Multiple bidi settings inside a group}%
- {I'll insert a new group, but expect wrong results.}%
- \bgroup\aftergroup#2\aftergroup\egroup
- \else
- \ifcase\currentgrouptype\or % 0 bottom
- \aftergroup#2% 1 simple {}
- \or
- \bgroup\aftergroup#2\aftergroup\egroup % 2 hbox
- \or
- \bgroup\aftergroup#2\aftergroup\egroup % 3 adj hbox
- \or\or\or % vbox vtop align
- \or
- \bgroup\aftergroup#2\aftergroup\egroup % 7 noalign
- \or\or\or\or\or\or % output math disc insert vcent mathchoice
- \or
- \aftergroup#2% 14 \begingroup
- \else
- \bgroup\aftergroup#2\aftergroup\egroup % 15 adj
- \fi
- \fi
- \bbl@dirlevel\currentgrouplevel
- \fi
- #1%
- \fi}
- \def\bbl@pardir#1{\chardef\bbl@thepardir#1\relax}
- \let\bbl@bodydir\@gobble
- \let\bbl@pagedir\@gobble
- \def\bbl@dirparastext{\chardef\bbl@thepardir\bbl@thetextdir}
-% \end{macrocode}
-%
-% The following command is executed only if there is a right-to-left
-% script (once). It activates the |\everypar| hack for \xetex, to
-% properly handle the par direction. Note text and par dirs are
-% decoupled to some extent (although not completely).
-%
-% \begin{macrocode}
- \def\bbl@xebidipar{%
- \let\bbl@xebidipar\relax
- \TeXXeTstate\@ne
- \def\bbl@xeeverypar{%
- \ifcase\bbl@thepardir
- \ifcase\bbl@thetextdir\else\beginR\fi
- \else
- {\setbox\z@\lastbox\beginR\box\z@}%
- \fi}%
- \let\bbl@severypar\everypar
- \newtoks\everypar
- \everypar=\bbl@severypar
- \bbl@severypar{\bbl@xeeverypar\the\everypar}}
- \ifnum\bbl@bidimode>200
- \let\bbl@textdir@i\@gobbletwo
- \let\bbl@xebidipar\@empty
- \AddBabelHook{bidi}{foreign}{%
- \def\bbl@tempa{\def\BabelText####1}%
- \ifcase\bbl@thetextdir
- \expandafter\bbl@tempa\expandafter{\BabelText{\LR{##1}}}%
- \else
- \expandafter\bbl@tempa\expandafter{\BabelText{\RL{##1}}}%
- \fi}
- \def\bbl@pardir#1{\ifcase#1\relax\setLR\else\setRL\fi}
- \fi
-\fi
-% \end{macrocode}
-%
-% A tool for weak L (mainly digits). We also disable warnings with
-% \textsf{hyperref}.
-%
-% \begin{macrocode}
-\DeclareRobustCommand\babelsublr[1]{\leavevmode{\bbl@textdir\z@#1}}
-\AtBeginDocument{%
- \ifx\pdfstringdefDisableCommands\@undefined\else
- \ifx\pdfstringdefDisableCommands\relax\else
- \pdfstringdefDisableCommands{\let\babelsublr\@firstofone}%
- \fi
- \fi}
-% \end{macrocode}
-%
-% \subsection{Local Language Configuration}
-%
-% \begin{macro}{\loadlocalcfg}
-%
-% At some sites it may be necessary to add site-specific actions to
-% a language definition file. This can be done by creating a file
-% with the same name as the language definition file, but with the
-% extension \file{.cfg}. For instance the file \file{norsk.cfg}
-% will be loaded when the language definition file \file{norsk.ldf}
-% is loaded.
-%
-% For plain-based formats we don't want to override the definition
-% of |\loadlocalcfg| from \file{plain.def}.
-%
-% \begin{macrocode}
-\bbl@trace{Local Language Configuration}
-\ifx\loadlocalcfg\@undefined
- \@ifpackagewith{babel}{noconfigs}%
- {\let\loadlocalcfg\@gobble}%
- {\def\loadlocalcfg#1{%
- \InputIfFileExists{#1.cfg}%
- {\typeout{*************************************^^J%
- * Local config file #1.cfg used^^J%
- *}}%
- \@empty}}
-\fi
-% \end{macrocode}%
-% \end{macro}
-%
-% \subsection{Language options}
-%
-% Languages are loaded when processing the corresponding option
-% \textit{except} if a |main| language has been set. In such a
-% case, it is not loaded until all options has been processed.
-% The following macro inputs the ldf file and does some additional
-% checks (|\input| works, too, but possible errors are not catched).
-%
-% \begin{macrocode}
-\bbl@trace{Language options}
-\let\bbl@afterlang\relax
-\let\BabelModifiers\relax
-\let\bbl@loaded\@empty
-\def\bbl@load@language#1{%
- \InputIfFileExists{#1.ldf}%
- {\edef\bbl@loaded{\CurrentOption
- \ifx\bbl@loaded\@empty\else,\bbl@loaded\fi}%
- \expandafter\let\expandafter\bbl@afterlang
- \csname\CurrentOption.ldf-h@@k\endcsname
- \expandafter\let\expandafter\BabelModifiers
- \csname bbl@mod@\CurrentOption\endcsname}%
- {\bbl@error{%
- Unknown option '\CurrentOption'. Either you misspelled it\\%
- or the language definition file \CurrentOption.ldf was not found}{%
- Valid options are, among others: shorthands=, KeepShorthandsActive,\\%
- activeacute, activegrave, noconfigs, safe=, main=, math=\\%
- headfoot=, strings=, config=, hyphenmap=, or a language name.}}}
-% \end{macrocode}
-%
-% Now, we set a few language options whose names are different from
-% |ldf| files. These declarations are preserved for backwards
-% compatibility, but they must be eventually removed. Use proxy files
-% instead.
-%
-% \begin{macrocode}
-\def\bbl@try@load@lang#1#2#3{%
- \IfFileExists{\CurrentOption.ldf}%
- {\bbl@load@language{\CurrentOption}}%
- {#1\bbl@load@language{#2}#3}}
-\DeclareOption{hebrew}{%
- \input{rlbabel.def}%
- \bbl@load@language{hebrew}}
-\DeclareOption{hungarian}{\bbl@try@load@lang{}{magyar}{}}
-\DeclareOption{lowersorbian}{\bbl@try@load@lang{}{lsorbian}{}}
-\DeclareOption{nynorsk}{\bbl@try@load@lang{}{norsk}{}}
-\DeclareOption{polutonikogreek}{%
- \bbl@try@load@lang{}{greek}{\languageattribute{greek}{polutoniko}}}
-\DeclareOption{russian}{\bbl@try@load@lang{}{russianb}{}}
-\DeclareOption{ukrainian}{\bbl@try@load@lang{}{ukraineb}{}}
-\DeclareOption{uppersorbian}{\bbl@try@load@lang{}{usorbian}{}}
-% \end{macrocode}
-%
-% Another way to extend the list of `known' options for \babel\ was
-% to create the file \file{bblopts.cfg} in which one can add option
-% declarations. However, this mechanism is deprecated -- if you
-% want an alternative name for a language, just create a new |.ldf|
-% file loading the actual one. You can also set the name
-% of the file with the package option |config=<name>|, which will
-% load |<name>.cfg| instead.
-%
-% \begin{macrocode}
-\ifx\bbl@opt@config\@nnil
- \@ifpackagewith{babel}{noconfigs}{}%
- {\InputIfFileExists{bblopts.cfg}%
- {\typeout{*************************************^^J%
- * Local config file bblopts.cfg used^^J%
- *}}%
- {}}%
-\else
- \InputIfFileExists{\bbl@opt@config.cfg}%
- {\typeout{*************************************^^J%
- * Local config file \bbl@opt@config.cfg used^^J%
- *}}%
- {\bbl@error{%
- Local config file '\bbl@opt@config.cfg' not found}{%
- Perhaps you misspelled it.}}%
-\fi
-% \end{macrocode}
-%
-% Recognizing global options in packages not having a closed set of
-% them is not trivial, as for them to be processed they must be
-% defined explicitly. So, package options not yet taken into
-% account and stored in |bbl@language@opts| are assumed to be
-% languages (note this list also contains the language given with
-% |main|). If not declared above, the names of the option and the
-% file are the same.
-%
-% \begin{macrocode}
-\let\bbl@tempc\relax
-\bbl@foreach\bbl@language@opts{%
- \ifcase\bbl@iniflag % Default
- \bbl@ifunset{ds@#1}%
- {\DeclareOption{#1}{\bbl@load@language{#1}}}%
- {}%
- \or % provide=*
- \@gobble % case 2 same as 1
- \or % provide+=*
- \bbl@ifunset{ds@#1}%
- {\IfFileExists{#1.ldf}{}%
- {\IfFileExists{babel-#1.tex}{}{\@namedef{ds@#1}{}}}}%
- {}%
- \bbl@ifunset{ds@#1}%
- {\def\bbl@tempc{#1}%
- \DeclareOption{#1}{%
- \ifnum\bbl@iniflag>\@ne
- \bbl@ldfinit
- \babelprovide[import]{#1}%
- \bbl@afterldf{}%
- \else
- \bbl@load@language{#1}%
- \fi}}%
- {}%
- \or % provide*=*
- \def\bbl@tempc{#1}%
- \bbl@ifunset{ds@#1}%
- {\DeclareOption{#1}{%
- \bbl@ldfinit
- \babelprovide[import]{#1}%
- \bbl@afterldf{}}}%
- {}%
- \fi}
-% \end{macrocode}
-%
-% Now, we make sure an option is explicitly declared for any language
-% set as global option, by checking if an |ldf| exists. The previous
-% step was, in fact, somewhat redundant, but that way we minimize
-% accessing the file system just to see if the option could be a
-% language.
-%
-% \begin{macrocode}
-\let\bbl@tempb\@nnil
-\bbl@foreach\@classoptionslist{%
- \bbl@ifunset{ds@#1}%
- {\IfFileExists{#1.ldf}%
- {\def\bbl@tempb{#1}%
- \DeclareOption{#1}{%
- \ifnum\bbl@iniflag>\@ne
- \bbl@ldfinit
- \babelprovide[import]{#1}%
- \bbl@afterldf{}%
- \else
- \bbl@load@language{#1}%
- \fi}}%
- {\IfFileExists{babel-#1.tex}% TODO. Copypaste pattern
- {\def\bbl@tempb{#1}%
- \DeclareOption{#1}{%
- \ifnum\bbl@iniflag>\@ne
- \bbl@ldfinit
- \babelprovide[import]{#1}%
- \bbl@afterldf{}%
- \else
- \bbl@load@language{#1}%
- \fi}}%
- {}}}%
- {}}
-% \end{macrocode}
-%
-% If a main language has been set, store it for the third pass.
-%
-% \begin{macrocode}
-\ifnum\bbl@iniflag=\z@\else
- \ifx\bbl@opt@main\@nnil
- \ifx\bbl@tempc\relax
- \let\bbl@opt@main\bbl@tempb
- \else
- \let\bbl@opt@main\bbl@tempc
- \fi
- \fi
-\fi
-\ifx\bbl@opt@main\@nnil\else
- \expandafter
- \let\expandafter\bbl@loadmain\csname ds@\bbl@opt@main\endcsname
- \expandafter\let\csname ds@\bbl@opt@main\endcsname\@empty
-\fi
-% \end{macrocode}
-%
-% And we are done, because all options for this pass has been
-% declared. Those already processed in the first pass are just
-% ignored.
-%
-% The options have to be processed in the order in which the user
-% specified them (except, of course, global options, which \LaTeX{}
-% processes before):
-%
-% \begin{macrocode}
-\def\AfterBabelLanguage#1{%
- \bbl@ifsamestring\CurrentOption{#1}{\global\bbl@add\bbl@afterlang}{}}
-\DeclareOption*{}
-\ProcessOptions*
-% \end{macrocode}
-%
-% This finished the second pass. Now the third one begins, which
-% loads the main language set with the key |main|. A warning is
-% raised if the main language is not the same as the last named
-% one, or if the value of the key |main| is not a language. Then
-% execute directly the option (because it could be used only in
-% |main|). After loading all languages, we deactivate
-% |\AfterBabelLanguage|.
-%
-% \begin{macrocode}
-\bbl@trace{Option 'main'}
-\ifx\bbl@opt@main\@nnil
- \edef\bbl@tempa{\@classoptionslist,\bbl@language@opts}
- \let\bbl@tempc\@empty
- \bbl@for\bbl@tempb\bbl@tempa{%
- \bbl@xin@{,\bbl@tempb,}{,\bbl@loaded,}%
- \ifin@\edef\bbl@tempc{\bbl@tempb}\fi}
- \def\bbl@tempa#1,#2\@nnil{\def\bbl@tempb{#1}}
- \expandafter\bbl@tempa\bbl@loaded,\@nnil
- \ifx\bbl@tempb\bbl@tempc\else
- \bbl@warning{%
- Last declared language option is '\bbl@tempc',\\%
- but the last processed one was '\bbl@tempb'.\\%
- The main language can't be set as both a global\\%
- and a package option. Use 'main=\bbl@tempc' as\\%
- option. Reported}%
- \fi
-\else
- \ifodd\bbl@iniflag % case 1,3
- \bbl@ldfinit
- \let\CurrentOption\bbl@opt@main
- \ifx\bbl@opt@provide\@nnil
- \bbl@exp{\\\babelprovide[import,main]{\bbl@opt@main}}%
- \else
- \bbl@exp{\\\bbl@forkv{\@nameuse{@raw@opt@babel.sty}}}{%
- \bbl@xin@{,provide,}{,#1,}%
- \ifin@
- \def\bbl@opt@provide{#2}%
- \bbl@replace\bbl@opt@provide{;}{,}%
- \fi}%
- \bbl@exp{%
- \\\babelprovide[\bbl@opt@provide,import,main]{\bbl@opt@main}}%
- \fi
- \bbl@afterldf{}%
- \else % case 0,2
- \chardef\bbl@iniflag\z@ % Force ldf
- \expandafter\let\csname ds@\bbl@opt@main\endcsname\bbl@loadmain
- \ExecuteOptions{\bbl@opt@main}
- \DeclareOption*{}%
- \ProcessOptions*
- \fi
-\fi
-\def\AfterBabelLanguage{%
- \bbl@error
- {Too late for \string\AfterBabelLanguage}%
- {Languages have been loaded, so I can do nothing}}
-% \end{macrocode}
-%
-% In order to catch the case where the user forgot to specify a
-% language we check whether |\bbl@main@language|, has become
-% defined. If not, no language has been loaded and an error
-% message is displayed.
-%
-% \begin{macrocode}
-\ifx\bbl@main@language\@undefined
- \bbl@info{%
- You haven't specified a language. I'll use 'nil'\\%
- as the main language. Reported}
- \bbl@load@language{nil}
-\fi
%</package>
%<*core>
% \end{macrocode}
%
-% \section{The kernel of Babel (\texttt{babel.def}, common)}
-%
-% The kernel of the \babel\ system is currently stored in
-% \file{babel.def}. The file \file{babel.def} contains most of the
-% code. The file \file{hyphen.cfg} is a file that can be loaded into
-% the format, which is necessary when you want to be able to switch
-% hyphenation patterns.
-%
-% Because plain \TeX\ users might want to use some of the features of
-% the \babel{} system too, care has to be taken that plain \TeX\ can
-% process the files. For this reason the current format will have to
-% be checked in a number of places. Some of the code below is common
-% to plain \TeX\ and \LaTeX, some of it is for the \LaTeX\ case only.
+% \subsection{Interlude for Plain}
%
-% Plain formats based on etex (etex, xetex, luatex) don't load
-% |hyphen.cfg| but |etex.src|, which follows a different naming
-% convention, so we need to define the babel names. It presumes
-% |language.def| exists and it is the same file used when formats were
-% created.
-%
-% \subsection{Tools}
+% Because of the way \pkg{docstrip} works, we need to insert some code
+% for Plain here. However, the tools provided by the \babel{}
+% installer for literate programming makes this section a short
+% interlude, because the actual code is below, tagged as
+% \textit{Emulate LaTeX}.
%
% \begin{macrocode}
\ifx\ldf@quit\@undefined\else
\endinput\fi % Same line!
<@Make sure ProvidesFile is defined@>
\ProvidesFile{babel.def}[<@date@> <@version@> Babel common definitions]
-% \end{macrocode}
-%
-% The file |babel.def| expects some definitions made in the \LaTeXe{}
-% style file. So, in Plain{} we must provide at least
-% some predefined values as well some tools to set them (even if not
-% all options are available). There are no package options, and
-% therefore and alternative mechanism is provided. For the moment,
-% only |\babeloptionstrings| and |\babeloptionmath| are provided,
-% which can be defined before loading \babel. |\BabelModifiers| can be
-% set too (but not sure it works).
-%
-% \begin{macrocode}
\ifx\AtBeginDocument\@undefined % TODO. change test.
<@Emulate LaTeX@>
- \def\languagename{english}%
- \let\bbl@opt@shorthands\@nnil
- \def\bbl@ifshorthand#1#2#3{#2}%
- \let\bbl@language@opts\@empty
- \ifx\babeloptionstrings\@undefined
- \let\bbl@opt@strings\@nnil
- \else
- \let\bbl@opt@strings\babeloptionstrings
- \fi
- \def\BabelStringsDefault{generic}
- \def\bbl@tempa{normal}
- \ifx\babeloptionmath\bbl@tempa
- \def\bbl@mathnormal{\noexpand\textormath}
- \fi
- \def\AfterBabelLanguage#1#2{}
- \ifx\BabelModifiers\@undefined\let\BabelModifiers\relax\fi
- \let\bbl@afterlang\relax
- \def\bbl@opt@safe{BR}
- \ifx\@uclclist\@undefined\let\@uclclist\@empty\fi
- \ifx\bbl@trace\@undefined\def\bbl@trace#1{}\fi
- \expandafter\newif\csname ifbbl@single\endcsname
- \chardef\bbl@bidimode\z@
\fi
% \end{macrocode}
%
-% And continue.
+% That is all for the moment. Now follows some common stuff, for both
+% Plain and \LaTeX{}. After it, we will resume the \LaTeX-only stuff.
+%
+% \begin{macrocode}
+%</core>
+%<*package|core>
+% \end{macrocode}
%
% \section{Multiple languages}
%
@@ -7127,6 +5873,8 @@ help from Bernd Raichle, for which I am grateful.
% counter.
%
% \begin{macrocode}
+\def\bbl@version{<@version@>}
+\def\bbl@date{<@date@>}
<@Define core switching macros@>
% \end{macrocode}
%
@@ -7136,8 +5884,6 @@ help from Bernd Raichle, for which I am grateful.
% table can be used.
%
% \begin{macrocode}
-\def\bbl@version{<@version@>}
-\def\bbl@date{<@date@>}
\def\adddialect#1#2{%
\global\chardef#1#2\relax
\bbl@usehooks{adddialect}{{#1}{#2}}%
@@ -7158,7 +5904,7 @@ help from Bernd Raichle, for which I am grateful.
% \end{macro}
%
% |\bbl@iflanguage| executes code only if the language |l@|
-% exists. Otherwise raises and error.
+% exists. Otherwise raises an error.
%
% The argument of |\bbl@fixname| has to be a macro name, as it may get
% ``fixed'' if casing (lc/uc) is wrong. It's an attempt to fix a
@@ -7526,18 +6272,7 @@ help from Bernd Raichle, for which I am grateful.
\fi}
%
\let\bbl@restorelastskip\relax
-\def\bbl@savelastskip{%
- \let\bbl@restorelastskip\relax
- \ifvmode
- \ifdim\lastskip=\z@
- \let\bbl@restorelastskip\nobreak
- \else
- \bbl@exp{%
- \def\\\bbl@restorelastskip{%
- \skip@=\the\lastskip
- \\\nobreak \vskip-\skip@ \vskip\skip@}}%
- \fi
- \fi}
+\let\bbl@savelastskip\relax
%
\newif\ifbbl@bcpallowed
\bbl@bcpallowedfalse
@@ -8044,27 +6779,6 @@ help from Bernd Raichle, for which I am grateful.
%
% \begin{macrocode}
\edef\bbl@nulllanguage{\string\language=0}
-\ifx\PackageError\@undefined % TODO. Move to Plain
- \def\bbl@error#1#2{%
- \begingroup
- \newlinechar=`\^^J
- \def\\{^^J(babel) }%
- \errhelp{#2}\errmessage{\\#1}%
- \endgroup}
- \def\bbl@warning#1{%
- \begingroup
- \newlinechar=`\^^J
- \def\\{^^J(babel) }%
- \message{\\#1}%
- \endgroup}
- \let\bbl@infowarn\bbl@warning
- \def\bbl@info#1{%
- \begingroup
- \newlinechar=`\^^J
- \def\\{^^J}%
- \wlog{#1}%
- \endgroup}
-\fi
\def\bbl@nocaption{\protect\bbl@nocaption@i}
\def\bbl@nocaption@i#1#2{% 1: text to be printed 2: caption macro \langXname
\global\@namedef{#2}{\textbf{?#1?}}%
@@ -8102,7 +6816,8 @@ help from Bernd Raichle, for which I am grateful.
% Here ended switch.def
% \end{macrocode}
%
-% Here ended |switch.def|.
+% Here ended the now discarded |switch.def|. Here also (currently) ends
+% the \textsf{base} option.
%
% \begin{macrocode}
\ifx\directlua\@undefined\else
@@ -8248,12 +6963,12 @@ help from Bernd Raichle, for which I am grateful.
\newcommand\EnableBabelHook[1]{\bbl@csarg\let{hk@#1}\@firstofone}
\newcommand\DisableBabelHook[1]{\bbl@csarg\let{hk@#1}\@gobble}
\def\bbl@usehooks#1#2{%
- \ifx\UseHook\@undefined\else\UseHook{babel/#1}\fi
+ \ifx\UseHook\@undefined\else\UseHook{babel/*/#1}\fi
\def\bbl@elth##1{%
\bbl@cs{hk@##1}{\bbl@cs{ev@##1@#1@}#2}}%
\bbl@cs{ev@#1@}%
\ifx\languagename\@undefined\else % Test required for Plain (?)
- \ifx\UseHook\@undefined\else\UseHook{babel/#1/\languagename}\fi
+ \ifx\UseHook\@undefined\else\UseHook{babel/\languagename/#1}\fi
\def\bbl@elth##1{%
\bbl@cs{hk@##1}{\bbl@cl{ev@##1@#1}#2}}%
\bbl@cl{ev@#1}%
@@ -8886,7 +7601,7 @@ help from Bernd Raichle, for which I am grateful.
%
% \begin{macrocode}
\begingroup
-\bbl@ifunset{ifincsname}% TODO. Ugly. Correct?
+\bbl@ifunset{ifincsname}% TODO. Ugly. Correct? Only Plain?
{\gdef\active@prefix#1{%
\ifx\protect\@typeset@protect
\else
@@ -10908,9 +9623,8 @@ help from Bernd Raichle, for which I am grateful.
\ifx\bbl@KVP@captions\@nil\else
\bbl@ifunset{bbl@extracaps@#2}%
{\bbl@exp{\\\babelensure[exclude=\\\today]{#2}}}%
- {\toks@\expandafter\expandafter\expandafter
- {\csname bbl@extracaps@#2\endcsname}%
- \bbl@exp{\\\babelensure[exclude=\\\today,include=\the\toks@}]{#2}}%
+ {\bbl@exp{\\\babelensure[exclude=\\\today,
+ include=\[bbl@extracaps@#2]}]{#2}}%
\bbl@ifunset{bbl@ensure@\languagename}%
{\bbl@exp{%
\\\DeclareRobustCommand\<bbl@ensure@\languagename>[1]{%
@@ -11783,24 +10497,18 @@ help from Bernd Raichle, for which I am grateful.
\else
\def\bbl@patchchapter{%
\global\let\bbl@patchchapter\relax
+ \gdef\bbl@chfmt{%
+ \bbl@ifunset{bbl@\bbl@chaptype fmt@\languagename}%
+ {\@chapapp\space\thechapter}
+ {\@nameuse{bbl@\bbl@chaptype fmt@\languagename}}}
\bbl@add\appendix{\def\bbl@chaptype{appendix}}% Not harmful, I hope
+ \bbl@sreplace\ps@headings{\@chapapp\ \thechapter}{\bbl@chfmt}%
+ \bbl@sreplace\chaptermark{\@chapapp\ \thechapter}{\bbl@chfmt}%
+ \bbl@sreplace\@makechapterhead{\@chapapp\space\thechapter}{\bbl@chfmt}%
\bbl@toglobal\appendix
- \bbl@sreplace\ps@headings
- {\@chapapp\ \thechapter}%
- {\bbl@chapterformat}%
\bbl@toglobal\ps@headings
- \bbl@sreplace\chaptermark
- {\@chapapp\ \thechapter}%
- {\bbl@chapterformat}%
\bbl@toglobal\chaptermark
- \bbl@sreplace\@makechapterhead
- {\@chapapp\space\thechapter}%
- {\bbl@chapterformat}%
- \bbl@toglobal\@makechapterhead
- \gdef\bbl@chapterformat{%
- \bbl@ifunset{bbl@\bbl@chaptype fmt@\languagename}%
- {\@chapapp\space\thechapter}
- {\@nameuse{bbl@\bbl@chaptype fmt@\languagename}}}}
+ \bbl@toglobal\@makechapterhead}
\let\bbl@patchappendix\bbl@patchchapter
\fi\fi\fi
\ifx\@part\@undefined
@@ -11808,14 +10516,12 @@ help from Bernd Raichle, for which I am grateful.
\else
\def\bbl@patchpart{%
\global\let\bbl@patchpart\relax
- \bbl@sreplace\@part
- {\partname\nobreakspace\thepart}%
- {\bbl@partformat}%
- \bbl@toglobal\@part
\gdef\bbl@partformat{%
\bbl@ifunset{bbl@partfmt@\languagename}%
{\partname\nobreakspace\thepart}
- {\@nameuse{bbl@partfmt@\languagename}}}}
+ {\@nameuse{bbl@partfmt@\languagename}}}
+ \bbl@sreplace\@part{\partname\nobreakspace\thepart}{\bbl@partformat}%
+ \bbl@toglobal\@part}
\fi
% \end{macrocode}
%
@@ -11938,7 +10644,7 @@ help from Bernd Raichle, for which I am grateful.
\@namedef{bbl@inikv@transforms.posthyphenation}{%
\bbl@transforms\babelposthyphenation}
\def\bbl@transforms@aux#1#2#3,#4\relax{#1{#2}{#3}{#4}}
-\begingroup
+\begingroup % A hack. TODO. Don't require an specific order
\catcode`\%=12
\catcode`\&=14
\gdef\bbl@transforms#1#2#3{&%
@@ -12281,6 +10987,26 @@ help from Bernd Raichle, for which I am grateful.
\directlua{ Babel.ignore_pre_char = function(node)
return false
end }}
+\@namedef{bbl@ADJ@select.write@shift}{%
+ \let\bbl@restorelastskip\relax
+ \def\bbl@savelastskip{%
+ \let\bbl@restorelastskip\relax
+ \ifvmode
+ \ifdim\lastskip=\z@
+ \let\bbl@restorelastskip\nobreak
+ \else
+ \bbl@exp{%
+ \def\\\bbl@restorelastskip{%
+ \skip@=\the\lastskip
+ \\\nobreak \vskip-\skip@ \vskip\skip@}}%
+ \fi
+ \fi}}
+\@namedef{bbl@ADJ@select.write@keep}{%
+ \let\bbl@restorelastskip\relax
+ \let\bbl@savelastskip\relax}
+\@namedef{bbl@ADJ@select.write@omit}{%
+ \let\bbl@restorelastskip\relax
+ \def\bbl@savelastskip##1\bbl@restorelastskip{}}
% \end{macrocode}
%
% As the final task, load the code for lua. TODO: use babel name, override
@@ -12291,9 +11017,1171 @@ help from Bernd Raichle, for which I am grateful.
\input luababel.def
\fi
\fi
-%</core>
% \end{macrocode}
%
+% Continue with \LaTeX{}.
+%
+% \begin{macrocode}
+%</package|core>
+%<*package>
+% \end{macrocode}
+%
+% \subsection{Cross referencing macros}
+%
+% The \LaTeX\ book states:
+% \begin{quote}
+% The \emph{key} argument is any sequence of letters, digits, and
+% punctuation symbols; upper- and lowercase letters are regarded as
+% different.
+% \end{quote}
+% When the above quote should still be true when a document is
+% typeset in a language that has active characters, special care
+% has to be taken of the category codes of these characters when
+% they appear in an argument of the cross referencing macros.
+%
+% When a cross referencing command processes its argument, all
+% tokens in this argument should be character tokens with category
+% `letter' or `other'.
+%
+% The following package options control which macros are to be
+% redefined.
+%
+% \begin{macrocode}
+%<<*More package options>>
+\DeclareOption{safe=none}{\let\bbl@opt@safe\@empty}
+\DeclareOption{safe=bib}{\def\bbl@opt@safe{B}}
+\DeclareOption{safe=ref}{\def\bbl@opt@safe{R}}
+%<</More package options>>
+% \end{macrocode}
+%
+% \begin{macro}{\@newl@bel}
+%
+% First we open a new group to keep the changed setting of
+% |\protect| local and then we set the |@safe@actives| switch to
+% true to make sure that any shorthand that appears in any of the
+% arguments immediately expands to its non-active self.
+%
+% \begin{macrocode}
+\bbl@trace{Cross referencing macros}
+\ifx\bbl@opt@safe\@empty\else
+ \def\@newl@bel#1#2#3{%
+ {\@safe@activestrue
+ \bbl@ifunset{#1@#2}%
+ \relax
+ {\gdef\@multiplelabels{%
+ \@latex@warning@no@line{There were multiply-defined labels}}%
+ \@latex@warning@no@line{Label `#2' multiply defined}}%
+ \global\@namedef{#1@#2}{#3}}}
+% \end{macrocode}
+%
+% \end{macro}
+%
+% \begin{macro}{\@testdef}
+%
+% An internal \LaTeX\ macro used to test if the labels that have
+% been written on the |.aux| file have changed. It is called by
+% the |\enddocument| macro.
+%
+% \begin{macrocode}
+ \CheckCommand*\@testdef[3]{%
+ \def\reserved@a{#3}%
+ \expandafter\ifx\csname#1@#2\endcsname\reserved@a
+ \else
+ \@tempswatrue
+ \fi}
+% \end{macrocode}
+%
+% Now that we made sure that |\@testdef| still has the same definition
+% we can rewrite it. First we make the shorthands `safe'. Then we use
+% |\bbl@tempa| as an `alias' for the macro that contains the label
+% which is being checked. Then we define |\bbl@tempb| just as
+% |\@newl@bel| does it. When the label is defined we replace the
+% definition of |\bbl@tempa| by its meaning. If the label didn't
+% change, |\bbl@tempa| and |\bbl@tempb| should be identical macros.
+%
+% \begin{macrocode}
+ \def\@testdef#1#2#3{% TODO. With @samestring?
+ \@safe@activestrue
+ \expandafter\let\expandafter\bbl@tempa\csname #1@#2\endcsname
+ \def\bbl@tempb{#3}%
+ \@safe@activesfalse
+ \ifx\bbl@tempa\relax
+ \else
+ \edef\bbl@tempa{\expandafter\strip@prefix\meaning\bbl@tempa}%
+ \fi
+ \edef\bbl@tempb{\expandafter\strip@prefix\meaning\bbl@tempb}%
+ \ifx\bbl@tempa\bbl@tempb
+ \else
+ \@tempswatrue
+ \fi}
+\fi
+% \end{macrocode}
+%
+% \end{macro}
+%
+% \begin{macro}{\ref}
+% \begin{macro}{\pageref}
+%
+% The same holds for the macro |\ref| that references a label and
+% |\pageref| to reference a page. We make them robust as well (if
+% they weren't already) to prevent problems if they should become
+% expanded at the wrong moment.
+%
+% \begin{macrocode}
+\bbl@xin@{R}\bbl@opt@safe
+\ifin@
+ \bbl@redefinerobust\ref#1{%
+ \@safe@activestrue\org@ref{#1}\@safe@activesfalse}
+ \bbl@redefinerobust\pageref#1{%
+ \@safe@activestrue\org@pageref{#1}\@safe@activesfalse}
+\else
+ \let\org@ref\ref
+ \let\org@pageref\pageref
+\fi
+% \end{macrocode}
+%
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\@citex}
+%
+% The macro used to cite from a bibliography, |\cite|, uses an
+% internal macro, |\@citex|.
+% It is this internal macro that picks up the argument(s),
+% so we redefine this internal macro and leave |\cite| alone. The
+% first argument is used for typesetting, so the shorthands need
+% only be deactivated in the second argument.
+%
+% \begin{macrocode}
+\bbl@xin@{B}\bbl@opt@safe
+\ifin@
+ \bbl@redefine\@citex[#1]#2{%
+ \@safe@activestrue\edef\@tempa{#2}\@safe@activesfalse
+ \org@@citex[#1]{\@tempa}}
+% \end{macrocode}
+%
+% Unfortunately, the packages \pkg{natbib} and \pkg{cite} need a
+% different definition of |\@citex|...
+% To begin with, \pkg{natbib} has a definition for |\@citex| with
+% \emph{three} arguments... We only know that a package is loaded
+% when |\begin{document}| is executed, so we need to postpone the
+% different redefinition.
+%
+% \begin{macrocode}
+ \AtBeginDocument{%
+ \@ifpackageloaded{natbib}{%
+% \end{macrocode}
+%
+% Notice that we use |\def| here instead of |\bbl@redefine| because
+% |\org@@citex| is already defined and we don't want to overwrite
+% that definition (it would result in parameter stack overflow
+% because of a circular definition).
+%
+% (Recent versions of \pkg{natbib} change dynamically |\@citex|, so PR4087
+% doesn't seem fixable in a simple way. Just load \pkg{natbib} before.)
+%
+% \begin{macrocode}
+ \def\@citex[#1][#2]#3{%
+ \@safe@activestrue\edef\@tempa{#3}\@safe@activesfalse
+ \org@@citex[#1][#2]{\@tempa}}%
+ }{}}
+% \end{macrocode}
+%
+% The package \pkg{cite} has a definition of |\@citex| where the
+% shorthands need to be turned off in both arguments.
+%
+% \begin{macrocode}
+ \AtBeginDocument{%
+ \@ifpackageloaded{cite}{%
+ \def\@citex[#1]#2{%
+ \@safe@activestrue\org@@citex[#1]{#2}\@safe@activesfalse}%
+ }{}}
+% \end{macrocode}
+%
+% \end{macro}
+%
+% \begin{macro}{\nocite}
+%
+% The macro |\nocite| which is used to instruct BiB\TeX\ to
+% extract uncited references from the database.
+%
+% \begin{macrocode}
+ \bbl@redefine\nocite#1{%
+ \@safe@activestrue\org@nocite{#1}\@safe@activesfalse}
+% \end{macrocode}
+%
+% \end{macro}
+%
+% \begin{macro}{\bibcite}
+%
+% The macro that is used in the |.aux| file to
+% define citation labels. When packages such as \pkg{natbib} or
+% \pkg{cite} are not loaded its second argument is used to typeset the
+% citation label. In that case, this second argument can contain
+% active characters but is used in an environment where
+% |\@safe@activestrue| is in effect. This switch needs to be reset
+% inside the |\hbox| which contains the citation label. In order to
+% determine during \file{.aux} file processing which definition of
+% |\bibcite| is needed we define |\bibcite| in such a way that it
+% redefines itself with the proper definition. We call
+% |\bbl@cite@choice| to select the proper definition for |\bibcite|.
+% This new definition is then activated.
+%
+% \begin{macrocode}
+ \bbl@redefine\bibcite{%
+ \bbl@cite@choice
+ \bibcite}
+% \end{macrocode}
+%
+% \end{macro}
+%
+% \begin{macro}{\bbl@bibcite}
+%
+% The macro |\bbl@bibcite| holds the definition of |\bibcite|
+% needed when neither \pkg{natbib} nor \pkg{cite} is loaded.
+%
+% \begin{macrocode}
+ \def\bbl@bibcite#1#2{%
+ \org@bibcite{#1}{\@safe@activesfalse#2}}
+% \end{macrocode}
+%
+% \end{macro}
+%
+% \begin{macro}{\bbl@cite@choice}
+%
+% The macro |\bbl@cite@choice| determines which definition of
+% |\bibcite| is needed. First we give |\bibcite| its default
+% definition.
+%
+% \begin{macrocode}
+ \def\bbl@cite@choice{%
+ \global\let\bibcite\bbl@bibcite
+ \@ifpackageloaded{natbib}{\global\let\bibcite\org@bibcite}{}%
+ \@ifpackageloaded{cite}{\global\let\bibcite\org@bibcite}{}%
+ \global\let\bbl@cite@choice\relax}
+% \end{macrocode}
+%
+% When a document is run for the first time, no \file{.aux} file is
+% available, and |\bibcite| will not yet be properly defined. In
+% this case, this has to happen before the document starts.
+%
+% \begin{macrocode}
+ \AtBeginDocument{\bbl@cite@choice}
+% \end{macrocode}
+%
+% \end{macro}
+%
+% \begin{macro}{\@bibitem}
+%
+% One of the two internal \LaTeX\ macros called by |\bibitem|
+% that write the citation label on the |.aux| file.
+%
+% \begin{macrocode}
+ \bbl@redefine\@bibitem#1{%
+ \@safe@activestrue\org@@bibitem{#1}\@safe@activesfalse}
+\else
+ \let\org@nocite\nocite
+ \let\org@@citex\@citex
+ \let\org@bibcite\bibcite
+ \let\org@@bibitem\@bibitem
+\fi
+% \end{macrocode}
+%
+% \end{macro}
+%
+% \subsection{Marks}
+%
+% \begin{macro}{\markright}
+% Because the output routine is asynchronous, we must pass the
+% current language attribute to the head lines. To achieve this we
+% need to adapt the definition of |\markright| and |\markboth|
+% somewhat. However, headlines and footlines can contain text
+% outside marks; for that we must take some actions in the output
+% routine if the 'headfoot' options is used.
+%
+% We need to make some redefinitions to the output routine
+% to avoid an endless loop and to correctly handle the page number
+% in bidi documents.
+%
+% \begin{macrocode}
+\bbl@trace{Marks}
+\IfBabelLayout{sectioning}
+ {\ifx\bbl@opt@headfoot\@nnil
+ \g@addto@macro\@resetactivechars{%
+ \set@typeset@protect
+ \expandafter\select@language@x\expandafter{\bbl@main@language}%
+ \let\protect\noexpand
+ \ifcase\bbl@bidimode\else % Only with bidi. See also above
+ \edef\thepage{%
+ \noexpand\babelsublr{\unexpanded\expandafter{\thepage}}}%
+ \fi}%
+ \fi}
+ {\ifbbl@single\else
+ \bbl@ifunset{markright }\bbl@redefine\bbl@redefinerobust
+ \markright#1{%
+ \bbl@ifblank{#1}%
+ {\org@markright{}}%
+ {\toks@{#1}%
+ \bbl@exp{%
+ \\\org@markright{\\\protect\\\foreignlanguage{\languagename}%
+ {\\\protect\\\bbl@restore@actives\the\toks@}}}}}%
+% \end{macrocode}
+%
+% \end{macro}
+%
+% \begin{macro}{\markboth}
+% \begin{macro}{\@mkboth}
+% The definition of |\markboth| is equivalent to that of
+% |\markright|, except that we need two token registers. The
+% documentclasses \cls{report} and \cls{book} define and set the
+% headings for the page. While doing so they also store a copy of
+% |\markboth| in |\@mkboth|. Therefore we need to check whether
+% |\@mkboth| has already been set. If so we neeed to do that again
+% with the new definition of |\markboth|. (As of Oct 2019, \LaTeX{}
+% stores the definition in an intermediate macro, so it's not
+% necessary anymore, but it's preserved for older versions.)
+%
+% \begin{macrocode}
+ \ifx\@mkboth\markboth
+ \def\bbl@tempc{\let\@mkboth\markboth}
+ \else
+ \def\bbl@tempc{}
+ \fi
+ \bbl@ifunset{markboth }\bbl@redefine\bbl@redefinerobust
+ \markboth#1#2{%
+ \protected@edef\bbl@tempb##1{%
+ \protect\foreignlanguage
+ {\languagename}{\protect\bbl@restore@actives##1}}%
+ \bbl@ifblank{#1}%
+ {\toks@{}}%
+ {\toks@\expandafter{\bbl@tempb{#1}}}%
+ \bbl@ifblank{#2}%
+ {\@temptokena{}}%
+ {\@temptokena\expandafter{\bbl@tempb{#2}}}%
+ \bbl@exp{\\\org@markboth{\the\toks@}{\the\@temptokena}}}
+ \bbl@tempc
+ \fi} % end ifbbl@single, end \IfBabelLayout
+% \end{macrocode}
+%
+% \end{macro}
+% \end{macro}
+%
+% \subsection{Preventing clashes with other packages}
+%
+% \subsubsection{\pkg{ifthen}}
+%
+% \begin{macro}{\ifthenelse}
+%
+% Sometimes a document writer wants to create a special effect
+% depending on the page a certain fragment of text appears on. This
+% can be achieved by the following piece of code:
+%\begin{verbatim}
+% \ifthenelse{\isodd{\pageref{some:label}}}
+% {code for odd pages}
+% {code for even pages}
+%\end{verbatim}
+% In order for this to work the argument of |\isodd| needs to be
+% fully expandable. With the above redefinition of |\pageref| it is
+% not in the case of this example. To overcome that, we add some
+% code to the definition of |\ifthenelse| to make things work.
+%
+% We want to revert the definition of |\pageref| and |\ref| to
+% their original definition for the first argument of |\ifthenelse|,
+% so we first need to store their current meanings.
+%
+% Then we can set the |\@safe@actives| switch and call the original
+% |\ifthenelse|. In order to be able to use shorthands in the
+% second and third arguments of |\ifthenelse| the resetting of the
+% switch \emph{and} the definition of |\pageref| happens inside
+% those arguments.
+%
+% \begin{macrocode}
+\bbl@trace{Preventing clashes with other packages}
+\bbl@xin@{R}\bbl@opt@safe
+\ifin@
+ \AtBeginDocument{%
+ \@ifpackageloaded{ifthen}{%
+ \bbl@redefine@long\ifthenelse#1#2#3{%
+ \let\bbl@temp@pref\pageref
+ \let\pageref\org@pageref
+ \let\bbl@temp@ref\ref
+ \let\ref\org@ref
+ \@safe@activestrue
+ \org@ifthenelse{#1}%
+ {\let\pageref\bbl@temp@pref
+ \let\ref\bbl@temp@ref
+ \@safe@activesfalse
+ #2}%
+ {\let\pageref\bbl@temp@pref
+ \let\ref\bbl@temp@ref
+ \@safe@activesfalse
+ #3}%
+ }%
+ }{}%
+ }
+% \end{macrocode}
+%
+% \end{macro}
+%
+% \subsubsection{\pkg{varioref}}
+%
+% \begin{macro}{\@@vpageref}
+% \begin{macro}{\vrefpagenum}
+% \begin{macro}{\Ref}
+%
+% When the package varioref is in use we need to modify its
+% internal command |\@@vpageref| in order to prevent problems when
+% an active character ends up in the argument of |\vref|. The same
+% needs to happen for |\vrefpagenum|.
+%
+% \begin{macrocode}
+ \AtBeginDocument{%
+ \@ifpackageloaded{varioref}{%
+ \bbl@redefine\@@vpageref#1[#2]#3{%
+ \@safe@activestrue
+ \org@@@vpageref{#1}[#2]{#3}%
+ \@safe@activesfalse}%
+ \bbl@redefine\vrefpagenum#1#2{%
+ \@safe@activestrue
+ \org@vrefpagenum{#1}{#2}%
+ \@safe@activesfalse}%
+% \end{macrocode}
+%
+% The package \pkg{varioref} defines |\Ref| to be a robust command
+% wich uppercases the first character of the reference text. In
+% order to be able to do that it needs to access the expandable form
+% of |\ref|. So we employ a little trick here. We redefine the
+% (internal) command \verb*|\Ref | to call |\org@ref| instead of
+% |\ref|. The disadvantage of this solution is that whenever the
+% definition of |\Ref| changes, this definition needs to be updated
+% as well.
+%
+% \begin{macrocode}
+ \expandafter\def\csname Ref \endcsname#1{%
+ \protected@edef\@tempa{\org@ref{#1}}\expandafter\MakeUppercase\@tempa}
+ }{}%
+ }
+\fi
+% \end{macrocode}
+%
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \subsubsection{\pkg{hhline}}
+%
+%
+% \begin{macro}{\hhline}
+%
+% Delaying the activation of the shorthand characters has introduced
+% a problem with the \pkg{hhline} package. The reason is that it
+% uses the `:' character which is made active by the french support
+% in \babel. Therefore we need to \emph{reload} the package when
+% the `:' is an active character. Note that this happens
+% \emph{after} the category code of the @-sign has been changed to
+% other, so we need to temporarily change it to letter again.
+%
+% \begin{macrocode}
+\AtEndOfPackage{%
+ \AtBeginDocument{%
+ \@ifpackageloaded{hhline}%
+ {\expandafter\ifx\csname normal@char\string:\endcsname\relax
+ \else
+ \makeatletter
+ \def\@currname{hhline}\input{hhline.sty}\makeatother
+ \fi}%
+ {}}}
+% \end{macrocode}
+%
+% \end{macro}
+%
+% \begin{macro}{\substitutefontfamily}
+%
+% Deprecated. Use the tools provides by \LaTeX. The command
+% |\substitutefontfamily| creates an \file{.fd} file on the fly. The
+% first argument is an encoding mnemonic, the second and third
+% arguments are font family names.
+%
+% \begin{macrocode}
+\def\substitutefontfamily#1#2#3{%
+ \lowercase{\immediate\openout15=#1#2.fd\relax}%
+ \immediate\write15{%
+ \string\ProvidesFile{#1#2.fd}%
+ [\the\year/\two@digits{\the\month}/\two@digits{\the\day}
+ \space generated font description file]^^J
+ \string\DeclareFontFamily{#1}{#2}{}^^J
+ \string\DeclareFontShape{#1}{#2}{m}{n}{<->ssub * #3/m/n}{}^^J
+ \string\DeclareFontShape{#1}{#2}{m}{it}{<->ssub * #3/m/it}{}^^J
+ \string\DeclareFontShape{#1}{#2}{m}{sl}{<->ssub * #3/m/sl}{}^^J
+ \string\DeclareFontShape{#1}{#2}{m}{sc}{<->ssub * #3/m/sc}{}^^J
+ \string\DeclareFontShape{#1}{#2}{b}{n}{<->ssub * #3/bx/n}{}^^J
+ \string\DeclareFontShape{#1}{#2}{b}{it}{<->ssub * #3/bx/it}{}^^J
+ \string\DeclareFontShape{#1}{#2}{b}{sl}{<->ssub * #3/bx/sl}{}^^J
+ \string\DeclareFontShape{#1}{#2}{b}{sc}{<->ssub * #3/bx/sc}{}^^J
+ }%
+ \closeout15
+ }
+\@onlypreamble\substitutefontfamily
+% \end{macrocode}
+%
+% \end{macro}
+%
+% \subsection{Encoding and fonts}
+%
+% Because documents may use non-ASCII font encodings, we make sure
+% that the logos of \TeX\ and \LaTeX\ always come out in the right
+% encoding. There is a list of non-ASCII encodings. Requested
+% encodings are currently stored in |\@fontenc@load@list|. If a
+% non-ASCII has been loaded, we define versions of |\TeX| and |\LaTeX|
+% for them using |\ensureascii|. The default ASCII encoding is set,
+% too (in reverse order): the ``main'' encoding (when the document
+% begins), the last loaded, or |OT1|.
+%
+% \begin{macro}{\ensureascii}
+%
+% \begin{macrocode}
+\bbl@trace{Encoding and fonts}
+\newcommand\BabelNonASCII{LGR,X2,OT2,OT3,OT6,LHE,LWN,LMA,LMC,LMS,LMU}
+\newcommand\BabelNonText{TS1,T3,TS3}
+\let\org@TeX\TeX
+\let\org@LaTeX\LaTeX
+\let\ensureascii\@firstofone
+\AtBeginDocument{%
+ \def\@elt#1{,#1,}%
+ \edef\bbl@tempa{\expandafter\@gobbletwo\@fontenc@load@list}%
+ \let\@elt\relax
+ \let\bbl@tempb\@empty
+ \def\bbl@tempc{OT1}%
+ \bbl@foreach\BabelNonASCII{% LGR loaded in a non-standard way
+ \bbl@ifunset{T@#1}{}{\def\bbl@tempb{#1}}}%
+ \bbl@foreach\bbl@tempa{%
+ \bbl@xin@{#1}{\BabelNonASCII}%
+ \ifin@
+ \def\bbl@tempb{#1}% Store last non-ascii
+ \else\bbl@xin@{#1}{\BabelNonText}% Pass
+ \ifin@\else
+ \def\bbl@tempc{#1}% Store last ascii
+ \fi
+ \fi}%
+ \ifx\bbl@tempb\@empty\else
+ \bbl@xin@{,\cf@encoding,}{,\BabelNonASCII,\BabelNonText,}%
+ \ifin@\else
+ \edef\bbl@tempc{\cf@encoding}% The default if ascii wins
+ \fi
+ \edef\ensureascii#1{%
+ {\noexpand\fontencoding{\bbl@tempc}\noexpand\selectfont#1}}%
+ \DeclareTextCommandDefault{\TeX}{\ensureascii{\org@TeX}}%
+ \DeclareTextCommandDefault{\LaTeX}{\ensureascii{\org@LaTeX}}%
+ \fi}
+% \end{macrocode}
+%
+% \end{macro}
+%
+% Now comes the old deprecated stuff (with a little change in 3.9l,
+% for \textsf{fontspec}). The first thing we need to do is to
+% determine, at |\begin{document}|, which latin fontencoding to use.
+%
+% \begin{macro}{\latinencoding}
+% When text is being typeset in an encoding other than `latin'
+% (\texttt{OT1} or \texttt{T1}), it would be nice to still have
+% Roman numerals come out in the Latin encoding.
+% So we first assume that the current encoding at the end
+% of processing the package is the Latin encoding.
+%
+% \begin{macrocode}
+\AtEndOfPackage{\edef\latinencoding{\cf@encoding}}
+% \end{macrocode}
+%
+% But this might be overruled with a later loading of the package
+% \pkg{fontenc}. Therefore we check at the execution of
+% |\begin{document}| whether it was loaded with the \Lopt{T1}
+% option. The normal way to do this (using |\@ifpackageloaded|) is
+% disabled for this package. Now we have to revert to parsing the
+% internal macro |\@filelist| which contains all the filenames
+% loaded.
+%
+% \begin{macrocode}
+\AtBeginDocument{%
+ \@ifpackageloaded{fontspec}%
+ {\xdef\latinencoding{%
+ \ifx\UTFencname\@undefined
+ EU\ifcase\bbl@engine\or2\or1\fi
+ \else
+ \UTFencname
+ \fi}}%
+ {\gdef\latinencoding{OT1}%
+ \ifx\cf@encoding\bbl@t@one
+ \xdef\latinencoding{\bbl@t@one}%
+ \else
+ \def\@elt#1{,#1,}%
+ \edef\bbl@tempa{\expandafter\@gobbletwo\@fontenc@load@list}%
+ \let\@elt\relax
+ \bbl@xin@{,T1,}\bbl@tempa
+ \ifin@
+ \xdef\latinencoding{\bbl@t@one}%
+ \fi
+ \fi}}
+% \end{macrocode}
+%
+% \end{macro}
+%
+% \begin{macro}{\latintext}
+% Then we can define the command |\latintext| which is a
+% declarative switch to a latin font-encoding. Usage of this macro
+% is deprecated.
+%
+% \begin{macrocode}
+\DeclareRobustCommand{\latintext}{%
+ \fontencoding{\latinencoding}\selectfont
+ \def\encodingdefault{\latinencoding}}
+% \end{macrocode}
+%
+% \end{macro}
+%
+% \begin{macro}{\textlatin}
+% This command takes an argument which is then typeset using the
+% requested font encoding. In order to avoid many encoding switches
+% it operates in a local scope.
+%
+% \begin{macrocode}
+\ifx\@undefined\DeclareTextFontCommand
+ \DeclareRobustCommand{\textlatin}[1]{\leavevmode{\latintext #1}}
+\else
+ \DeclareTextFontCommand{\textlatin}{\latintext}
+\fi
+% \end{macrocode}
+%
+% For several functions, we need to execute some code with
+% |\selectfont|. With \LaTeX\ 2021-06-01, there is a hook for this
+% purpose, but in older versions the \LaTeX{} command is patched (the
+% latter solution will be eventually removed).
+%
+% \begin{macrocode}
+\bbl@ifformatlater{2021-06-01}%
+ {\def\bbl@patchfont#1{\AddToHook{selectfont}{#1}}}
+ {\def\bbl@patchfont#1{%
+ \expandafter\bbl@add\csname selectfont \endcsname{#1}%
+ \expandafter\bbl@toglobal\csname selectfont \endcsname}}
+% \end{macrocode}
+%
+% \end{macro}
+%
+% \subsection{Basic bidi support}
+%
+% \textbf{Work in progress.} This code is currently placed here for
+% practical reasons. It will be moved to the correct place soon, I
+% hope.
+%
+% It is loosely based on |rlbabel.def|, but most of it has been
+% developed from scratch. This \babel{} module (by Johannes Braams and
+% Boris Lavva) has served the purpose of typesetting R documents for
+% two decades, and despite its flaws I think it is still a good starting
+% point (some parts have been copied here almost verbatim), partly
+% thanks to its simplicity. I've also looked at \textsc{arabi} (by
+% Youssef Jabri), which is compatible with \babel{}.
+%
+% There are two ways of modifying macros to make them “bidi”, namely,
+% by patching the internal low-level macros (which is what I have done
+% with lists, columns, counters, tocs, much like |rlbabel| did), and
+% by introducing a “middle layer” just below the user interface
+% (sectioning, footnotes).
+%
+% \begin{itemize}
+% \item pdftex provides a minimal support for bidi text, and it
+% must be done by hand. Vertical typesetting is not possible.
+% \item \xetex{} is somewhat better, thanks to its font engine
+% (even if not always reliable) and a few additional tools. However,
+% very little is done at the paragraph level. Another challenging
+% problem is text direction does not honour \TeX{} grouping.
+% \item \luatex{} can provide the most complete solution, as we can
+% manipulate almost freely the node list, the generated lines,
+% and so on, but bidi text does not work out of the box and some
+% development is necessary. It also provides tools to properly
+% set left-to-right and right-to-left page layouts. As Lua\TeX-ja
+% shows, vertical typesetting is possible, too.
+% \end{itemize}
+%
+% \begin{macrocode}
+\bbl@trace{Loading basic (internal) bidi support}
+\ifodd\bbl@engine
+\else % TODO. Move to txtbabel
+ \ifnum\bbl@bidimode>100 \ifnum\bbl@bidimode<200
+ \bbl@error
+ {The bidi method 'basic' is available only in\\%
+ luatex. I'll continue with 'bidi=default', so\\%
+ expect wrong results}%
+ {See the manual for further details.}%
+ \let\bbl@beforeforeign\leavevmode
+ \AtEndOfPackage{%
+ \EnableBabelHook{babel-bidi}%
+ \bbl@xebidipar}
+ \fi\fi
+ \def\bbl@loadxebidi#1{%
+ \ifx\RTLfootnotetext\@undefined
+ \AtEndOfPackage{%
+ \EnableBabelHook{babel-bidi}%
+ \ifx\fontspec\@undefined
+ \bbl@loadfontspec % bidi needs fontspec
+ \fi
+ \usepackage#1{bidi}}%
+ \fi}
+ \ifnum\bbl@bidimode>200
+ \ifcase\expandafter\@gobbletwo\the\bbl@bidimode\or
+ \bbl@tentative{bidi=bidi}
+ \bbl@loadxebidi{}
+ \or
+ \bbl@loadxebidi{[rldocument]}
+ \or
+ \bbl@loadxebidi{}
+ \fi
+ \fi
+\fi
+% TODO? Separate:
+\ifnum\bbl@bidimode=\@ne
+ \let\bbl@beforeforeign\leavevmode
+ \ifodd\bbl@engine
+ \newattribute\bbl@attr@dir
+ \directlua{ Babel.attr_dir = luatexbase.registernumber'bbl@attr@dir' }
+ \bbl@exp{\output{\bodydir\pagedir\the\output}}
+ \fi
+ \AtEndOfPackage{%
+ \EnableBabelHook{babel-bidi}%
+ \ifodd\bbl@engine\else
+ \bbl@xebidipar
+ \fi}
+\fi
+% \end{macrocode}
+%
+% Now come the macros used to set the direction when a language is
+% switched. First the (mostly) common macros.
+%
+% \begin{macrocode}
+\bbl@trace{Macros to switch the text direction}
+\def\bbl@alscripts{,Arabic,Syriac,Thaana,}
+\def\bbl@rscripts{% TODO. Base on codes ??
+ ,Imperial Aramaic,Avestan,Cypriot,Hatran,Hebrew,%
+ Old Hungarian,Old Hungarian,Lydian,Mandaean,Manichaean,%
+ Manichaean,Meroitic Cursive,Meroitic,Old North Arabian,%
+ Nabataean,N'Ko,Orkhon,Palmyrene,Inscriptional Pahlavi,%
+ Psalter Pahlavi,Phoenician,Inscriptional Parthian,Samaritan,%
+ Old South Arabian,}%
+\def\bbl@provide@dirs#1{%
+ \bbl@xin@{\csname bbl@sname@#1\endcsname}{\bbl@alscripts\bbl@rscripts}%
+ \ifin@
+ \global\bbl@csarg\chardef{wdir@#1}\@ne
+ \bbl@xin@{\csname bbl@sname@#1\endcsname}{\bbl@alscripts}%
+ \ifin@
+ \global\bbl@csarg\chardef{wdir@#1}\tw@ % useless in xetex
+ \fi
+ \else
+ \global\bbl@csarg\chardef{wdir@#1}\z@
+ \fi
+ \ifodd\bbl@engine
+ \bbl@csarg\ifcase{wdir@#1}%
+ \directlua{ Babel.locale_props[\the\localeid].textdir = 'l' }%
+ \or
+ \directlua{ Babel.locale_props[\the\localeid].textdir = 'r' }%
+ \or
+ \directlua{ Babel.locale_props[\the\localeid].textdir = 'al' }%
+ \fi
+ \fi}
+\def\bbl@switchdir{%
+ \bbl@ifunset{bbl@lsys@\languagename}{\bbl@provide@lsys{\languagename}}{}%
+ \bbl@ifunset{bbl@wdir@\languagename}{\bbl@provide@dirs{\languagename}}{}%
+ \bbl@exp{\\\bbl@setdirs\bbl@cl{wdir}}}
+\def\bbl@setdirs#1{% TODO - math
+ \ifcase\bbl@select@type % TODO - strictly, not the right test
+ \bbl@bodydir{#1}%
+ \bbl@pardir{#1}%
+ \fi
+ \bbl@textdir{#1}}
+% TODO. Only if \bbl@bidimode > 0?:
+\AddBabelHook{babel-bidi}{afterextras}{\bbl@switchdir}
+\DisableBabelHook{babel-bidi}
+% \end{macrocode}
+%
+% Now the engine-dependent macros. TODO. Must be moved to the engine
+% files.
+%
+% \begin{macrocode}
+\ifodd\bbl@engine % luatex=1
+\else % pdftex=0, xetex=2
+ \newcount\bbl@dirlevel
+ \chardef\bbl@thetextdir\z@
+ \chardef\bbl@thepardir\z@
+ \def\bbl@textdir#1{%
+ \ifcase#1\relax
+ \chardef\bbl@thetextdir\z@
+ \bbl@textdir@i\beginL\endL
+ \else
+ \chardef\bbl@thetextdir\@ne
+ \bbl@textdir@i\beginR\endR
+ \fi}
+ \def\bbl@textdir@i#1#2{%
+ \ifhmode
+ \ifnum\currentgrouplevel>\z@
+ \ifnum\currentgrouplevel=\bbl@dirlevel
+ \bbl@error{Multiple bidi settings inside a group}%
+ {I'll insert a new group, but expect wrong results.}%
+ \bgroup\aftergroup#2\aftergroup\egroup
+ \else
+ \ifcase\currentgrouptype\or % 0 bottom
+ \aftergroup#2% 1 simple {}
+ \or
+ \bgroup\aftergroup#2\aftergroup\egroup % 2 hbox
+ \or
+ \bgroup\aftergroup#2\aftergroup\egroup % 3 adj hbox
+ \or\or\or % vbox vtop align
+ \or
+ \bgroup\aftergroup#2\aftergroup\egroup % 7 noalign
+ \or\or\or\or\or\or % output math disc insert vcent mathchoice
+ \or
+ \aftergroup#2% 14 \begingroup
+ \else
+ \bgroup\aftergroup#2\aftergroup\egroup % 15 adj
+ \fi
+ \fi
+ \bbl@dirlevel\currentgrouplevel
+ \fi
+ #1%
+ \fi}
+ \def\bbl@pardir#1{\chardef\bbl@thepardir#1\relax}
+ \let\bbl@bodydir\@gobble
+ \let\bbl@pagedir\@gobble
+ \def\bbl@dirparastext{\chardef\bbl@thepardir\bbl@thetextdir}
+% \end{macrocode}
+%
+% The following command is executed only if there is a right-to-left
+% script (once). It activates the |\everypar| hack for \xetex, to
+% properly handle the par direction. Note text and par dirs are
+% decoupled to some extent (although not completely).
+%
+% \begin{macrocode}
+ \def\bbl@xebidipar{%
+ \let\bbl@xebidipar\relax
+ \TeXXeTstate\@ne
+ \def\bbl@xeeverypar{%
+ \ifcase\bbl@thepardir
+ \ifcase\bbl@thetextdir\else\beginR\fi
+ \else
+ {\setbox\z@\lastbox\beginR\box\z@}%
+ \fi}%
+ \let\bbl@severypar\everypar
+ \newtoks\everypar
+ \everypar=\bbl@severypar
+ \bbl@severypar{\bbl@xeeverypar\the\everypar}}
+ \ifnum\bbl@bidimode>200
+ \let\bbl@textdir@i\@gobbletwo
+ \let\bbl@xebidipar\@empty
+ \AddBabelHook{bidi}{foreign}{%
+ \def\bbl@tempa{\def\BabelText####1}%
+ \ifcase\bbl@thetextdir
+ \expandafter\bbl@tempa\expandafter{\BabelText{\LR{##1}}}%
+ \else
+ \expandafter\bbl@tempa\expandafter{\BabelText{\RL{##1}}}%
+ \fi}
+ \def\bbl@pardir#1{\ifcase#1\relax\setLR\else\setRL\fi}
+ \fi
+\fi
+% \end{macrocode}
+%
+% A tool for weak L (mainly digits). We also disable warnings with
+% \textsf{hyperref}.
+%
+% \begin{macrocode}
+\DeclareRobustCommand\babelsublr[1]{\leavevmode{\bbl@textdir\z@#1}}
+\AtBeginDocument{%
+ \ifx\pdfstringdefDisableCommands\@undefined\else
+ \ifx\pdfstringdefDisableCommands\relax\else
+ \pdfstringdefDisableCommands{\let\babelsublr\@firstofone}%
+ \fi
+ \fi}
+% \end{macrocode}
+%
+% \subsection{Local Language Configuration}
+%
+% \begin{macro}{\loadlocalcfg}
+%
+% At some sites it may be necessary to add site-specific actions to
+% a language definition file. This can be done by creating a file
+% with the same name as the language definition file, but with the
+% extension \file{.cfg}. For instance the file \file{norsk.cfg}
+% will be loaded when the language definition file \file{norsk.ldf}
+% is loaded.
+%
+% For plain-based formats we don't want to override the definition
+% of |\loadlocalcfg| from \file{plain.def}.
+%
+% \begin{macrocode}
+\bbl@trace{Local Language Configuration}
+\ifx\loadlocalcfg\@undefined
+ \@ifpackagewith{babel}{noconfigs}%
+ {\let\loadlocalcfg\@gobble}%
+ {\def\loadlocalcfg#1{%
+ \InputIfFileExists{#1.cfg}%
+ {\typeout{*************************************^^J%
+ * Local config file #1.cfg used^^J%
+ *}}%
+ \@empty}}
+\fi
+% \end{macrocode}%
+% \end{macro}
+%
+% \subsection{Language options}
+%
+% Languages are loaded when processing the corresponding option
+% \textit{except} if a |main| language has been set. In such a
+% case, it is not loaded until all options has been processed.
+% The following macro inputs the ldf file and does some additional
+% checks (|\input| works, too, but possible errors are not catched).
+%
+% \begin{macrocode}
+\bbl@trace{Language options}
+\let\bbl@afterlang\relax
+\let\BabelModifiers\relax
+\let\bbl@loaded\@empty
+\def\bbl@load@language#1{%
+ \InputIfFileExists{#1.ldf}%
+ {\edef\bbl@loaded{\CurrentOption
+ \ifx\bbl@loaded\@empty\else,\bbl@loaded\fi}%
+ \expandafter\let\expandafter\bbl@afterlang
+ \csname\CurrentOption.ldf-h@@k\endcsname
+ \expandafter\let\expandafter\BabelModifiers
+ \csname bbl@mod@\CurrentOption\endcsname}%
+ {\bbl@error{%
+ Unknown option '\CurrentOption'. Either you misspelled it\\%
+ or the language definition file \CurrentOption.ldf was not found}{%
+ Valid options are, among others: shorthands=, KeepShorthandsActive,\\%
+ activeacute, activegrave, noconfigs, safe=, main=, math=\\%
+ headfoot=, strings=, config=, hyphenmap=, or a language name.}}}
+% \end{macrocode}
+%
+% Now, we set a few language options whose names are different from
+% |ldf| files. These declarations are preserved for backwards
+% compatibility, but they must be eventually removed. Use proxy files
+% instead.
+%
+% \begin{macrocode}
+\def\bbl@try@load@lang#1#2#3{%
+ \IfFileExists{\CurrentOption.ldf}%
+ {\bbl@load@language{\CurrentOption}}%
+ {#1\bbl@load@language{#2}#3}}
+%
+\DeclareOption{hebrew}{%
+ \input{rlbabel.def}%
+ \bbl@load@language{hebrew}}
+\DeclareOption{hungarian}{\bbl@try@load@lang{}{magyar}{}}
+\DeclareOption{lowersorbian}{\bbl@try@load@lang{}{lsorbian}{}}
+\DeclareOption{nynorsk}{\bbl@try@load@lang{}{norsk}{}}
+\DeclareOption{polutonikogreek}{%
+ \bbl@try@load@lang{}{greek}{\languageattribute{greek}{polutoniko}}}
+\DeclareOption{russian}{\bbl@try@load@lang{}{russianb}{}}
+\DeclareOption{ukrainian}{\bbl@try@load@lang{}{ukraineb}{}}
+\DeclareOption{uppersorbian}{\bbl@try@load@lang{}{usorbian}{}}
+% \end{macrocode}
+%
+% Another way to extend the list of `known' options for \babel\ was
+% to create the file \file{bblopts.cfg} in which one can add option
+% declarations. However, this mechanism is deprecated -- if you
+% want an alternative name for a language, just create a new |.ldf|
+% file loading the actual one. You can also set the name
+% of the file with the package option |config=<name>|, which will
+% load |<name>.cfg| instead.
+%
+% \begin{macrocode}
+\ifx\bbl@opt@config\@nnil
+ \@ifpackagewith{babel}{noconfigs}{}%
+ {\InputIfFileExists{bblopts.cfg}%
+ {\typeout{*************************************^^J%
+ * Local config file bblopts.cfg used^^J%
+ *}}%
+ {}}%
+\else
+ \InputIfFileExists{\bbl@opt@config.cfg}%
+ {\typeout{*************************************^^J%
+ * Local config file \bbl@opt@config.cfg used^^J%
+ *}}%
+ {\bbl@error{%
+ Local config file '\bbl@opt@config.cfg' not found}{%
+ Perhaps you misspelled it.}}%
+\fi
+% \end{macrocode}
+%
+% Recognizing global options in packages not having a closed set of
+% them is not trivial, as for them to be processed they must be defined
+% explicitly. So, package options not yet taken into account and stored
+% in |bbl@language@opts| are assumed to be existing languages (note
+% this list also contains the language given with |main| as the last
+% element). If not declared above, the names of the option and the file
+% are the same. There are two steps -- first process option names and
+% collect the result, which then do the actual declarations.
+%
+% To allow multiple overlapping replacements, commas in
+% |\bbl@language@opts| are doubled.
+%
+% \begin{macrocode}
+\let\bbl@elt\relax
+\let\bbl@tempe\@empty
+\bbl@foreach\@classoptionslist{%
+ \bbl@xin@{,#1,$}{\bbl@language@opts$}% Match last
+ \ifin@\else
+ \bbl@xin@{,#1,}{\bbl@language@opts}% Match non-last
+ \ifin@
+ \bbl@replace\bbl@language@opts{,#1,}{,,}%
+ \edef\bbl@tempe{\bbl@tempe\bbl@elt{3}{#1}}%
+ \else
+ \babel@savecnt\z@ % Use as temp
+ \ifnum\bbl@iniflag<\thr@@ % Optimization: 3 = always ini
+ \IfFileExists{#1.ldf}{\advance\babel@savecnt\@ne}{}%
+ \fi
+ \ifnum\bbl@iniflag>\z@ % Optimization: 0 = always ldf
+ \IfFileExists{babel-#1.tex}{\advance\babel@savecnt\tw@}{}%
+ \fi
+ \ifnum\babel@savecnt>\z@
+ \edef\bbl@tempe{\bbl@tempe\bbl@elt{\the\babel@savecnt}{#1}}%
+ \fi
+ \fi
+ \fi}
+%
+\let\bbl@savemain\@empty
+\bbl@foreach\bbl@language@opts{%
+ \edef\bbl@tempe{\bbl@tempe\bbl@elt{3}{#1}}}
+\def\bbl@elt#1#2#3{%
+ \ifx#3\relax % if last
+ \bbl@ifunset{ds@#2}{}%
+ {\bbl@exp{\def\\\bbl@savemain{\\\DeclareOption{#2}{\[ds@#2]}}}}%
+ \bbl@add\bbl@savemain{\bbl@elt{#1}{#2}}% Save main
+ \DeclareOption{#2}{}%
+ \else
+ \ifnum\bbl@iniflag<\tw@ % other as ldf
+ \ifodd#1\relax % Class: if ldf exists 1,3. Package: always 3
+ \bbl@ifunset{ds@#2}%
+ {\DeclareOption{#2}{\bbl@load@language{#2}}}%
+ {}%
+ \fi
+ \else % other as ini
+ \ifnum#1>\@ne % % Class: if ini exists 2,3. Package: always 3
+ \DeclareOption{#2}{%
+ \bbl@ldfinit
+ \babelprovide[import]{#2}%
+ \bbl@afterldf{}}%
+ \fi
+ \fi
+ \fi
+ #3}
+\bbl@tempe\relax % \relax catches last
+% \end{macrocode}
+%
+% Now, we make sure an option is explicitly declared for any language
+% set as global option, by checking if an |ldf| exists. The previous
+% step was, in fact, somewhat redundant, but that way we minimize
+% accessing the file system just to see if the option could be a
+% language.
+%
+% If a main language has been set, store it for the third pass.
+% And we are done, because all options for this pass has been
+% declared. Those already processed in the first pass are just
+% ignored.
+%
+% The options have to be processed in the order in which the user
+% specified them (except, of course, global options, which \LaTeX{}
+% processes before):
+%
+% \begin{macrocode}
+\def\AfterBabelLanguage#1{%
+ \bbl@ifsamestring\CurrentOption{#1}{\global\bbl@add\bbl@afterlang}{}}
+\DeclareOption*{}
+\ProcessOptions*
+% \end{macrocode}
+%
+% This finished the second pass. Now the third one begins, which
+% loads the main language set with the key |main|. A warning is
+% raised if the main language is not the same as the last named
+% one, or if the value of the key |main| is not a language. Then
+% execute directly the option (because it could be used only in
+% |main|). After loading all languages, we deactivate
+% |\AfterBabelLanguage|.
+%
+% \begin{macrocode}
+\bbl@trace{Option 'main'}
+\ifx\bbl@opt@main\@nnil
+ \edef\bbl@tempa{\@classoptionslist,\bbl@language@opts}
+ \let\bbl@tempc\@empty
+ \bbl@for\bbl@tempb\bbl@tempa{%
+ \bbl@xin@{,\bbl@tempb,}{,\bbl@loaded,}%
+ \ifin@\edef\bbl@tempc{\bbl@tempb}\fi}
+ \def\bbl@tempa#1,#2\@nnil{\def\bbl@tempb{#1}}
+ \expandafter\bbl@tempa\bbl@loaded,\@nnil
+ \ifx\bbl@tempb\bbl@tempc\else
+ \bbl@warning{%
+ Last declared language option is '\bbl@tempc',\\%
+ but the last processed one was '\bbl@tempb'.\\%
+ The main language can't be set as both a global\\%
+ and a package option. Use 'main=\bbl@tempc' as\\%
+ option. Reported}%
+ \fi
+\fi
+\def\bbl@elt#1#2{% main
+ \ifodd\bbl@iniflag % as ini = 1(=), 3(*=)
+ \ifnum#1>\@ne % % Class: if ini exists 2,3. Package: always 3
+ \def\CurrentOption{#2}% Directly, because luatexbase
+ \bbl@ldfinit
+ \babelprovide[\bbl@opt@provide,main,import]{#2}%
+ \bbl@afterldf{}%
+ \DeclareOption{#2}{}%
+ \fi
+ \else % as ldf = 0(no), 2(+=)
+ \ifodd#1\relax % Class: if ldf exists 1,3. Package: always 3
+ \bbl@ifunset{ds@#2}%
+ {\DeclareOption{#2}{\bbl@load@language{#2}}}%
+ {}%
+ \ExecuteOptions{#2}%
+ \fi
+ \fi}
+\bbl@savemain
+\DeclareOption*{}%
+\ProcessOptions*
+\def\AfterBabelLanguage{%
+ \bbl@error
+ {Too late for \string\AfterBabelLanguage}%
+ {Languages have been loaded, so I can do nothing}}
+% \end{macrocode}
+%
+% In order to catch the case where the user forgot to specify a
+% language we check whether |\bbl@main@language|, has become
+% defined. If not, no language has been loaded and an error
+% message is displayed.
+%
+% \begin{macrocode}
+\ifx\bbl@main@language\@undefined
+ \bbl@info{%
+ You haven't specified a language. I'll use 'nil'\\%
+ as the main language. Reported}
+ \bbl@load@language{nil}
+\fi
+%</package>
+% \end{macrocode}
+%
+% \section{The kernel of Babel (\texttt{babel.def}, common)}
+%
+% The kernel of the \babel\ system is currently stored in
+% \file{babel.def}. The file \file{babel.def} contains most of the
+% code. The file \file{hyphen.cfg} is a file that can be loaded into
+% the format, which is necessary when you want to be able to switch
+% hyphenation patterns.
+%
+% Because plain \TeX\ users might want to use some of the features of
+% the \babel{} system too, care has to be taken that plain \TeX\ can
+% process the files. For this reason the current format will have to
+% be checked in a number of places. Some of the code below is common
+% to plain \TeX\ and \LaTeX, some of it is for the \LaTeX\ case only.
+%
+% Plain formats based on etex (etex, xetex, luatex) don't load
+% |hyphen.cfg| but |etex.src|, which follows a different naming
+% convention, so we need to define the babel names. It presumes
+% |language.def| exists and it is the same file used when formats were
+% created.
+%
% A proxy file for switch.def
%
% \begin{macrocode}
@@ -12891,7 +12779,7 @@ help from Bernd Raichle, for which I am grateful.
\<keys_if_exist:nnF>{fontspec-opentype}{Language/\bbl@cl{lname}}%
{\\\newfontlanguage{\bbl@cl{lname}}{\bbl@cl{lotf}}}%
\\\renewfontfamily\\#4%
- [\bbl@cs{lsys@\languagename},#2]}{#3}% ie \bbl@exp{..}{#3}
+ [\bbl@cl{lsys},#2]}{#3}% ie \bbl@exp{..}{#3}
\begingroup
#4%
\xdef#1{\f@family}% eg, \bbl@rmdflt@lang{FreeSerif(0)}
@@ -14635,6 +14523,7 @@ end
{\ifx\tikz@atbegin@node\@undefined\else
\ifx\AddToHook\@undefined\else % TODO. Still tentative.
\AddToHook{env/pgfpicture/begin}{\bbl@pictsetdir\@ne}%
+ % \AddToHook{env/tikzpicture/begin}{\bbl@pictsetdir\z@}%
\bbl@add\pgfinterruptpicture{\bbl@pictresetdir}%
\fi
\let\bbl@OL@pgfpicture\pgfpicture
@@ -22462,12 +22351,17 @@ Babel.cjk_breaks = {
%
% \subsection{Emulating some \LaTeX{} features}
%
-% The following code duplicates or emulates parts of \LaTeXe\ that
-% are needed for \babel.
+% The file |babel.def| expects some definitions made in the \LaTeXe{}
+% style file. So, in Plain{} we must provide at least
+% some predefined values as well some tools to set them (even if not
+% all options are available). There are no package options, and
+% therefore and alternative mechanism is provided. For the moment,
+% only |\babeloptionstrings| and |\babeloptionmath| are provided,
+% which can be defined before loading \babel. |\BabelModifiers| can be
+% set too (but not sure it works).
%
% \begin{macrocode}
%<<*Emulate LaTeX>>
- % == Code for plain ==
\def\@empty{}
\def\loadlocalcfg#1{%
\openin0#1.cfg
@@ -22525,6 +22419,25 @@ Babel.cjk_breaks = {
\ifx#2\@empty\else\expandafter\zap@space\fi
#2}
\let\bbl@trace\@gobble
+\def\bbl@error#1#2{%
+ \begingroup
+ \newlinechar=`\^^J
+ \def\\{^^J(babel) }%
+ \errhelp{#2}\errmessage{\\#1}%
+ \endgroup}
+\def\bbl@warning#1{%
+ \begingroup
+ \newlinechar=`\^^J
+ \def\\{^^J(babel) }%
+ \message{\\#1}%
+ \endgroup}
+\let\bbl@infowarn\bbl@warning
+\def\bbl@info#1{%
+ \begingroup
+ \newlinechar=`\^^J
+ \def\\{^^J}%
+ \wlog{#1}%
+ \endgroup}
% \end{macrocode}
%
% \LaTeXe\ has the command |\@onlypreamble| which adds commands to
@@ -22879,7 +22792,7 @@ Babel.cjk_breaks = {
\def\cf@encoding{OT1}
% \end{macrocode}
%
-% Currently we only use the \LaTeXe\ method for accents for those
+% Currently we only use the \LaTeXe\ method for accents for those
% that are known to be made active in \emph{some} language
% definition file.
%
@@ -22903,20 +22816,47 @@ Babel.cjk_breaks = {
\DeclareTextSymbol{\ss}{OT1}{25}
% \end{macrocode}
%
-% For a couple of languages we need the \LaTeX-control sequence
-% |\scriptsize| to be available. Because plain \TeX\ doesn't have
-% such a sofisticated font mechanism as \LaTeX\ has, we just |\let|
-% it to |\sevenrm|.
+% For a couple of languages we need the \LaTeX-control sequence
+% |\scriptsize| to be available. Because plain \TeX\ doesn't have such
+% a sofisticated font mechanism as \LaTeX\ has, we just |\let| it to
+% |\sevenrm|.
%
% \begin{macrocode}
\ifx\scriptsize\@undefined
\let\scriptsize\sevenrm
\fi
- % End of code for plain
+% \end{macrocode}
+%
+% And a few more “dummy” definitions.
+%
+% \begin{macrocode}
+\def\languagename{english}%
+\let\bbl@opt@shorthands\@nnil
+\def\bbl@ifshorthand#1#2#3{#2}%
+\let\bbl@language@opts\@empty
+\ifx\babeloptionstrings\@undefined
+ \let\bbl@opt@strings\@nnil
+\else
+ \let\bbl@opt@strings\babeloptionstrings
+\fi
+\def\BabelStringsDefault{generic}
+\def\bbl@tempa{normal}
+\ifx\babeloptionmath\bbl@tempa
+ \def\bbl@mathnormal{\noexpand\textormath}
+\fi
+\def\AfterBabelLanguage#1#2{}
+\ifx\BabelModifiers\@undefined\let\BabelModifiers\relax\fi
+\let\bbl@afterlang\relax
+\def\bbl@opt@safe{BR}
+\ifx\@uclclist\@undefined\let\@uclclist\@empty\fi
+\ifx\bbl@trace\@undefined\def\bbl@trace#1{}\fi
+\expandafter\newif\csname ifbbl@single\endcsname
+\chardef\bbl@bidimode\z@
%<</Emulate LaTeX>>
% \end{macrocode}
%
% A proxy file:
+%
% \begin{macrocode}
%<*plain>
\input babel.def
diff --git a/macros/latex/required/babel/base/babel.ins b/macros/latex/required/babel/base/babel.ins
index 1a40cdc93a..ae4bbb527c 100644
--- a/macros/latex/required/babel/base/babel.ins
+++ b/macros/latex/required/babel/base/babel.ins
@@ -26,7 +26,7 @@
%% and covered by LPPL is defined by the unpacking scripts (with
%% extension .ins) which are part of the distribution.
%%
-\def\filedate{2021/07/22}
+\def\filedate{2021/10/13}
\def\batchfile{babel.ins}
\input docstrip.tex
diff --git a/macros/latex/required/babel/base/babel.pdf b/macros/latex/required/babel/base/babel.pdf
index 5ab700e806..36efb6e78f 100644
--- a/macros/latex/required/babel/base/babel.pdf
+++ b/macros/latex/required/babel/base/babel.pdf
Binary files differ
diff --git a/macros/latex/required/babel/base/bbcompat.dtx b/macros/latex/required/babel/base/bbcompat.dtx
index 9ed2c3c322..d45cedea36 100644
--- a/macros/latex/required/babel/base/bbcompat.dtx
+++ b/macros/latex/required/babel/base/bbcompat.dtx
@@ -30,7 +30,7 @@
%
% \iffalse
%<*dtx>
-\ProvidesFile{bbcompat.dtx}[2021/07/22 v3.63]
+\ProvidesFile{bbcompat.dtx}[2021/10/13 v3.64]
%</dtx>
%
%% File 'bbcompat.dtx'