siefkenj / unified-latex

Utilities for parsing and manipulating LaTeX ASTs with the Unified.js framework
MIT License
91 stars 24 forks source link

LaTex format to invalid style #107

Closed tc1989tc closed 3 months ago

tc1989tc commented 3 months ago

As I've shared below, the latex format is not correct.

图片

Latex code

\author[1]{Kai \snm{Zhao}\corref{cor1}}
\author[1]{Haoxin \snm{Zheng}\fnref{fn1}}
\author[1]{Alex Ling-Yu \snm{Hung}}
\author[1]{Ran \snm{Yan}\fnref{fn1}}
\author[1]{Steven S \snm{Raman}}
\author[1]{Holden \snm{Wu}}
\author[1]{KyungHyun \snm{Sung}}

after formated, it display as(this not correct):

\author{[}
1]{Kai \snm{Zhao}\corref{cor1}}
\author{[}
1]{Haoxin \snm{Zheng}\fnref{fn1}}
\author{[}
1]{Alex Ling-Yu \snm{Hung}}
\author{[}
1]{Ran \snm{Yan}\fnref{fn1}}
\author{[}
1]{Steven S \snm{Raman}}
\author{[}
1]{Holden \snm{Wu}}
\author{[}
1]{KyungHyun \snm{Sung}}
siefkenj commented 3 months ago

What package are you using \author from? It appears that the default \author defined by LaTeX only takes one argument.

batchor commented 3 months ago

What package are you using \author from? It appears that the default \author defined by LaTeX only takes one argument.

It's the \author command from the elsarticle document class.

siefkenj commented 3 months ago

I see. I will add a elsarticle to unified-latex-ctan/package when I am able. (Or, if you wanted to try, a PR is welcome :-). You can look at multicol for a simple example.

tc1989tc commented 3 months ago

I see. I will add a elsarticle to unified-latex-ctan/package when I am able. (Or, if you wanted to try, a PR is welcome :-). You can look at multicol for a simple example.

@siefkenj The amsart has included the \author source code link , why parse still as one argument?

siefkenj commented 3 months ago

Yes, but the amsart version of \author accepts only one argument, which is why we need to define another.

tc1989tc commented 3 months ago

Yes, but the amsart version of \author accepts only one argument, which is why we need to define another.

The amsart define \author as signature: "o m", this means an option argument and a mandatory argument. Shouldn't it be receiving two parameters? @siefkenj

siefkenj commented 3 months ago

Oh, I see. The change has already been made!

Yes, it should receive an optional argument. Are you using the git version or the release version? That change might not be released yet.

tc1989tc commented 3 months ago

Oh, I see. The change has already been made!

Yes, it should receive an optional argument. Are you using the git version or the release version? That change might not be released yet.

I use npm release version

tc1989tc commented 3 months ago

Yes, but the amsart version of \author accepts only one argument, which is why we need to define another.

The amsart define \author as signature: "o m", this means an option argument and a mandatory argument. Shouldn't it be receiving two parameters? @siefkenj

@siefkenj The npm latest version did not include the change. Please release the new version to include the commits, thanks!

siefkenj commented 3 months ago

I just published v1.8.0. Please try it and see if the issue is resolved.

tc1989tc commented 3 months ago

I tested on v1.8.0, it fixes the issue. thanks!