Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Defining Russian Asbuk counters and redirecting Alph to Asbuk respecting the (max) width #26

Open
ivankokan opened this issue Sep 3, 2021 · 0 comments

Comments

@ivankokan
Copy link

ivankokan commented Sep 3, 2021

Hi, motivated by the latex3/babel#144 issue, I want to get your expert/author's opinion on the following MWE in which I want to properly specify two new variants of enumitem's counters, respecting the widest ones and redirecting all alph/Alph formats to use them by default:

\documentclass{article}

\usepackage[T2A,T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[russian,english]{babel}

\usepackage{enumitem}

\makeatletter
\AddEnumerateCounter{\asbuk}{\russian@alph}{ж}
\AddEnumerateCounter{\Asbuk}{\russian@Alph}{Ж}
\makeatother

\makeatletter
\addto\extrasrussian{
\babel@save{\alph}
\babel@save{\Alph}
\let\alph\asbuk
\let\Alph\Asbuk
}
\makeatother

\newcounter{counter}
\setcounter{counter}{7}


\begin{document}

English: \alph{counter}/\Alph{counter}
\begin{enumerate}[label=\alph*]
\item  1 \item  2 \item  3 \item  4 \item  5 \item  6 \item  7 \item  8 \item  9 \item 10
\item 11 \item 12 \item 13 \item 14 \item 15 \item 16 \item 17 \item 18 \item 19 \item 20
\end{enumerate}


\selectlanguage{russian}
\fontencoding{T2A}\selectfont
Russian: \alph{counter}/\Alph{counter}
\begin{enumerate}[label=\alph*]
\item  1 \item  2 \item  3 \item  4 \item  5 \item  6 \item  7 \item  8 \item  9 \item 10
\item 11 \item 12 \item 13 \item 14 \item 15 \item 16 \item 17 \item 18 \item 19 \item 20
\end{enumerate}


\selectlanguage{english}
\fontencoding{T1}\selectfont
English: \alph{counter}/\Alph{counter}
\begin{enumerate}[label=\alph*]
\item  1 \item  2 \item  3 \item  4 \item  5 \item  6 \item  7 \item  8 \item  9 \item 10
\item 11 \item 12 \item 13 \item 14 \item 15 \item 16 \item 17 \item 18 \item 19 \item 20
\end{enumerate}

\end{document}

Do you find the following lines

\makeatletter
\addto\extrasrussian{
\babel@save{\alph}
\babel@save{\Alph}
\let\alph\asbuk
\let\Alph\Asbuk
}
\makeatother

the most appropriate to achieve such a goal?

As far as I understand the documentation, \babel@save puts the control sequence on the stack and automatically restores (pops) the value when the language is unselected, so nothing has to be added to \noextrasrussian?

Regards, Ivan

EDIT: Enriched MWE to present the multi-language context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant