summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/chemformula-ru/chemformula-ru.tex
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/chemformula-ru/chemformula-ru.tex')
-rw-r--r--macros/latex/contrib/chemformula-ru/chemformula-ru.tex41
1 files changed, 21 insertions, 20 deletions
diff --git a/macros/latex/contrib/chemformula-ru/chemformula-ru.tex b/macros/latex/contrib/chemformula-ru/chemformula-ru.tex
index 02edcbca41..192da90cb4 100644
--- a/macros/latex/contrib/chemformula-ru/chemformula-ru.tex
+++ b/macros/latex/contrib/chemformula-ru/chemformula-ru.tex
@@ -3,7 +3,6 @@
\geometry{total={180mm, 267mm}, centering}
\usepackage[russian]{babel}
-\usepackage{chemformula}
\usepackage[ch2Ch,cosh2ch]{chemformula-ru}
\usepackage{array,multicol}
@@ -11,7 +10,7 @@
\title{The \textsf{chemformula-ru} package}
\author{Alexey Kuznetsov}
-\date{01.03.2024}
+\date{10.07.2024}
\maketitle
\begin{multicols}{2}
@@ -23,9 +22,8 @@ Russian settings of the \textsf{babel} package \textsf{(russianb.ldf)} define th
\mbox{}\hfil\verb|$\ch x$|\ $\to\ \Ch x$.\\[.5ex]
Loading packages together leads to the error\\[1ex]
\mbox{}\hfil\verb|! LaTeX Error: Command \ch already defined.|\\[1ex]
-The \textsf{chemformula-ru} package ``neutralizes'' it by making the babel's command undefined.
-
-The package has two parameters to configure the printing of the hyperbolic cosine in Russian notation:\\[1ex]
+The \textsf{chemformula-ru} package loads the \textsf{chemformula} and ``neutralizes'' the error by making the babel's command undefined.
+Two it's parameters configure printing of the hyperbolic cosine in Russian notation:\\[1ex]
\begin{tabular}{>\sf l @{ ---\quad } p{.75\linewidth}}
cosh2ch & overrides the \verb|\cosh| command for printing:\linebreak
\verb|$\cosh x$| $\to \cosh x$. \\[1ex]
@@ -37,13 +35,12 @@ ch2Ch & defines a new \verb|\Ch| command for printing:\linebreak
\mbox{}\hfil\verb|\сh{|\textit{химическая фоормула}\verb|}|\\[.5ex]
для верстки химических формул:\\[.5ex]
\mbox{}\hfil\verb|\ch{H3PO4}| $\to$ \ch{H3PO4}.\\[.5ex]
-Русские настройки пакета \textsf{babel (russianb.ldf)} определяют одноименную команду для печати гиперболического косинуса:\\[-.5ex]
+Русские настройки пакета \textsf{babel (russianb.ldf)} определяют одноименную команду для печати гиперболического косинуса:\\[-.85\baselineskip]
\mbox{}\hfil\verb|$\ch x$|\ $\to\ \Ch x$.\\[.5ex]
Cовместная загрузка пакетов ведет к ошибке\\[1ex]
\mbox{}\hfil\verb|! LaTeX Error: Command \ch already defined.|\\[1ex]
-Пакет \textsf{chemformula-ru} <<нейтрализует>> ее, делая команду пакета \textsf{babel} неопределенной.
-
-Пакет имеет два параметра, настраивающих печать гиперболического косинуса в русских нотациях:\\[1ex]
+Пакет \textsf{chemformula-ru} загружает \textsf{chemformula} и <<нейтрализует>> ошибку, делая команду пакета \textsf{babel} неопределенной.
+Два его параметра настраивают печать гиперболического косинуса в русских нотациях:\\[1ex]
\begin{tabular}{>\sf l @{ --- } p{.8\linewidth}}
cosh2ch & переопределяет для печати команду \verb|\cosh|:\linebreak
\verb|$\cosh x$| $\to \cosh x$. \\[1ex]
@@ -52,10 +49,11 @@ ch2Ch & определяет для печати новую команду \verb
\end{tabular}
\end{multicols}
+\thispagestyle{empty}
+
\noindent\hrulefill
\begin{verbatim}
-
%% Redefine \cosh to print ch.
\DeclareOption{cosh2ch}{\def\cosh@ch{%
\DeclareRobustCommand\cosh{\mathop{\operator@font ch}\nolimits}}}
@@ -64,19 +62,22 @@ ch2Ch & определяет для печати новую команду \verb
\DeclareOption{ch2Ch}{\def\ch@Ch{%
\DeclareRobustCommand\Ch{\mathop{\operator@font ch}\nolimits}}}
+%% Pass all other options to the chemformula package.
+\DeclareOption*{\PassOptionsToPackage\CurrentOption{chemformula}}
+
\ProcessOptions\relax
+\RequirePackage{chemformula}
+
\BeforeBeginEnvironment{document}{
- \IfPackageLoadedTF{chemformula}{
- \IfPackageLoadedWithOptionsTF{babel}{russian}{
- \let\@Chem@Formula\ch \let\ch\undefined
- \AtBeginDocument{ \let\ch\@Chem@Formula
- \@ifundefined{cosh@ch}{\relax}{\cosh@ch}
- \@ifundefined{ch@Ch}{\relax}{\ch@Ch}
- }
- } { \relax }
- } { \relax }
-}
+ \let\@Chem@Formula\ch \let\ch\undefined
+ \AtBeginDocument{
+ \let\ch\@Chem@Formula
+ \@ifundefined{cosh@ch}{\relax}{\cosh@ch}
+ @ifundefined{ch@Ch}{\relax}{\ch@Ch}
+ } }
+
+\endinput
\end{verbatim}
\end{document}