[LyX/master] Add workaround for missing \cyr... macros with Xe/LuaTeX
Juergen Spitzmueller <[email protected]>
| Newsgroups | gmane.editors.lyx.cvs |
|---|---|
| Message-ID | <[email protected]> |
commit be58b3afd55cf0e820c03d8828c3fb97bb587171 Author: Juergen Spitzmueller <[email protected]> Date: Sun Mar 15 15:28:51 2026 +0100 Add workaround for missing \cyr... macros with Xe/LuaTeX --- lib/doc/ru/Additional.lyx | 21 +++++++++++++++++++++ lib/doc/ru/EmbeddedObjects.lyx | 21 +++++++++++++++++++++ lib/doc/ru/Math.lyx | 17 +++++++++++++++++ lib/doc/ru/Shortcuts.lyx | 21 +++++++++++++++++++++ lib/doc/ru/UserGuide.lyx | 19 ++++++++++++++++++- lib/examples/ru/Graphics_and_Insets/XY-Figure.lyx | 22 ++++++++++++++++++++++ lib/examples/ru/Graphics_and_Insets/XY-Pic.lyx | 21 +++++++++++++++++++++ lib/examples/ru/Modules/Fancy_Colored_Boxes.lyx | 21 +++++++++++++++++++++ 8 files changed, 162 insertions(+), 1 deletion(-) diff --git a/lib/doc/ru/Additional.lyx b/lib/doc/ru/Additional.lyx index 25f252c5e7..77c296ffa5 100644 --- a/lib/doc/ru/Additional.lyx +++ b/lib/doc/ru/Additional.lyx @@ -39,6 +39,27 @@ % Use serif font \addtokomafont{disposition}{\rmfamily} \addtokomafont{descriptionlabel}{\rmfamily} + +\usepackage{iftex} +\iftutex + % convert \cyr... and \CYR... to Unicode + % these are used by varioref + % (https://github.com/latex3/latex2e/issues/2020) + % Workaround taken from + % https://tex.stackexchange.com/a/706098/19291 + \ExplSyntaxOn + \group_begin: + \cs_set:Npn \DeclareUnicodeCharacter #1 #2 + { + \bool_lazy_or:nnT + { \str_if_eq_p:ee { cyr } { \str_range:nnn { #2 } { 2 } { 4 } } }% \cyr... + { \str_if_eq_p:ee { CYR } { \str_range:nnn { #2 } { 2 } { 4 } } }% \CYR... + { \cs_gset:Npe #2 { \char_generate:nn { "#1 } { 11 } } } + } + \file_input:n { t2aenc.dfu } + \group_end: + \ExplSyntaxOff +\fi \end_preamble \options bibliography=totoc,index=totoc,BCOR7.5mm,titlepage,captions=tableheading \use_default_options false diff --git a/lib/doc/ru/EmbeddedObjects.lyx b/lib/doc/ru/EmbeddedObjects.lyx index ace1bb63f3..1c9ac202d0 100644 --- a/lib/doc/ru/EmbeddedObjects.lyx +++ b/lib/doc/ru/EmbeddedObjects.lyx @@ -159,6 +159,27 @@ % Use serif font \addtokomafont{disposition}{\rmfamily} \addtokomafont{descriptionlabel}{\rmfamily} + +\usepackage{iftex} +\iftutex + % convert \cyr... and \CYR... to Unicode + % these are used by varioref + % (https://github.com/latex3/latex2e/issues/2020) + % Workaround taken from + % https://tex.stackexchange.com/a/706098/19291 + \ExplSyntaxOn + \group_begin: + \cs_set:Npn \DeclareUnicodeCharacter #1 #2 + { + \bool_lazy_or:nnT + { \str_if_eq_p:ee { cyr } { \str_range:nnn { #2 } { 2 } { 4 } } }% \cyr... + { \str_if_eq_p:ee { CYR } { \str_range:nnn { #2 } { 2 } { 4 } } }% \CYR... + { \cs_gset:Npe #2 { \char_generate:nn { "#1 } { 11 } } } + } + \file_input:n { t2aenc.dfu } + \group_end: + \ExplSyntaxOff +\fi \end_preamble \options bibliography=totoc,index=totoc,BCOR7.5mm,titlepage,captions=tableheading,dvipsnames,table \use_default_options false diff --git a/lib/doc/ru/Math.lyx b/lib/doc/ru/Math.lyx index 085f2ad9de..09de785fde 100644 --- a/lib/doc/ru/Math.lyx +++ b/lib/doc/ru/Math.lyx @@ -138,6 +138,23 @@ \usepackage{iftex} \iftutex + % convert \cyr... and \CYR... to Unicode + % these are used by varioref + % (https://github.com/latex3/latex2e/issues/2020) + % Workaround taken from + % https://tex.stackexchange.com/a/706098/19291 + \ExplSyntaxOn + \group_begin: + \cs_set:Npn \DeclareUnicodeCharacter #1 #2 + { + \bool_lazy_or:nnT + { \str_if_eq_p:ee { cyr } { \str_range:nnn { #2 } { 2 } { 4 } } }% \cyr... + { \str_if_eq_p:ee { CYR } { \str_range:nnn { #2 } { 2 } { 4 } } }% \CYR... + { \cs_gset:Npe #2 { \char_generate:nn { "#1 } { 11 } } } + } + \file_input:n { t2aenc.dfu } + \group_end: + \ExplSyntaxOff % latinmodern (used with non-TeX fonts) does not have a combining cedilla % fake it (https://tex.stackexchange.com/a/164270/19291) \def\c#1{{\setbox0=\hbox{#1}\ifdim\ht0=1ex \accent184 #1% diff --git a/lib/doc/ru/Shortcuts.lyx b/lib/doc/ru/Shortcuts.lyx index d99a58a397..da125bd715 100644 --- a/lib/doc/ru/Shortcuts.lyx +++ b/lib/doc/ru/Shortcuts.lyx @@ -8,6 +8,27 @@ \begin_preamble % Use serif font \addtokomafont{disposition}{\rmfamily} + +\usepackage{iftex} +\iftutex + % convert \cyr... and \CYR... to Unicode + % these are used by varioref + % (https://github.com/latex3/latex2e/issues/2020) + % Workaround taken from + % https://tex.stackexchange.com/a/706098/19291 + \ExplSyntaxOn + \group_begin: + \cs_set:Npn \DeclareUnicodeCharacter #1 #2 + { + \bool_lazy_or:nnT + { \str_if_eq_p:ee { cyr } { \str_range:nnn { #2 } { 2 } { 4 } } }% \cyr... + { \str_if_eq_p:ee { CYR } { \str_range:nnn { #2 } { 2 } { 4 } } }% \CYR... + { \cs_gset:Npe #2 { \char_generate:nn { "#1 } { 11 } } } + } + \file_input:n { t2aenc.dfu } + \group_end: + \ExplSyntaxOff +\fi \end_preamble \use_default_options false \maintain_unincluded_children no diff --git a/lib/doc/ru/UserGuide.lyx b/lib/doc/ru/UserGuide.lyx index d078ead23e..28a4797efd 100644 --- a/lib/doc/ru/UserGuide.lyx +++ b/lib/doc/ru/UserGuide.lyx @@ -60,7 +60,7 @@ % quotations marks, so we fake them. \usepackage{stmaryrd} \usepackage{newunicodechar} - \newcommand{\DeclareUnicodeCharacter}[2]{% + \providecommand{\DeclareUnicodeCharacter}[2]{% \begingroup\lccode`|=\string"#1\relax \lowercase{\endgroup\newunicodechar{|}}{#2}% } @@ -72,6 +72,23 @@ \DeclareUnicodeCharacter{300B}{\ensuremath{\rangle\kern-2.5pt\rangle}} \DeclareUnicodeCharacter{3008}{\ensuremath{\langle}} \DeclareUnicodeCharacter{3009}{\ensuremath{\rangle}} + % convert \cyr... and \CYR... to Unicode + % these are used by varioref + % (https://github.com/latex3/latex2e/issues/2020) + % Workaround taken from + % https://tex.stackexchange.com/a/706098/19291 + \ExplSyntaxOn + \group_begin: + \cs_set:Npn \DeclareUnicodeCharacter #1 #2 + { + \bool_lazy_or:nnT + { \str_if_eq_p:ee { cyr } { \str_range:nnn { #2 } { 2 } { 4 } } }% \cyr... + { \str_if_eq_p:ee { CYR } { \str_range:nnn { #2 } { 2 } { 4 } } }% \CYR... + { \cs_gset:Npe #2 { \char_generate:nn { "#1 } { 11 } } } + } + \file_input:n { t2aenc.dfu } + \group_end: + \ExplSyntaxOff \fi \end_preamble \options refpage,intoc,bibliography=totoc,index=totoc,BCOR7.5mm,captions=tableheading diff --git a/lib/examples/ru/Graphics_and_Insets/XY-Figure.lyx b/lib/examples/ru/Graphics_and_Insets/XY-Figure.lyx index 4942553222..8c73cee9be 100644 --- a/lib/examples/ru/Graphics_and_Insets/XY-Figure.lyx +++ b/lib/examples/ru/Graphics_and_Insets/XY-Figure.lyx @@ -5,6 +5,28 @@ \save_transient_properties false \origin /systemlyxdir/examples/ru/Graphics_and_Insets/ \textclass article +\begin_preamble +\usepackage{iftex} +\iftutex + % convert \cyr... and \CYR... to Unicode + % these are used by varioref + % (https://github.com/latex3/latex2e/issues/2020) + % Workaround taken from + % https://tex.stackexchange.com/a/706098/19291 + \ExplSyntaxOn + \group_begin: + \cs_set:Npn \DeclareUnicodeCharacter #1 #2 + { + \bool_lazy_or:nnT + { \str_if_eq_p:ee { cyr } { \str_range:nnn { #2 } { 2 } { 4 } } }% \cyr... + { \str_if_eq_p:ee { CYR } { \str_range:nnn { #2 } { 2 } { 4 } } }% \CYR... + { \cs_gset:Npe #2 { \char_generate:nn { "#1 } { 11 } } } + } + \file_input:n { t2aenc.dfu } + \group_end: + \ExplSyntaxOff +\fi +\end_preamble \use_default_options true \maintain_unincluded_children no \language russian diff --git a/lib/examples/ru/Graphics_and_Insets/XY-Pic.lyx b/lib/examples/ru/Graphics_and_Insets/XY-Pic.lyx index 13062845d1..7fb4133598 100644 --- a/lib/examples/ru/Graphics_and_Insets/XY-Pic.lyx +++ b/lib/examples/ru/Graphics_and_Insets/XY-Pic.lyx @@ -39,6 +39,27 @@ % Use serif font \addtokomafont{disposition}{\rmfamily} \addtokomafont{descriptionlabel}{\rmfamily} + +\usepackage{iftex} +\iftutex + % convert \cyr... and \CYR... to Unicode + % these are used by varioref + % (https://github.com/latex3/latex2e/issues/2020) + % Workaround taken from + % https://tex.stackexchange.com/a/706098/19291 + \ExplSyntaxOn + \group_begin: + \cs_set:Npn \DeclareUnicodeCharacter #1 #2 + { + \bool_lazy_or:nnT + { \str_if_eq_p:ee { cyr } { \str_range:nnn { #2 } { 2 } { 4 } } }% \cyr... + { \str_if_eq_p:ee { CYR } { \str_range:nnn { #2 } { 2 } { 4 } } }% \CYR... + { \cs_gset:Npe #2 { \char_generate:nn { "#1 } { 11 } } } + } + \file_input:n { t2aenc.dfu } + \group_end: + \ExplSyntaxOff +\fi \end_preamble \options BCOR7.5mm \use_default_options false diff --git a/lib/examples/ru/Modules/Fancy_Colored_Boxes.lyx b/lib/examples/ru/Modules/Fancy_Colored_Boxes.lyx index f0c0c5255a..cff46c5203 100644 --- a/lib/examples/ru/Modules/Fancy_Colored_Boxes.lyx +++ b/lib/examples/ru/Modules/Fancy_Colored_Boxes.lyx @@ -21,6 +21,27 @@ % Use serif font \addtokomafont{disposition}{\rmfamily} \addtokomafont{descriptionlabel}{\rmfamily} + +\usepackage{iftex} +\iftutex + % convert \cyr... and \CYR... to Unicode + % these are used by varioref + % (https://github.com/latex3/latex2e/issues/2020) + % Workaround taken from + % https://tex.stackexchange.com/a/706098/19291 + \ExplSyntaxOn + \group_begin: + \cs_set:Npn \DeclareUnicodeCharacter #1 #2 + { + \bool_lazy_or:nnT + { \str_if_eq_p:ee { cyr } { \str_range:nnn { #2 } { 2 } { 4 } } }% \cyr... + { \str_if_eq_p:ee { CYR } { \str_range:nnn { #2 } { 2 } { 4 } } }% \CYR... + { \cs_gset:Npe #2 { \char_generate:nn { "#1 } { 11 } } } + } + \file_input:n { t2aenc.dfu } + \group_end: + \ExplSyntaxOff +\fi \end_preamble \options BCOR8mm, most, usenames, dvipsnames \use_default_options false -- lyx-cvs mailing list [email protected] https://lists.lyx.org/mailman/listinfo/lyx-cvs