Debian Codegraph @

texmf-dist/doc/latex/chemformula-ru/chemformula-ru.tex

raw
1 \documentclass[a4paper]{article}
2 \usepackage[]{geometry}
3 \geometry{total={180mm, 267mm}, centering}
4
5 \usepackage[russian]{babel}
6 \usepackage[ch2Ch,cosh2ch]{chemformula-ru}
7 \usepackage{array,multicol}
8
9 \begin{document}
10
11 \title{The \textsf{chemformula-ru} package}
12 \author{Alexey Kuznetsov}
13 \date{10.07.2024}
14 \maketitle
15
16 \begin{multicols}{2}
17 The \textsf{chemformula} package defines the command\\[.5ex]
18 \mbox{}\hfil\verb|\сh{|\textit{chemical formula}\verb|}|\\[.5ex]
19 to type up chemical formulas:\\[.5ex]
20 \mbox{}\hfil\verb|\ch{H3PO4}| $\to$ \ch{H3PO4}.\\[.5ex]
21 Russian settings of the \textsf{babel} package \textsf{(russianb.ldf)} define the same command to print the hyperbolic cosine:\\[.5ex]
22 \mbox{}\hfil\verb|$\ch x$|\ $\to\ \Ch x$.\\[.5ex]
23 Loading packages together leads to the error\\[1ex]
24 \mbox{}\hfil\verb|! LaTeX Error: Command \ch already defined.|\\[1ex]
25 The \textsf{chemformula-ru} package loads the \textsf{chemformula} and ``neutralizes'' the error by making the babel's command undefined.
26 Two it's parameters configure printing of the hyperbolic cosine in Russian notation:\\[1ex]
27 \begin{tabular}{>\sf l @{ ---\quad } p{.75\linewidth}}
28 cosh2ch & overrides the \verb|\cosh| command for printing:\linebreak
29 \verb|$\cosh x$| $\to \cosh x$. \\[1ex]
30 ch2Ch & defines a new \verb|\Ch| command for printing:\linebreak
31 \verb|$\Ch x$| $\to \Ch x$.
32 \end{tabular}\\[1ex]
33
34 Пакет \textsf{chemformula} вводит команду\\[.5ex]
35 \mbox{}\hfil\verb|\сh{|\textit{химическая фоормула}\verb|}|\\[.5ex]
36 для верстки химических формул:\\[.5ex]
37 \mbox{}\hfil\verb|\ch{H3PO4}| $\to$ \ch{H3PO4}.\\[.5ex]
38 Русские настройки пакета \textsf{babel (russianb.ldf)} определяют одноименную команду для печати гиперболического косинуса:\\[-.85\baselineskip]
39 \mbox{}\hfil\verb|$\ch x$|\ $\to\ \Ch x$.\\[.5ex]
40 Cовместная загрузка пакетов ведет к ошибке\\[1ex]
41 \mbox{}\hfil\verb|! LaTeX Error: Command \ch already defined.|\\[1ex]
42 Пакет \textsf{chemformula-ru} загружает \textsf{chemformula} и <<нейтрализует>> ошибку, делая команду пакета \textsf{babel} неопределенной.
43 Два его параметра настраивают печать гиперболического косинуса в русских нотациях:\\[1ex]
44 \begin{tabular}{>\sf l @{ --- } p{.8\linewidth}}
45 cosh2ch & переопределяет для печати команду \verb|\cosh|:\linebreak
46 \verb|$\cosh x$| $\to \cosh x$. \\[1ex]
47 ch2Ch & определяет для печати новую команду \verb|\Ch|:\linebreak
48 \verb|$\Ch x$| $\to \Ch x$.
49 \end{tabular}
50 \end{multicols}
51
52 \thispagestyle{empty}
53
54 \noindent\hrulefill
55
56 \begin{verbatim}
57 %% Redefine \cosh to print ch.
58 \DeclareOption{cosh2ch}{\def\cosh@ch{%
59 \DeclareRobustCommand\cosh{\mathop{\operator@font ch}\nolimits}}}
60
61 %% Define new command \Ch to print ch.
62 \DeclareOption{ch2Ch}{\def\ch@Ch{%
63 \DeclareRobustCommand\Ch{\mathop{\operator@font ch}\nolimits}}}
64
65 %% Pass all other options to the chemformula package.
66 \DeclareOption*{\PassOptionsToPackage\CurrentOption{chemformula}}
67
68 \ProcessOptions\relax
69
70 \RequirePackage{chemformula}
71
72 \BeforeBeginEnvironment{document}{
73 \let\@Chem@Formula\ch \let\ch\undefined
74 \AtBeginDocument{
75 \let\ch\@Chem@Formula
76 \@ifundefined{cosh@ch}{\relax}{\cosh@ch}
77 @ifundefined{ch@Ch}{\relax}{\ch@Ch}
78 } }
79
80 \endinput
81 \end{verbatim}
82
83 \end{document}