diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/babel/babel.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/babel/babel.dtx | 278 |
1 files changed, 140 insertions, 138 deletions
diff --git a/Master/texmf-dist/source/latex/babel/babel.dtx b/Master/texmf-dist/source/latex/babel/babel.dtx index d279bd0cab9..ec8e82cf0d7 100644 --- a/Master/texmf-dist/source/latex/babel/babel.dtx +++ b/Master/texmf-dist/source/latex/babel/babel.dtx @@ -44,7 +44,7 @@ % %% File 'babel.dtx' %\fi -%%\ProvidesFile{babel.dtx}[2014/03/15 v3.9i The Babel package] +%%\ProvidesFile{babel.dtx}[2014/03/17 v3.9j The Babel package] %\iffalse % % Babel DOCUMENT-STYLE option for LaTeX version 2.09 or plain TeX; @@ -186,8 +186,8 @@ \vspace{2cm}\hspace{1.5cm} \begin{minipage}{5cm} \Large -Version 3.9i\newline -2014/03/15 +Version 3.9j\newline +2014/03/17 \vspace{1cm} \textit{Original author}\newline @@ -1578,7 +1578,7 @@ explained in in sec. \ref{s:strings} (\babel{} 3.9 and later). \begin{verbatim} \ProvidesLanguage{<language>} - [2014/04/15 v0.0 <Language> support from the babel system] + [2014/04/17 v0.0 <Language> support from the babel system] \LdfInit{<language>}{captions<language>} \ifx\undefined\l@<language> @@ -2347,8 +2347,8 @@ help from Bernd Raichle, for which I am grateful. % little bit of literate programming. % % \begin{macrocode} -%<<version=3.9i>> -%<<date=2014/03/15>> +%<<version=3.9j>> +%<<date=2014/03/17>> % \end{macrocode} % % We define some basic which just make the code cleaner. |\bbl@add| is @@ -3277,138 +3277,6 @@ help from Bernd Raichle, for which I am grateful. % \end{macrocode} % \end{macro} % -% \subsection{Encoding issues} -% -% 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. Unfortunately, -% \textsf{fontenc} deletes its package options, so we must guess -% which encodings has been loaded by traversing |\@filelist| to -% search for \marg{enc}|enc.def|. 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} -% \changes{babel~3.9i}{2014/02/14}{Macro added, to replace -% \cs{textlatin} and friends} -% \begin{macrocode} -\newcommand\BabelNonASCII{LGR,X2,OT2,OT3,OT6,LHE,LWN,LMA,LMC,LMS,LMU,} -\let\org@TeX\TeX -\let\org@LaTeX\LaTeX -\let\ensureascii\@firstofone -\AtBeginDocument{% - \in@false - \bbl@loopx\bbl@tempa\BabelNonASCII{% is there a non-ascii enc? - \ifin@\else - \edef\bbl@tempb{{,\bbl@tempa enc.def,}{,\@filelist,}}% - \lowercase\expandafter{\expandafter\in@\bbl@tempb}% - \fi} - \ifin@ % if a non-ascii has been loaded - \def\ensureascii#1{{\fontencoding{OT1}\selectfont#1}}% - \DeclareTextCommandDefault{\TeX}{\org@TeX}% - \DeclareTextCommandDefault{\LaTeX}{\org@LaTeX}% - \def\bbl@tempb#1\@@{\uppercase{\bbl@tempc#1}ENC.DEF\@empty\@@}% - \def\bbl@tempc#1ENC.DEF#2\@@{% - \ifx\@empty#2\else - \@ifundefined{T@#1}% - {}% - {\@expandtwoargs\in@{,#1,}{,\BabelNonASCII,}% - \ifin@ - \DeclareTextCommand{\TeX}{#1}{\ensureascii{\org@TeX}}% - \DeclareTextCommand{\LaTeX}{#1}{\ensureascii{\org@LaTeX}}% - \else - \def\ensureascii##1{{\fontencoding{#1}\selectfont##1}}% - \fi}% - \fi}% - \bbl@loopx\bbl@tempa\@filelist{\expandafter\bbl@tempb\bbl@tempa\@@}% - \@expandtwoargs\in@{,\cf@encoding,}{,\BabelNonASCII,}% - \ifin@\else - \edef\ensureascii#1{{% - \noexpand\fontencoding{\cf@encoding}\noexpand\selectfont#1}}% - \fi - \fi} -% \end{macrocode} -% \end{macro} -% -% Now comes the old deprecated stuff. The first thing we need to do -% is to determine, at |\begin{document}|, which latin fontencoding to -% use. -% -% \begin{macro}{\latinencoding} -% \changes{babel~3.6i}{1997/03/15}{Macro added, moved from -% \file{.ldf} files} -% 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. -% \changes{babel~3.6k}{1999/03/15}{Use T1 encoding when it is a known -% encoding} -% \changes{babel~3.6m}{1999/04/06}{Can't use \cs{@ifpackageloaded} -% need to parse \cs{@filelist}} -% \changes{babel~3.6n}{1999/04/07}{moved checking for fontenc right to -% the top of \file{babel.sty}} -% \changes{babel~3.6n}{1999/04/07}{Added a check for `manual' selection -% of \texttt{T1} encoding, without loading \pkg{fontenc}} -% \changes{babel~3.6q}{1999/04/12}{Better solution than parsing -% \cs{@filelist}, use \cs{@ifl@aded}} -% \changes{babel~3.6u}{1999/04/20}{Moved this code to -% \file{babel.def}} -% \begin{macrocode} -\AtBeginDocument{% - \gdef\latinencoding{OT1}% - \ifx\cf@encoding\bbl@t@one - \xdef\latinencoding{\bbl@t@one}% - \else - \@ifl@aded{def}{t1enc}{\xdef\latinencoding{\bbl@t@one}}{}% - \fi - } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\latintext} -% \changes{babel~3.6i}{1997/03/15}{Macro added, moved from -% \file{.ldf} files} -% 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} -% \changes{babel~3.6i}{1997/03/15}{Macro added, moved from -% \file{.ldf} files} -% \changes{babel~3.7j}{2003/03/19}{added \cs{leavevmode} to prevent a -% paragraph starting \emph{inside} the group} -% \changes{babel~3.7k}{2003/10/12}{Use \cs{DeclareTextFontComand}} -% 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} -% \end{macro} -% % \begin{macro}{\babelensure} % % The user command just parses the optional argument and creates a @@ -6488,6 +6356,140 @@ help from Bernd Raichle, for which I am grateful. % \end{macrocode} % \end{macro} % +% \subsection{Encoding issues} +% +% 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. Unfortunately, +% \textsf{fontenc} deletes its package options, so we must guess +% which encodings has been loaded by traversing |\@filelist| to +% search for \marg{enc}|enc.def|. 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} +% \changes{babel~3.9i}{2014/02/14}{Macro added, to replace +% \cs{textlatin} and friends} +% \changes{babel~3.9j}{2014/03/17}{Moved mispaced code - it should be +% executed only with LaTeX} +% \begin{macrocode} +\newcommand\BabelNonASCII{LGR,X2,OT2,OT3,OT6,LHE,LWN,LMA,LMC,LMS,LMU,} +\let\org@TeX\TeX +\let\org@LaTeX\LaTeX +\let\ensureascii\@firstofone +\AtBeginDocument{% + \in@false + \bbl@loopx\bbl@tempa\BabelNonASCII{% is there a non-ascii enc? + \ifin@\else + \edef\bbl@tempb{{,\bbl@tempa enc.def,}{,\@filelist,}}% + \lowercase\expandafter{\expandafter\in@\bbl@tempb}% + \fi} + \ifin@ % if a non-ascii has been loaded + \def\ensureascii#1{{\fontencoding{OT1}\selectfont#1}}% + \DeclareTextCommandDefault{\TeX}{\org@TeX}% + \DeclareTextCommandDefault{\LaTeX}{\org@LaTeX}% + \def\bbl@tempb#1\@@{\uppercase{\bbl@tempc#1}ENC.DEF\@empty\@@}% + \def\bbl@tempc#1ENC.DEF#2\@@{% + \ifx\@empty#2\else + \@ifundefined{T@#1}% + {}% + {\@expandtwoargs\in@{,#1,}{,\BabelNonASCII,}% + \ifin@ + \DeclareTextCommand{\TeX}{#1}{\ensureascii{\org@TeX}}% + \DeclareTextCommand{\LaTeX}{#1}{\ensureascii{\org@LaTeX}}% + \else + \def\ensureascii##1{{\fontencoding{#1}\selectfont##1}}% + \fi}% + \fi}% + \bbl@loopx\bbl@tempa\@filelist{\expandafter\bbl@tempb\bbl@tempa\@@}% + \@expandtwoargs\in@{,\cf@encoding,}{,\BabelNonASCII,}% + \ifin@\else + \edef\ensureascii#1{{% + \noexpand\fontencoding{\cf@encoding}\noexpand\selectfont#1}}% + \fi + \fi} +% \end{macrocode} +% \end{macro} +% +% Now comes the old deprecated stuff. The first thing we need to do +% is to determine, at |\begin{document}|, which latin fontencoding to +% use. +% +% \begin{macro}{\latinencoding} +% \changes{babel~3.6i}{1997/03/15}{Macro added, moved from +% \file{.ldf} files} +% 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. +% \changes{babel~3.6k}{1999/03/15}{Use T1 encoding when it is a known +% encoding} +% \changes{babel~3.6m}{1999/04/06}{Can't use \cs{@ifpackageloaded} +% need to parse \cs{@filelist}} +% \changes{babel~3.6n}{1999/04/07}{moved checking for fontenc right to +% the top of \file{babel.sty}} +% \changes{babel~3.6n}{1999/04/07}{Added a check for `manual' selection +% of \texttt{T1} encoding, without loading \pkg{fontenc}} +% \changes{babel~3.6q}{1999/04/12}{Better solution than parsing +% \cs{@filelist}, use \cs{@ifl@aded}} +% \changes{babel~3.6u}{1999/04/20}{Moved this code to +% \file{babel.def}} +% \begin{macrocode} +\AtBeginDocument{% + \gdef\latinencoding{OT1}% + \ifx\cf@encoding\bbl@t@one + \xdef\latinencoding{\bbl@t@one}% + \else + \@ifl@aded{def}{t1enc}{\xdef\latinencoding{\bbl@t@one}}{}% + \fi + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\latintext} +% \changes{babel~3.6i}{1997/03/15}{Macro added, moved from +% \file{.ldf} files} +% 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} +% \changes{babel~3.6i}{1997/03/15}{Macro added, moved from +% \file{.ldf} files} +% \changes{babel~3.7j}{2003/03/19}{added \cs{leavevmode} to prevent a +% paragraph starting \emph{inside} the group} +% \changes{babel~3.7k}{2003/10/12}{Use \cs{DeclareTextFontComand}} +% 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} +% \end{macro} +% % \subsection{Local Language Configuration} % % \begin{macro}{\loadlocalcfg} |