0

I have a problem with automatic sorting of lines containing information about authors of several articles, including Russian surname, first name and patronymic, other info, ORCID and e-mail. This information is written in separate *.ppl files for each article. The main file reads all *.ppl files and each line is set to some variables. The problem is that before the output to the "Information about authors" section, the lines need to be sorted by Cyrillic and then English alphabet.

Since there is a lot of code needed to read and process *.ppl files here, I have simplified the code to start describing the problem. Let

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

\newcounter{pplcount}
\newcommand\addp[1]{
    \stepcounter{pplcount}
    \expandafter\gdef\csname info\arabic{pplcount}\endcsname{#1}
}

\begin{document}

\addp{Валерий Валерьевич Валерьев; e-mail: [email protected]}
\addp{Борис Борисович Борисов; e-mail: [email protected]}
\addp{Александр Александрович Александров; e-mail: [email protected]}
\addp{Diana Davis; e-mail: [email protected]}

\makeatletter

\@nameuse{info3}

\@nameuse{info2}

\@nameuse{info1}

\@nameuse{info4}

\makeatother

\end{document}

then I need to use pdflatex to output the case-insensitive ordered list of authors first in the Russian alphabet ("А" "Б" "В" "Г" "Д" "Е" "Ж" "З" "И" "Й" "К" "Л" "М" "Н" "О" "П" "Р" "С" "Т" "У" "Ф" "Х" "Ц" "Ч" "Ш" "Щ" "Ъ" "Ы" "Ь" "Э" "Ю" "Я") and then in the English alphabet for any number of authors (usually no more than 50). Since the authors may have the same last names, it is necessary to sort up to the first mismatched character. Occasionally, the same author may be repeated in different articles in the same journal. Of course, it would be cool to automatically remove duplicates (that is, everything up to the semicolon), but I can manually do it because this happens extremely rarely. The screenshot shows the correct sort order for my example, which I did manually.

Correct Sorting

Also I tried texindy because it can sort Cyrillic and English strings separately. It works fine, but only if the sorted strings contain ONLY English or ONLY Cyrillic characters. In my case, only the e-mail remains in *.idx, but in the section with the correct first Cyrillic letter. By the way datatool package can sort Cyrillic strings but in the wrong order.

I am grateful to the tex.stackexchange community for the previous help! I hope someone can help me with this problem too.

1 Answer 1

0

I found the solution using the datatool package. It sorted Russian texts incorrectly by default, but after reading How can I use \dtlsort with different alphabets?, I realized that it is possible to redefine the macro \dtlsetUTFviiilccharcode (for case-insensitive comparisons) and sorting by Cyrillic characters is performed correctly. For, example:

\renewcommand*{\dtlsetUTFviiilccharcode}[2]{%
     \ifstrequal{#1}{А}{#2=123\relax}%
    {\ifstrequal{#1}{Б}{#2=124\relax}%
    {\ifstrequal{#1}{В}{#2=125\relax}%
    {\ifstrequal{#1}{Г}{#2=126\relax}%
    {\ifstrequal{#1}{Д}{#2=127\relax}%
    {\ifstrequal{#1}{Е}{#2=128\relax}%
    {\ifstrequal{#1}{Ё}{#2=129\relax}%
    {\ifstrequal{#1}{Ж}{#2=130\relax}%
    {\ifstrequal{#1}{З}{#2=131\relax}%
    {\ifstrequal{#1}{И}{#2=132\relax}%
    {\ifstrequal{#1}{Й}{#2=133\relax}%
    {\ifstrequal{#1}{К}{#2=134\relax}%
    {\ifstrequal{#1}{Л}{#2=135\relax}%
    {\ifstrequal{#1}{М}{#2=136\relax}%
    {\ifstrequal{#1}{Н}{#2=137\relax}%
    {\ifstrequal{#1}{О}{#2=138\relax}%
    {\ifstrequal{#1}{П}{#2=139\relax}%
    {\ifstrequal{#1}{Р}{#2=140\relax}%
    {\ifstrequal{#1}{С}{#2=141\relax}%
    {\ifstrequal{#1}{Т}{#2=142\relax}%
    {\ifstrequal{#1}{У}{#2=143\relax}%
    {\ifstrequal{#1}{Ф}{#2=144\relax}%
    {\ifstrequal{#1}{Х}{#2=144\relax}%
    {\ifstrequal{#1}{Ц}{#2=145\relax}%
    {\ifstrequal{#1}{Ч}{#2=146\relax}%
    {\ifstrequal{#1}{Ш}{#2=147\relax}%
    {\ifstrequal{#1}{Щ}{#2=148\relax}%
    {\ifstrequal{#1}{Ь}{#2=149\relax}%
    {\ifstrequal{#1}{Ы}{#2=150\relax}%
    {\ifstrequal{#1}{Ъ}{#2=151\relax}%
    {\ifstrequal{#1}{Э}{#2=152\relax}%
    {\ifstrequal{#1}{Ю}{#2=153\relax}%
    {\ifstrequal{#1}{Я}{#2=154\relax}%
    %
    {\ifstrequal{#1}{а}{#2=123\relax}%
    {\ifstrequal{#1}{б}{#2=124\relax}%
    {\ifstrequal{#1}{в}{#2=125\relax}%
    {\ifstrequal{#1}{г}{#2=126\relax}%
    {\ifstrequal{#1}{д}{#2=127\relax}%
    {\ifstrequal{#1}{е}{#2=128\relax}%
    {\ifstrequal{#1}{ё}{#2=129\relax}%
    {\ifstrequal{#1}{ж}{#2=130\relax}%
    {\ifstrequal{#1}{з}{#2=131\relax}%
    {\ifstrequal{#1}{и}{#2=132\relax}%
    {\ifstrequal{#1}{й}{#2=133\relax}%
    {\ifstrequal{#1}{к}{#2=134\relax}%
    {\ifstrequal{#1}{л}{#2=135\relax}%
    {\ifstrequal{#1}{м}{#2=136\relax}%
    {\ifstrequal{#1}{н}{#2=137\relax}%
    {\ifstrequal{#1}{о}{#2=138\relax}%
    {\ifstrequal{#1}{п}{#2=139\relax}%
    {\ifstrequal{#1}{р}{#2=140\relax}%
    {\ifstrequal{#1}{с}{#2=141\relax}%
    {\ifstrequal{#1}{т}{#2=142\relax}%
    {\ifstrequal{#1}{у}{#2=143\relax}%
    {\ifstrequal{#1}{ф}{#2=144\relax}%
    {\ifstrequal{#1}{х}{#2=144\relax}%
    {\ifstrequal{#1}{ц}{#2=145\relax}%
    {\ifstrequal{#1}{ч}{#2=146\relax}%
    {\ifstrequal{#1}{ш}{#2=147\relax}%
    {\ifstrequal{#1}{щ}{#2=148\relax}%
    {\ifstrequal{#1}{ь}{#2=149\relax}%
    {\ifstrequal{#1}{ы}{#2=150\relax}%
    {\ifstrequal{#1}{ъ}{#2=151\relax}%
    {\ifstrequal{#1}{э}{#2=152\relax}%
    {\ifstrequal{#1}{ю}{#2=153\relax}%
    {\ifstrequal{#1}{я}{#2=154\relax}%
    {\dtlsetdefaultUTFviiilccharcode{#1}{#2}}%
}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .