% \iffalse meta-comment
%
% Copyright 1989-2008 Johannes L. Braams and any individual authors
% listed elsewhere in this file. All rights reserved.
%
% This file is part of the Babel system.
% --------------------------------------
%
% It may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
%
http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2003/12/01 or later.
%
% This work has the LPPL maintenance status "maintained".
%
% The Current Maintainer of this work is Johannes Braams.
%
% The list of all files belonging to the Babel system is
% given in the file `manifest.bbl. See also `legal.bbl' for additional
% information.
%
% The list of derived (unpacked) files belonging to the distribution
% and covered by LPPL is defined by the unpacking scripts (with
% extension .ins) which are part of the distribution.
% \fi
% \CheckSum{1142}
%
% \iffalse
% Tell the \LaTeX\ system who we are and write an entry on the
% transcript.
%<*dtx>
\ProvidesFile{czech.dtx}
%</dtx>
%<+code>\ProvidesLanguage{czech}
%\fi
%\ProvidesFile{czech.dtx}
[2008/07/06 v3.1a Czech support from the babel system]
%\iffalse
%% File `czech.dtx'
%% Babel package for LaTeX version 2e
%% Copyright (C) 1989 - 2008
%% by Johannes Braams, TeXniek
%
%% Copyright (C) 2005, 2008
%% by Petr Tesa\v r\'ik (babel at tesarici.cz)
%%
%% Czech Language Definition File
% This file is also based on CSLaTeX
% by Ji\v r\'i Zlatu\v ska, Zden\v ek Wagner,
% Jaroslav \v Snajdr and Petr Ol\v s\'ak.
%
%% Please report errors to: Petr Tesa\v r\'ik
%% babel at tesarici.cz
%
% This file is part of the babel system, it provides the source
% code for the Czech language definition file.
%<*filedriver>
\documentclass{ltxdoc}
\newcommand*\TeXhax{\TeX hax}
\newcommand*\babel{\textsf{babel}}
\newcommand*\langvar{$\langle \it lang \rangle$}
\newcommand*\note[1]{}
\newcommand*\Lopt[1]{\textsf{#1}}
\newcommand*\file[1]{\texttt{#1}}
\begin{document}
\DocInput{czech.dtx}
\end{document}
%</filedriver>
%\fi
%
% \def\CS{$\cal C\kern-.1667em
% \lower.5ex\hbox{$\cal S$}\kern-.075em$}
%
% \GetFileInfo{czech.dtx}
%
% \changes{czech-1.0a}{1991/07/15}{Renamed babel.sty in babel.com}
% \changes{czech-1.1}{1992/02/15}{Brought up-to-date with babel 3.2a}
% \changes{czech-1.2}{1993/07/11}{Included some features from Kasal's
% czech.sty}
% \changes{czech-1.3}{1994/02/27}{Update for \LaTeXe}
% \changes{czech-1.3d}{1994/06/26}{Removed the use of \cs{filedate}
% and moved identification after the loading of \file{babel.def}}
% \changes{czech-1.3h}{1996/10/10}{Replaced \cs{undefined} with
% \cs{@undefined} and \cs{empty} with \cs{@empty} for consistency
% with \LaTeX, moved the definition of \cs{atcatcode} right to the
% beginning.}
% \changes{czech-3.0}{2005/09/10}{Implemented the functionality of
% \CS\LaTeX's czech.sty. The version number was bumped to 3.0
% to minimize confusion by being higher than the last version
% of \CS\LaTeX.}
%
% \section{The Czech Language}
%
% The file \file{\filename}\footnote{The file described in this
% section has version number \fileversion\ and was last revised on
% \filedate. It was rewritten by Petr Tesa\v r\'ik
% (\texttt{
[email protected]}).} defines all the language definition
% macros for the Czech language. It is meant as a replacement of
% \CS\LaTeX, the most-widely used standard for typesetting Czech
% documents in \LaTeX.
%
% \subsection{Usage}
% For this language |\frenchspacing| is set.
%
% Additionally, two macros are defined |\q| and |\w| for easy
% access to two accents are defined.
%
% The command |\q| is used with the letters (\texttt{t},
% \texttt{d}, \texttt{l}, and \texttt{L}) and adds a \texttt{'} to
% them to simulate a `hook' that should be there. The result looks
% like t\kern-2pt\char'47. The command |\w| is used to put the
% ring-accent which appears in \aa ngstr\o m over the letters
% \texttt{u} and \texttt{U}.
%
% \subsection{Compatibility}
%
% Great care has been taken to ensure backward compatibility with
% \CS\LaTeX. In particular, documents which load this file with
% |\usepackage{czech}| should produce identical output with no
% modifications to the source. Additionally, all the \CS\LaTeX{}
% options are recognized:
%
% \label{tab:czech-options}
% \begin{list}{}
% {\def\makelabel#1{\sbox0{\Lopt{#1}}%
% \ifdim\wd0>\labelwidth
% \setbox0\vbox{\box0\hbox{}} \wd0=0pt \fi
% \box0\hfil}
% \setlength{\labelwidth}{2\parindent}
% \setlength{\leftmargin}{2\parindent}
% \setlength{\rightmargin}{\parindent}}
% \item[IL2, T1, OT1]
% These options set the default font encoding. Please note
% that their use is deprecated. You should use the |fontenc|
% package to select font encoding.
%
% \item[split, nosplit]
% These options control whether hyphenated words are
% automatically split according to Czech typesetting rules.
% With the \Lopt{split} option ``je-li'' is hyphenated as
% ``je-/-li''. The \Lopt{nosplit} option disables this behavior.
%
% The use of this option is strongly discouraged, as it breaks
% too many common things---hyphens cannot be used in labels,
% negative arguments to \TeX{} primitives will not work in
% horizontal mode (use \cs{minus} as a workaround), and there are
% a few other peculiarities with using this mode.
%
% \item[nocaptions]
%
% This option was used in \CS\LaTeX{} to set up Czech/Slovak
% typesetting rules, but leave the original captions and dates.
% The recommended way to achieve this is to use English as the main
% language of the document and use the environment |otherlanguage*|
% for Czech text.
%
% \item[olduv]
% There are two version of \cs{uv}. The older one allows the use
% of \cs{verb} inside the quotes but breaks any respective kerning
% with the quotes (like that in \CS{} fonts). The newer one honors
% the kerning in the font but does not allow \cs{verb} inside the
% quotes.
%
% The new version is used by default in \LaTeXe{} and the old version
% is used with plain \TeX. You may use \Lopt{olduv} to override the
% default in \LaTeXe.
%
% \item[cstex]
% This option was used to include the commands \cs{csprimeson} and
% \cs{csprimesoff}. Since these commands are always included now,
% it has been removed and the empty definition lasts for compatibility.
% \end{list}
%
% \StopEventually{}
%
% \subsection{Implementation}
%
% The macro |\LdfInit| takes care of preventing that this file is
% loaded more than once, checking the category code of the
% \texttt{@} sign, etc.
% \changes{czech-1.3h}{1996/11/02}{Now use \cs{LdfInit} to perform
% initial checks}
% \begin{macrocode}
%<*code>
\LdfInit\CurrentOption{date\CurrentOption}
% \end{macrocode}
%
% When this file is read as an option, i.e. by the |\usepackage|
% command, \texttt{czech} might be an `unknown' language in which
% case we have to make it known. So we check for the existence of
% |\l@czech| to see whether we have to do something here.
%
% \changes{czech-1.0b}{1991/10/27}{Removed use of \cs{@ifundefined}}
% \changes{czech-1.1}{1992/02/15}{Added a warning when no hyphenation
% patterns were loaded.}
% \changes{czech-1.3d}{1994/06/26}{Now use \cs{@nopatterns} to produce
% the warning}
% \begin{macrocode}
\ifx\l@czech\@undefined
\@nopatterns{Czech}
\adddialect\l@czech0\fi
% \end{macrocode}
%
% We need to define these macros early in the process.
%
% \begin{macrocode}
\def\cs@iltw@{IL2}
\newif\ifcs@splithyphens
\cs@splithyphensfalse
% \end{macrocode}
%
% If Babel is not loaded, we provide compatibility with \CS\LaTeX.
% However, if macro \cs{@ifpackageloaded} is not defined, we assume
% to be loaded from plain and provide compatibility with csplain.
% Of course, this does not work well with \LaTeX$\:$2.09, but I
% doubt anyone will ever want to use this file with \LaTeX$\:$2.09.
%
% \begin{macrocode}
\ifx\@ifpackageloaded\@undefined
\let\cs@compat@plain\relax
\message{csplain compatibility mode}
\else
\@ifpackageloaded{babel}{}{%
\let\cs@compat@latex\relax
\message{cslatex compatibility mode}}
\fi
\ifx\cs@compat@latex\relax
\ProvidesPackage{czech}[2008/07/06 v3.1a CSTeX Czech style]
% \end{macrocode}
%
% Declare \CS\LaTeX{} options (see also the descriptions on page
% \pageref{tab:czech-options}).
%
% \begin{macrocode}
\DeclareOption{IL2}{\def\encodingdefault{IL2}}
\DeclareOption {T1}{\def\encodingdefault {T1}}
\DeclareOption{OT1}{\def\encodingdefault{OT1}}
\DeclareOption{nosplit}{\cs@splithyphensfalse}
\DeclareOption{split}{\cs@splithyphenstrue}
\DeclareOption{nocaptions}{\let\cs@nocaptions=\relax}
\DeclareOption{olduv}{\let\cs@olduv=\relax}
\DeclareOption{cstex}{\relax}
% \end{macrocode}
%
% Make |IL2| encoding the default. This can be overriden with
% the other font encoding options.
% \begin{macrocode}
\ExecuteOptions{\cs@iltw@}
% \end{macrocode}
%
% Now, process the user-supplied options.
% \begin{macrocode}
\ProcessOptions
% \end{macrocode}
%
% Standard \LaTeXe{} does not include the IL2 encoding in the format.
% The encoding can be loaded later using the fontenc package, but
% \CS\LaTeX{} included IL2 by default. This means existing documents
% for \CS\LaTeX{} do not load that package, so load the encoding
% ourselves in compatibility mode.
%
% \begin{macrocode}
\ifx\encodingdefault\cs@iltw@
\input il2enc.def
\fi
% \end{macrocode}
%
% Restore the definition of \cs{CurrentOption}, clobbered by processing
% the options.
%
% \begin{macrocode}
\def\CurrentOption{czech}
\fi
% \end{macrocode}
%
% The next step consists of defining commands to switch to (and
% from) the Czech language.
%
% \begin{macro}{\captionsczech}
% The macro \cs{captionsczech} defines all strings used in the four
% standard documentclasses provided with \LaTeX.
%
% \changes{czech-1.1}{1992/02/15}{Added \cs{seename}, \cs{alsoname}
% and \cs{prefacename}}
% \changes{czech-1.3f}{1995/07/04}{Added \cs{proofname} for AMS-\LaTeX}
% \changes{czech-1.3g}{1996/02/12}{Fixed two errors and provided
% translation for `proof'}
% \changes{czech-1.3j}{2000/09/19}{Added \cs{glossaryname}}
% \changes{czech-1.3k}{2004/02/18}{Added translation for Glossary}
% \changes{czech-3.0}{2005/11/25}{Updated some translations. Former
% translations were: `Dodatek' for \cs{appendixname} and `Index'
% for \cs{indexname}. Also removed spurious colon at the end of
% \cs{ccname}.}
%
% \begin{macrocode}
\@namedef{captions\CurrentOption}{%
\def\prefacename{P\v{r}edmluva}%
\def\refname{Reference}%
\def\abstractname{Abstrakt}%
\def\bibname{Literatura}%
\def\chaptername{Kapitola}%
\def\appendixname{P\v{r}\'{\i}loha}%
\def\contentsname{Obsah}%
\def\listfigurename{Seznam obr\'azk\r{u}}%
\def\listtablename{Seznam tabulek}%
\def\indexname{Rejst\v{r}\'{\i}k}%
\def\figurename{Obr\'azek}%
\def\tablename{Tabulka}%
\def\partname{\v{C}\'ast}%
\def\enclname{P\v{r}\'{\i}loha}%
\def\ccname{Na v\v{e}dom\'{\i}}%
\def\headtoname{Komu}%
\def\pagename{Strana}%
\def\seename{viz}%
\def\alsoname{viz tak\'e}%
\def\proofname{D\r{u}kaz}%
\def\glossaryname{Slovn\'{\i}k}%
}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\dateczech}
% The macro \cs{dateczech} redefines the command \cs{today}
% to produce Czech dates.
%
% \CS\LaTeX{} allows line break between the day and the month.
% However, this behavior has been agreed upon to be a bad thing by
% the csTeX mailing list in December 2005 and has not been adopted.
%
% \changes{czech-1.3i}{1997/10/01}{Use \cs{edef} to define \cs{today}
% to save memory}
% \changes{czech-1.3i}{1998/03/28}{Use \cs{def} instead of \cs{edef}}
% \begin{macrocode}
\@namedef{date\CurrentOption}{%
\def\today{\number\day.~\ifcase\month\or ledna\or \'unora\or
b\v{r}ezna\or dubna\or kv\v{e}tna\or \v{c}ervna\or \v{c}ervence\or
srpna\or z\'a\v{r}\'\i\or \v{r}\'{\i}jna\or listopadu\or
prosince\fi \space\number\year}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\extrasczech}
% \begin{macro}{\noextrasczech}
% The macro |\extrasczech| will perform all the extra definitions
% needed for the Czech language. The macro |\noextrasczech| is used
% to cancel the actions of |\extrasczech|. This means saving the
% meaning of two one-letter control sequences before defining them.
%
% For Czech texts \cs{frenchspacing} should be in effect. Language
% group for shorthands is also set here.
% \changes{czech-1.3e}{1995/03/14}{now use \cs{bbl@frenchspacing} and
% \cs{bbl@nonfrenchspacing}}
% \changes{czech-3.1}{2006/10/07}{move \cs{languageshorthands} here,
% so that the language group is always initialized correctly}
% \begin{macrocode}
\expandafter\addto\csname extras\CurrentOption\endcsname{%
\bbl@frenchspacing
\languageshorthands{czech}}
\expandafter\addto\csname noextras\CurrentOption\endcsname{%
\bbl@nonfrenchspacing}
% \end{macrocode}
%
% \changes{czech-1.1a}{1992/07/07}{Removed typo, \cs{q} was restored
% twice, once too many.}
% \changes{czech-1.3e}{1995/03/15}{Use \LaTeX's \cs{v} and \cs{r}
% accent commands}
% \begin{macrocode}
\expandafter\addto\csname extras\CurrentOption\endcsname{%
\babel@save\q\let\q\v
\babel@save\w\let\w\r}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\sq}
% \begin{macro}{\dq}
% We save the original single and double quote characters in
% \cs{sq} and \cs{dq} to make them available later.
% \begin{macrocode}
\begingroup\catcode`\"=12\catcode`\'=12
\def\x{\endgroup
\def\sq{'}
\def\dq{"}}
\x
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \changes{czech-3.0}{2005/12/10}{Added default for setting hyphenmin
% parameters. Values taken from \CS\LaTeX.}
% This macro is used to store the correct values of the hyphenation
% parameters |\lefthyphenmin| and |\righthyphenmin|.
% \begin{macrocode}
\providehyphenmins{\CurrentOption}{\tw@\thr@@}
% \end{macrocode}
%
% \begin{macro}{\v}
% \LaTeX's normal |\v| accent places a caron over the letter that
% follows it (\v{o}). This is not what we want for the letters d,
% t, l and L; for those the accent should change shape. This is
% acheived by the following.
% \begin{macrocode}
\AtBeginDocument{%
\DeclareTextCompositeCommand{\v}{OT1}{t}{%
t\kern-.23em\raise.24ex\hbox{'}}
\DeclareTextCompositeCommand{\v}{OT1}{d}{%
d\kern-.13em\raise.24ex\hbox{'}}
\DeclareTextCompositeCommand{\v}{OT1}{l}{\lcaron{}}
\DeclareTextCompositeCommand{\v}{OT1}{L}{\Lcaron{}}}
% \end{macrocode}
%
% \begin{macro}{\lcaron}
% \begin{macro}{\Lcaron}
% For the letters \texttt{l} and \texttt{L} we want to disinguish
% between normal fonts and monospaced fonts.
% \begin{macrocode}
\def\lcaron{%
\setbox0\hbox{M}\setbox\tw@\hbox{i}%
\ifdim\wd0>\wd\tw@\relax
l\kern-.13em\raise.24ex\hbox{'}\kern-.11em%
\else
l\raise.45ex\hbox to\z@{\kern-.35em '\hss}%
\fi}
\def\Lcaron{%
\setbox0\hbox{M}\setbox\tw@\hbox{i}%
\ifdim\wd0>\wd\tw@\relax
L\raise.24ex\hbox to\z@{\kern-.28em'\hss}%
\else
L\raise.45ex\hbox to\z@{\kern-.40em '\hss}%
\fi}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% Initialize active quotes. \CS\LaTeX{} provides a way of
% converting English-style quotes into Czech-style ones. Both
% single and double quotes are affected, i.e. |``text''| is
% converted to something like |,,text``| and |`text'| is converted
% to |,text`|. This conversion can be switched on and off with
% \cs{csprimeson} and \cs{csprimesoff}.\footnote{By the way, the
% names of these macros are misleading, because the handling of
% primes in math mode is rather marginal, the most important thing
% being the handling of quotes\ldots}
%
% These quotes present various troubles, e.g. the kerning is broken,
% apostrophes are converted to closing single quote, some primitives
% are broken (most notably the |\catcode`\|\meta{char} syntax will
% not work any more), and writing them to \file{.aux} files cannot
% be handled correctly. For these reasons, these commands are only
% available in \CS\LaTeX{} compatibility mode.
%
% \begin{macrocode}
\ifx\cs@compat@latex\relax
\let\cs@ltxprim@s\prim@s
\def\csprimeson{%
\catcode`\`\active \catcode`\'\active \let\prim@s\bbl@prim@s}
\def\csprimesoff{%
\catcode`\`12 \catcode`\'12 \let\prim@s\cs@ltxprim@s}
\begingroup\catcode`\`\active
\def\x{\endgroup
\def`{\futurelet\cs@next\cs@openquote}
\def\cs@openquote{%
\ifx`\cs@next \expandafter\cs@opendq
\else \expandafter\clq
\fi}%
}\x
\begingroup\catcode`\'\active
\def\x{\endgroup
\def'{\textormath{\futurelet\cs@next\cs@closequote}
{^\bgroup\prim@s}}
\def\cs@closequote{%
\ifx'\cs@next \expandafter\cs@closedq
\else \expandafter\crq
\fi}%
}\x
\def\cs@opendq{\clqq\let\cs@next= }
\def\cs@closedq{\crqq\let\cs@next= }
% \end{macrocode}
%
% The way I recommend for typesetting quotes in Czech documents
% is to use shorthands similar to those used in German.
%
% \begin{macrocode}
\else
\initiate@active@char{"}
\expandafter\addto\csname extras\CurrentOption\endcsname{%
\bbl@activate{"}}
\expandafter\addto\csname noextras\CurrentOption\endcsname{%
\bbl@deactivate{"}}
\declare@shorthand{czech}{"`}{\clqq}
\declare@shorthand{czech}{"'}{\crqq}
\declare@shorthand{czech}{"<}{\flqq}
\declare@shorthand{czech}{">}{\frqq}
\declare@shorthand{czech}{"=}{\cs@splithyphen}
\fi
% \end{macrocode}
%
% \begin{macro}{\clqq}
% This is the CS opening quote, which is similar to the German
% quote (\cs{glqq}) but the kerning is different.
%
% For the OT1 encoding, the quote is constructed from the right
% double quote (i.e. the ``Opening quotes'' character) by moving
% it down to the baseline and shifting it to the right, or to the
% left if italic correction is positive.
%
% For T1, the ``German Opening quotes'' is used. It is moved to
% the right and the total width is enlarged. This is done in an
% attempt to minimize the difference between the OT1 and T1
% versions.
%
% \changes{3.0}{2006/04/20}{Added \cs{leavevmode} to allow an opening
% quote at the beginning of a paragraph}
% \begin{macrocode}
\ProvideTextCommand{\clqq}{OT1}{%
\set@low@box{\textquotedblright}%
\setbox\@ne=\hbox{l\/}\dimen\@ne=\wd\@ne
\setbox\@ne=\hbox{l}\advance\dimen\@ne-\wd\@ne
\leavevmode
\ifdim\dimen\@ne>\z@\kern-.1em\box\z@\kern.1em
\else\kern.1em\box\z@\kern-.1em\fi\allowhyphens}
\ProvideTextCommand{\clqq}{T1}
{\kern.1em\quotedblbase\kern-.0158em\relax}
\ProvideTextCommandDefault{\clqq}{\UseTextSymbol{OT1}\clqq}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\crqq}
% For OT1, the CS closing quote is basically the same as
% \cs{grqq}, only the \cs{textormath} macro is not used, because
% as far as I know, \cs{grqq} does not work in math mode anyway.
%
% For T1, the character is slightly wider and shifted to the
% right to match its OT1 counterpart.
%
% \begin{macrocode}
\ProvideTextCommand{\crqq}{OT1}
{\save@sf@q{\nobreak\kern-.07em\textquotedblleft\kern.07em}}
\ProvideTextCommand{\crqq}{T1}
{\save@sf@q{\nobreak\kern.06em\textquotedblleft\kern.024em}}
\ProvideTextCommandDefault{\crqq}{\UseTextSymbol{OT1}\crqq}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\clq}
% \begin{macro}{\crq}
%
% Single CS quotes are similar to double quotes (see the
% discussion above).
%
% \begin{macrocode}
\ProvideTextCommand{\clq}{OT1}
{\set@low@box{\textquoteright}\box\z@\kern.04em\allowhyphens}
\ProvideTextCommand{\clq}{T1}
{\quotesinglbase\kern-.0428em\relax}
\ProvideTextCommandDefault{\clq}{\UseTextSymbol{OT1}\clq}
\ProvideTextCommand{\crq}{OT1}
{\save@sf@q{\nobreak\textquoteleft\kern.17em}}
\ProvideTextCommand{\crq}{T1}
{\save@sf@q{\nobreak\textquoteleft\kern.17em}}
\ProvideTextCommandDefault{\crq}{\UseTextSymbol{OT1}\crq}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\uv}
% There are two versions of \cs{uv}. The older one opens a group
% and uses \cs{aftergroup} to typeset the closing quotes. This
% version allows using \cs{verb} inside the quotes, because the
% enclosed text is not passed as an argument, but unfortunately
% it breaks any kerning with the quotes. Although the kerning
% with the opening quote could be fixed, the kerning with the
% closing quote cannot.
%
% The newer version is defined as a command with one parameter.
% It preserves kerning but since the quoted text is passed as an
% argument, it cannot contain \cs{verb}.
%
% Decide which version of \cs{uv} should be used. For sake
% of compatibility, we use the older version with plain \TeX{}
% and the newer version with \LaTeXe.
% \begin{macrocode}
\ifx\cs@compat@plain\@undefined\else\let\cs@olduv=\relax\fi
\ifx\cs@olduv\@undefined
\DeclareRobustCommand\uv[1]{{\leavevmode\clqq#1\crqq}}
\else
\DeclareRobustCommand\uv{\bgroup\aftergroup\closequotes
\leavevmode\clqq\let\cs@next=}
\def\closequotes{\unskip\crqq\relax}
\fi
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\cs@wordlen}
% Declare a counter to hold the length of the word after the
% hyphen.
%
% \begin{macrocode}
\newcount\cs@wordlen
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\cs@hyphen}
% \begin{macro}{\cs@endash}
% \begin{macro}{\cs@emdash}
% Store the original hyphen in a macro. Ditto for the ligatures.
%
% \changes{czech-3.1}{2006/10/07}{ensure correct catcode for the
% saved hyphen}
% \begin{macrocode}
\begingroup\catcode`\-12
\def\x{\endgroup
\def\cs@hyphen{-}
\def\cs@endash{--}
\def\cs@emdash{---}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\cs@boxhyphen}
% Provide a non-breakable hyphen to be used when a compound word
% is too short to be split, i.e. the second part is shorter than
% \cs{righthyphenmin}.
%
% \begin{macrocode}
\def\cs@boxhyphen{\hbox{-}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\cs@splithyphen}
% The macro \cs{cs@splithyphen} inserts a split hyphen, while
% allowing both parts of the compound word to be hyphenated at
% other places too.
%
% \begin{macrocode}
\def\cs@splithyphen{\kern\z@
\discretionary{-}{\char\hyphenchar\the\font}{-}\nobreak\hskip\z@}
}\x
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{-}
% To minimize the effects of activating the hyphen character,
% the active definition expands to the non-active character
% in all cases where hyphenation cannot occur, i.e. if not
% typesetting (check \cs{protect}), not in horizontal mode,
% or in inner horizontal mode.
%
% \begin{macrocode}
\initiate@active@char{-}
\declare@shorthand{czech}{-}{%
\ifx\protect\@typeset@protect
\ifhmode
\ifinner
\bbl@afterelse\bbl@afterelse\bbl@afterelse\cs@hyphen
\else
\bbl@afterfi\bbl@afterelse\bbl@afterelse\cs@firsthyphen
\fi
\else
\bbl@afterfi\bbl@afterelse\cs@hyphen
\fi
\else
\bbl@afterfi\cs@hyphen
\fi}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\cs@firsthyphen}
% \begin{macro}{\cs@firsthyph@n}
% \begin{macro}{\cs@secondhyphen}
% \begin{macro}{\cs@secondhyph@n}
% If we encounter a hyphen, check whether it is followed
% by a second or a third hyphen and if so, insert the
% corresponding ligature.
%
% If we don't find a hyphen, the token found will be placed
% in \cs{cs@token} for further analysis, and it will also stay
% in the input.
%
% \begin{macrocode}
\begingroup\catcode`\-\active
\def\x{\endgroup
\def\cs@firsthyphen{\futurelet\cs@token\cs@firsthyph@n}
\def\cs@firsthyph@n{%
\ifx -\cs@token
\bbl@afterelse\cs@secondhyphen
\else
\bbl@afterfi\cs@checkhyphen
\fi}
\def\cs@secondhyphen ##1{%
\futurelet\cs@token\cs@secondhyph@n}
\def\cs@secondhyph@n{%
\ifx -\cs@token
\bbl@afterelse\cs@emdash\@gobble
\else
\bbl@afterfi\cs@endash
\fi}
}\x
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\cs@checkhyphen}
% Check that hyphenation is enabled, and if so, start analyzing
% the rest of the word, i.e. initialize \cs{cs@word} and \cs{cs@wordlen}
% and start processing input with \cs{cs@scanword}.
%
% \begin{macrocode}
\def\cs@checkhyphen{%
\ifnum\expandafter\hyphenchar\the\font=`\-
\def\cs@word{}\cs@wordlen\z@
\bbl@afterelse\cs@scanword
\else
\cs@hyphen
\fi}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\cs@scanword}
% \begin{macro}{\cs@continuescan}
% \begin{macro}{\cs@gettoken}
% \begin{macro}{\cs@gett@ken}
% Each token is first analyzed with \cs{cs@scanword}, which expands
% the token and passes the first token of the result to
% \cs{cs@gett@ken}. If the expanded token is not identical to the
% unexpanded one, presume that it might be expanded further and
% pass it back to \cs{cs@scanword} until you get an unexpandable
% token. Then analyze it in \cs{cs@examinetoken}.
%
% The \cs{cs@continuescan} macro does the same thing as
% \cs{cs@scanword}, but it does not require the first token to be
% in \cs{cs@token} already.
%
% \begin{macrocode}
\def\cs@scanword{\let\cs@lasttoken= \cs@token\expandafter\cs@gettoken}
\def\cs@continuescan{\let\cs@lasttoken\@undefined\expandafter\cs@gettoken}
\def\cs@gettoken{\futurelet\cs@token\cs@gett@ken}
\def\cs@gett@ken{%
\ifx\cs@token\cs@lasttoken \def\cs@next{\cs@examinetoken}%
\else \def\cs@next{\cs@scanword}%
\fi \cs@next}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{cs@examinetoken}
% Examine the token in \cs{cs@token}:
%
% \begin{itemize}
% \item
% If it is a letter (catcode 11) or other (catcode 12), add it
% to \cs{cs@word} with \cs{cs@addparam}.
%
% \item
% If it is the \cs{char} primitive, add it with \cs{cs@expandchar}.
%
% \item
% If the token starts or ends a group, ignore it with
% \cs{cs@ignoretoken}.
%
% \item
% Otherwise analyze the meaning of the token with
% \cs{cs@checkchardef} to detect primitives defined with
% \cs{chardef}.
%
% \end{itemize}
%
% \begin{macrocode}
\def\cs@examinetoken{%
\ifcat A\cs@token
\def\cs@next{\cs@addparam}%
\else\ifcat 0\cs@token
\def\cs@next{\cs@addparam}%
\else\ifx\char\cs@token
\def\cs@next{\afterassignment\cs@expandchar\let\cs@token= }%
\else\ifx\bgroup\cs@token
\def\cs@next{\cs@ignoretoken\bgroup}%
\else\ifx\egroup\cs@token
\def\cs@next{\cs@ignoretoken\egroup}%
\else\ifx\begingroup\cs@token
\def\cs@next{\cs@ignoretoken\begingroup}%
\else\ifx\endgroup\cs@token
\def\cs@next{\cs@ignoretoken\endgroup}%
\else
\def\cs@next{\expandafter\expandafter\expandafter\cs@checkchardef
\expandafter\meaning\expandafter\cs@token\string\char\end}%
\fi\fi\fi\fi\fi\fi\fi\cs@next}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\cs@checkchardef}
% Check the meaning of a token and if it is a primitive defined
% with \cs{chardef}, pass it to \cs{\cs@examinechar} as if it were
% a \cs{char} sequence. Otherwise, there are no more word characters,
% so do the final actions in \cs{cs@nosplit}.
%
% \begin{macrocode}
\expandafter\def\expandafter\cs@checkchardef
\expandafter#\expandafter1\string\char#2\end{%
\def\cs@token{#1}%
\ifx\cs@token\@empty
\def\cs@next{\afterassignment\cs@examinechar\let\cs@token= }%
\else
\def\cs@next{\cs@nosplit}%
\fi \cs@next}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\cs@ignoretoken}
% Add a token to \cs{cs@word} but do not update the \cs{cs@wordlen}
% counter. This is mainly useful for group starting and ending
% primitives, which need to be preserved, but do not affect the word
% boundary.
%
% \begin{macrocode}
\def\cs@ignoretoken#1{%
\edef\cs@word{\cs@word#1}%
\afterassignment\cs@continuescan\let\cs@token= }
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{cs@addparam}
% Add a token to \cs{cs@word} and check its lccode. Note that
% this macro can only be used for tokens which can be passed as
% a parameter.
%
% \begin{macrocode}
\def\cs@addparam#1{%
\edef\cs@word{\cs@word#1}%
\cs@checkcode{\lccode`#1}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\cs@expandchar}
% \begin{macro}{\cs@examinechar}
% Add a \cs{char} sequence to \cs{cs@word} and check its lccode.
% The charcode is first parsed in \cs{cs@expandchar} and then the
% resulting \cs{chardef}-defined sequence is analyzed in
% \cs{cs@examinechar}.
%
% \begin{macrocode}
\def\cs@expandchar{\afterassignment\cs@examinechar\chardef\cs@token=}
\def\cs@examinechar{%
\edef\cs@word{\cs@word\char\the\cs@token\space}%
\cs@checkcode{\lccode\cs@token}}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\cs@checkcode}
% Check the lccode of a character. If it is zero, it does not count
% to the current word, so finish it with \cs{cs@nosplit}. Otherwise
% update the \cs{cs@wordlen} counter and go on scanning the word
% with \cs{cs@continuescan}. When enough characters are gathered in
% \cs{cs@word} to allow word break, insert the split hyphen and
% finish.
%
% \begin{macrocode}
\def\cs@checkcode#1{%
\ifnum0=#1
\def\cs@next{\cs@nosplit}%
\else
\advance\cs@wordlen\@ne
\ifnum\righthyphenmin>\the\cs@wordlen
\def\cs@next{\cs@continuescan}%
\else
\cs@splithyphen
\def\cs@next{\cs@word}%
\fi
\fi \cs@next}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\cs@nosplit}
% Insert a non-breakable hyphen followed by the saved word.
%
% \begin{macrocode}
\def\cs@nosplit{\cs@boxhyphen\cs@word}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\cs@hyphen}
% The \cs{minus} sequence can be used where the active hyphen
% does not work, e.g. in arguments to \TeX{} primitives in outer
% horizontal mode.
%
% \begin{macrocode}
\let\minus\cs@hyphen
% \end{macrocode}
% \end{macro}
% \begin{macro}{\standardhyphens}
% \begin{macro}{\splithyphens}
% These macros control whether split hyphens are allowed in Czech
% and/or Slovak texts. You may use them in any language, but the
% split hyphen is only activated for Czech and Slovak.
%
% \changes{czech-3.1}{2006/10/07}{activate with split hyphens and
% deactivate with standard hyphens, not vice versa}
% \begin{macrocode}
\def\standardhyphens{\cs@splithyphensfalse\cs@deactivatehyphens}
\def\splithyphens{\cs@splithyphenstrue\cs@activatehyphens}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\cs@splitattr}
% Now we declare the |split| language attribute. This is
% similar to the |split| package option of cslatex, but it
% only affects Czech, not Slovak.
%
% \changes{czech-3.1}{2006/10/07}{attribute added}
% \begin{macrocode}
\def\cs@splitattr{\babel@save\ifcs@splithyphens\splithyphens}
\bbl@declare@ttribute{czech}{split}{%
\addto\extrasczech{\cs@splitattr}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\cs@activatehyphens}
% \begin{macro}{\cs@deactivatehyphens}
% These macros are defined as \cs{relax} by default to prevent
% activating/deactivating the hyphen character. They are redefined
% when the language is switched to Czech/Slovak. At that moment
% the hyphen is also activated if split hyphens were requested with
% \cs{splithyphens}.
%
% When the language is de-activated, de-activate the hyphen and
% restore the bogus definitions of these macros.
%
% \begin{macrocode}
\let\cs@activatehyphens\relax
\let\cs@deactivatehyphens\relax
\expandafter\addto\csname extras\CurrentOption\endcsname{%
\def\cs@activatehyphens{\bbl@activate{-}}%
\def\cs@deactivatehyphens{\bbl@deactivate{-}}%
\ifcs@splithyphens\cs@activatehyphens\fi}
\expandafter\addto\csname noextras\CurrentOption\endcsname{%
\cs@deactivatehyphens
\let\cs@activatehyphens\relax
\let\cs@deactivatehyphens\relax}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\cs@looseness}
% \begin{macro}{\looseness}
% One of the most common situations where an active hyphen will not
% work properly is the \cs{looseness} primitive. Change its definition
% so that it deactivates the hyphen if needed.
%
% \begin{macrocode}
\let\cs@looseness\looseness
\def\looseness{%
\ifcs@splithyphens
\cs@deactivatehyphens\afterassignment\cs@activatehyphens \fi
\cs@looseness}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\cs@selectlanguage}
% \begin{macro}{\cs@main@language}
% Specifying the |nocaptions| option means that captions and dates
% are not redefined by default, but they can be switched on later
% with \cs{captionsczech} and/or \cs{dateczech}.
%
% We mimic this behavior by redefining \cs{selectlanguage}. This
% macro is called once at the beginning of the document to set the
% main language of the document. If this is \cs{cs@main@language},
% it disables the macros for setting captions and date. In any
% case, it restores the original definition of \cs{selectlanguage}
% and expands it.
%
% The definition of \cs{selectlanguage} can be shared between Czech
% and Slovak; the actual language is stored in \cs{cs@main@language}.
%
% \begin{macrocode}
\ifx\cs@nocaptions\@undefined\else
\edef\cs@main@language{\CurrentOption}
\ifx\cs@origselect\@undefined
\let\cs@origselect=\selectlanguage
\def\selectlanguage{%
\let\selectlanguage\cs@origselect
\ifx\bbl@main@language\cs@main@language
\expandafter\cs@selectlanguage
\else
\expandafter\selectlanguage
\fi}
\def\cs@selectlanguage{%
\cs@tempdisable{captions}%
\cs@tempdisable{date}%
\selectlanguage}
% \end{macrocode}
%
% \begin{macro}{\cs@tempdisable}
% \cs{cs@tempdisable} disables a language setup macro temporarily,
% i.e. the macro with the name of \meta{\#1}|\bbl@main@language|
% just restores the original definition and purges the saved macro
% from memory.
%
% \begin{macrocode}
\def\cs@tempdisable#1{%
\def\@tempa{cs@#1}%
\def\@tempb{#1\bbl@main@language}%
\expandafter\expandafter\expandafter\let
\expandafter \csname\expandafter \@tempa \expandafter\endcsname
\csname \@tempb \endcsname
\expandafter\edef\csname \@tempb \endcsname{%
\let \expandafter\noexpand \csname \@tempb \endcsname
\expandafter\noexpand \csname \@tempa \endcsname
\let \expandafter\noexpand\csname \@tempa \endcsname
\noexpand\@undefined}}
% \end{macrocode}
% \end{macro}
%
% These macros are not needed, once the initialization is over.
%
% \begin{macrocode}
\@onlypreamble\cs@main@language
\@onlypreamble\cs@origselect
\@onlypreamble\cs@selectlanguage
\@onlypreamble\cs@tempdisable
\fi
\fi
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% The encoding of mathematical fonts should be changed to IL2. This
% allows to use accented letter in some font families. Besides,
% documents do not use CM fonts if there are equivalents in CS-fonts,
% so there is no need to have both bitmaps of CM-font and CS-font.
%
% \cs{@font@warning} and \cs{@font@info} are temporarily redefined
% to avoid annoying font warnings.
%
% \begin{macrocode}
\ifx\cs@compat@plain\@undefined
\ifx\cs@check@enc\@undefined\else
\def\cs@check@enc{
\ifx\encodingdefault\cs@iltw@
\let\cs@warn\@font@warning \let\@font@warning\@gobble
\let\cs@info\@font@info \let\@font@info\@gobble
\SetSymbolFont{operators}{normal}{\cs@iltw@}{cmr}{m}{n}
\SetSymbolFont{operators}{bold}{\cs@iltw@}{cmr}{bx}{n}
\SetMathAlphabet\mathbf{normal}{\cs@iltw@}{cmr}{bx}{n}
\SetMathAlphabet\mathit{normal}{\cs@iltw@}{cmr}{m}{it}
\SetMathAlphabet\mathrm{normal}{\cs@iltw@}{cmr}{m}{n}
\SetMathAlphabet\mathsf{normal}{\cs@iltw@}{cmss}{m}{n}
\SetMathAlphabet\mathtt{normal}{\cs@iltw@}{cmtt}{m}{n}
\SetMathAlphabet\mathbf{bold}{\cs@iltw@}{cmr}{bx}{n}
\SetMathAlphabet\mathit{bold}{\cs@iltw@}{cmr}{bx}{it}
\SetMathAlphabet\mathrm{bold}{\cs@iltw@}{cmr}{bx}{n}
\SetMathAlphabet\mathsf{bold}{\cs@iltw@}{cmss}{bx}{n}
\SetMathAlphabet\mathtt{bold}{\cs@iltw@}{cmtt}{m}{n}
\let\@font@warning\cs@warn \let\cs@warn\@undefined
\let\@font@info\cs@info \let\cs@info\@undefined
\fi
\let\cs@check@enc\@undefined}
\AtBeginDocument{\cs@check@enc}
\fi
\fi
% \end{macrocode}
%
% \begin{macro}{cs@undoiltw@}
%
% The thing is that \LaTeXe{} core only supports the T1 encoding
% and does not bother changing the uc/lc/sfcodes when encoding
% is switched. :( However, the IL2 encoding \emph{does} change
% these codes, so if encoding is switched back from IL2, we must
% also undo the effect of this change to be compatible with
% \LaTeXe. OK, this is not the right\textsuperscript{TM} solution
% but it works. Cheers to Petr Ol\v s\'ak.
%
% \begin{macrocode}
\def\cs@undoiltw@{%
\uccode158=208 \lccode158=158 \sfcode158=1000
\sfcode159=1000
\uccode165=133 \lccode165=165 \sfcode165=1000
\uccode169=137 \lccode169=169 \sfcode169=1000
\uccode171=139 \lccode171=171 \sfcode171=1000
\uccode174=142 \lccode174=174 \sfcode174=1000
\uccode181=149
\uccode185=153
\uccode187=155
\uccode190=0 \lccode190=0
\uccode254=222 \lccode254=254 \sfcode254=1000
\uccode255=223 \lccode255=255 \sfcode255=1000}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{@@enc@update}
%
% Redefine the \LaTeXe{} internal function \cs{@@enc@update} to
% change the encodings correctly.
%
% \begin{macrocode}
\ifx\cs@enc@update\@undefined
\ifx\@@enc@update\@undefined\else
\let\cs@enc@update\@@enc@update
\def\@@enc@update{\ifx\cf@encoding\cs@iltw@\cs@undoiltw@\fi
\cs@enc@update
\expandafter\ifnum\csname l@\languagename\endcsname=\the\language
\expandafter\ifx
\csname l@\languagename:\f@encoding\endcsname\relax
\else
\expandafter\expandafter\expandafter\let
\expandafter\csname
\expandafter l\expandafter @\expandafter\languagename
\expandafter\endcsname\csname l@\languagename:\f@encoding\endcsname
\fi
\language=\csname l@\languagename\endcsname\relax
\fi}
\fi\fi
% \end{macrocode}
% \end{macro}
%
% The macro |\ldf@finish| takes care of looking for a
% configuration file, setting the main language to be switched on
% at |\begin{document}| and resetting the category code of
% \texttt{@} to its original value.
% \changes{czech-1.3h}{1996/11/02}{Now use \cs{ldf@finish} to wrap up}
% \begin{macrocode}
\ldf@finish\CurrentOption
%</code>
% \end{macrocode}
%
% \Finale
%%
%% \CharacterTable
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%% Digits \0\1\2\3\4\5\6\7\8\9
%% Exclamation \! Double quote \" Hash (number) \#
%% Dollar \$ Percent \% Ampersand \&
%% Acute accent \' Left paren \( Right paren \)
%% Asterisk \* Plus \+ Comma \,
%% Minus \- Point \. Solidus \/
%% Colon \: Semicolon \; Less than \<
%% Equals \= Greater than \> Question mark \?
%% Commercial at \@ Left bracket \[ Backslash \\
%% Right bracket \] Circumflex \^ Underscore \_
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
%%
\endinput