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

Improve support for subequations environment #3036

Closed
gssfaw opened this issue Oct 26, 2024 · 3 comments
Closed

Improve support for subequations environment #3036

gssfaw opened this issue Oct 26, 2024 · 3 comments

Comments

@gssfaw
Copy link

gssfaw commented Oct 26, 2024

Is your feature request related to a problem? Please describe it.
I've found that vimtex does not parse labels from the subequations environment of the asmath package if they contain non-Latin characters in them for the omnifunc completions.

Describe the solution you'd like
It would be great if the subequations environment got a better support. This is probably due to the fact that Unicode characters need special handling.

On this screenshot you can see that omnifunc (C-xC-o) does not show the number of the subequation if it contains a Cyrillic character, while the equation with Latin letters works as expected.
20241026_15h28m01s_grim
Here is a minimal .tex file with examples. The first one has Cyrillic letters, the former has Latin characters.

Minimal tex file
%! TeX program = lualatex
\documentclass[12pt]{article} 
\usepackage{polyglossia}
\setdefaultlanguage[babelshorthands=true, forceheadingpunctuation=false]{russian}
\setotherlanguages{english}
\usepackage{fontspec} 
\setmainfont{FreeSerif}
\setsansfont{FreeSans}
\setmonofont{FreeMono}
\usepackage{amsmath}   
\begin{document}
% subequations with cyrillic letters
\begin{subequations}
    \renewcommand{\theequation}{\theparentequation\asbuk{equation}}
    \begin{align}
        test 1 1\label{eq:test_1_1}\\ 
        test 1 2 \label{eq:test_1_2}
    \end{align}
\end{subequations}
% subequations with latin letters
\begin{subequations}
    \begin{align}
        test 2 1\label{eq:test_2_1}\\ 
        test 2 2 \label{eq:test_2_2}
    \end{align}
\end{subequations}

\eqref{eq:test_1_2} % Does not show the number 
\eqref{eq:test_2_2} % Does show the number

\end{document}
`main.aux` has all labels and they seem to look the same way.
main.aux
\relax 
\ProvideDocumentCommand \selectlanguage {sO{}m}{}
\catcode `"\active 
\@writefile{toc}{\selectlanguage *[babelshorthands=true, forceheadingpunctuation=false]{russian}}
\newlabel{eq:test_1_1}{{1а}{1}{}{}{}}
\newlabel{eq:test_1_2}{{1б}{1}{}{}{}}
\newlabel{eq:test_2_1}{{2a}{1}{}{}{}}
\newlabel{eq:test_2_2}{{2b}{1}{}{}{}}
\gdef \@abspage@last{1}
lervag added a commit that referenced this issue Oct 26, 2024
@lervag
Copy link
Owner

lervag commented Oct 26, 2024

There was a regex that explicitly looked for simple lowercase latin characters. I've generalized it in a manner that looks safe and I believe this should resolve your issue.

@lervag lervag closed this as completed Oct 26, 2024
@gssfaw
Copy link
Author

gssfaw commented Oct 27, 2024

It's working now, I really appreciate your help

@lervag
Copy link
Owner

lervag commented Oct 27, 2024

Great; glad to hear it!

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

No branches or pull requests

2 participants