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

IEEEeqnarray not recognized as math environment #2675

Closed
ThomasChaffey opened this issue Mar 23, 2023 · 11 comments
Closed

IEEEeqnarray not recognized as math environment #2675

ThomasChaffey opened this issue Mar 23, 2023 · 11 comments

Comments

@ThomasChaffey
Copy link

IEEEeqnarray is not being recongnized as a math environment by vimtex.

Previously, I manually added IEEEeqnarray as a math environment. Originally, this was done by placing the command call TexNewMathZone("M", "IEEEeqnarray", 1) in a file in ~/.vim/after/syntax/tex/. After some updates, the method changed to call vimtex#syntax#core#new_region_math('IEEEeqnarray') in .vimrc. This is no longer working.

I see that support for IEEEtrantools should now be standard, as per this feature request: #1796. I've updated to the latest versions of vim and vimtex for OS X, but still have the problem.

@lervag
Copy link
Owner

lervag commented Mar 23, 2023

IEEEeqnarray is defined by the package ieeetrantools and should be recognized by default without any additional customizations. Can you provide a minimal example where this does not work as expected for you?

@ThomasChaffey
Copy link
Author

ThomasChaffey commented Mar 24, 2023

Hi Lervag,

Thanks for the quick response, and apologies for the vagueness of my issue yesterday. I've made it more precise now. A minimum non-working example is:

\documentclass{ieeeconf}
\begin{document}
\begin{IEEEeqnarray*}{rCl}
\int_{-\infty}^\infty u(t)^2 dt < \infty.
\end{IEEEeqnarray*}
\end{document}

A minimum fix is:

\documentclass{article}
\usepackage{IEEEtrantools}
\begin{document}
\begin{IEEEeqnarray*}{rCl}
\int_{-\infty}^\infty u(t)^2 u(t) dt < \infty.
\end{IEEEeqnarray*}
\end{document}

Adding usepackage{IEEEtrantools} only fixes the issue if the document is reloaded.

IEEEtrantools is already provided by the class ieeeconf, and I get an error if I load the package. Unfortunately I have to use that class for the conference I'm submitting to.

@lervag
Copy link
Owner

lervag commented Mar 24, 2023

Thanks for the quick response, and apologies for the vagueness of my issue yesterday.

No problem!

I've made it more precise now. A minimum non-working example is:

\documentclass{ieeeconf}
\begin{document}
\begin{IEEEeqnarray*}{rCl}
\int_{-\infty}^\infty u(t)^2 dt < \infty.
\end{IEEEeqnarray*}
\end{document}

I think it should work as expected after you've compiled this document. Can you check that?

The problem here is that the syntax rules are applied only when VimTeX recognizes the package. If there is no \usepackage that explicitly loads a package, then VimTeX does not immediately know it is there. When you compile the document, the compiler creates a .fls file that VimTeX uses to figure out which packages are used, thus things (should) work after you compile.

If I'm right: I may consider to make an update where ieeeconf automatically loads the package.

@ThomasChaffey
Copy link
Author

ThomasChaffey commented Mar 24, 2023

I think it should work as expected after you've compiled this document. Can you check that?

I'm afraid it doesn't work: I tried compiling both from vimtex and using pdflatex in the terminal, no luck...

If I'm right: I may consider to make an update where ieeeconf automatically loads the package.

Which source file(s) would I have to patch to get something like this to work?

Edit: in the meantime, is there a method to manually add IEEEeqnarray as a math environment, similar to my old solution?

@lervag
Copy link
Owner

lervag commented Mar 24, 2023

Edit: in the meantime, is there a method to manually add IEEEeqnarray as a math environment, similar to my old solution?

Yes: You can do this:

let g:vimtex_syntax_packages = {
      \ 'ieeetrantools': {'load': 2},
      \}

@lervag
Copy link
Owner

lervag commented Mar 24, 2023

I'm trying to reproduce. Is this the source of the template you are using?

https://www.ieee.org/conferences/publishing/templates.html

@lervag
Copy link
Owner

lervag commented Mar 24, 2023

@ThomasChaffey
Copy link
Author

I'm using the template provided here by the IEEE Control Systems Society: https://css.paperplaza.net/conferences/support/files/ieeeconf.cls

lervag added a commit that referenced this issue Mar 25, 2023
@lervag
Copy link
Owner

lervag commented Mar 25, 2023

It's interesting to note that this template is not part of common texlive distributions, whereas IEEEtran is. Not sure why.

I believe I've pushed a fix for this now. Please update and test.

@lervag lervag closed this as completed Mar 25, 2023
@ThomasChaffey
Copy link
Author

Wonderful! It's working well now.

This is surely some ancient template that should be abandoned, but I expect it would involve some committee approval or something, so much less work to just keep using the old template!

@lervag
Copy link
Owner

lervag commented Mar 28, 2023

Great, glad to hear it. And yes, I would also not be surprised if this is "old cruft", but adding the support was trivial and doesn't really hurt anything, so I think it was OK to add it.

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

2 participants