latexer
latexer copied to clipboard
Creating too many ends of environments (when activating autocomplete environments)
Hi there, I would like to use the latexer for easier typing of TeX. However there seems to be a bug with Atom 1.18.0 and latexer 0.3.0.
When I begin an unnumbered math equation environment
\[ and type enter I would expect and autocompletion like
\[
\]
But I get the following
\[
\]
\]
\]
\]
\]
\]
\]
\]
\]
which is quite annoying, since it also happens, when you have the scenario from the first block code (so an existing empty or even nonempty math environment) and place the cursor at the equation line within at the second character (where you would end up after pressing enter).
edit: The error dissappears when disabling autocomplete environments but of course then environments are not autocompleted ;)
Hmm, yes that is quite annoying. Unfortunately I can't seem to replicate it. Could you possibly try the github version? Or wait until end of week for 0.3.1 and try it with that?
I can confirm the bug. I have a feeling that the occurrence of too many ]-s is more likely within another environment. For example I had this trouble when I needed to write display formulae within a block environment in beamer.
Could you possibly provide a small reproducible example?
Sure. I stripped my file down to the following one-slide example:
(sorry I had to rename it to .txt since GitHub does not like uploading .tex files).
To reproduce the error do the following:
- Open the file in Atom (with latexer enabled) as a .tex-file.
- Find the display math formula in the itemize environment, place your cursor in the end of the formula and hit spacebar.
- You will see erroneous [ and ] added in weird places.
What seems to be interesting is that when I delete the preceding block environment, the bug disappears. So probably its logic of traversing the environments after and through each other leaves the state machine in an incorrect state.
And you get extra 5 point credit for figuring out what language the example slide is written in :)
Best, Jan
Thanks for providing the example, I even forgot about the bug for a while (since I switched back to my old editor). Yes, that replicates the bug and occurs often in beamer slides. It also happens therein with the equation environment, but in a slightly different setting, i'll try to also boil that down to a minimal example and report back.