antonWetzel / typst-languagetool

LanguageTool Integration for Typst for spell and grammer check
MIT License
33 stars 9 forks source link

Unpaired quote error caused by prepending `〜` (or letters) to the left quote #14

Closed Andrew15-5 closed 5 months ago

Andrew15-5 commented 5 months ago
〜""
Diagnostics:
1. Unpaired symbol: '"' seems to be missing [EN_UNPAIRED_QUOTES]

image

image

I use it as a workaround as set par(first-line-indent: indent) doesn't work for the first paragraph:

#show "〜": h(1.25cm)

I think it's the first time I'm quoting something at the beginning of the first paragraph (whole paragraph), so such usage is pretty rare. But I still would appreciate, if this can be fixed somehow.

antonWetzel commented 5 months ago

〜"..." is passed to languagetool verbatim, which produces this error. I think this is more a languagetool problem than a conversion problem.

I don't like changing code to appease the tools, but ~ "..." with a space produces the same pdf without the error.

Other

Does know what mono in monospace means?


|123|
|~~~|
|〜〜〜|
Andrew15-5 commented 5 months ago

I don't like changing code to appease the tools, but ~ "..." with a space produces the same pdf without the error.

Well, at least typstfmt doesn't remove that space, so that's nice.

Does know what mono in monospace means?

|123|
|~~~|
|〜〜〜|

I don't get it (sounds like it's a joke). It's a wide char from Japanese. Since I have Japanese OS layout and that symbol isn't used outside of Japanese (in English and others), I use it as a minimalistic workaround for indent. It prints on 2 columns in terminal. It doesn't have to bet 1-column wide. All Japanese (maybe all CJK) chars are that wide.

antonWetzel commented 5 months ago

The char is circa 1.2 chars wide for me, it never aligns in monospace. image

Andrew15-5 commented 5 months ago

I don't like that the error is saying that the quote is not paired, which is false. Can you check/see if a quote is paired? I'm just thinking that maybe adding an implicit whitespace before "left paired quote" or any "left quote" would be a good fix. Because normally you would always have a whitespace or ( or something before left quote.

Andrew15-5 commented 5 months ago

The char is circa 1.2 chars wide for me, it never aligns in monospace.

Interesting. I would've never known. I normally only work in terminal, so for me, it always has a perfect width of 2:

image

image

Maybe it's GitHub's way of typesetting such chars, or the whole Unicode CJK char set is rigged, I don't know.

antonWetzel commented 5 months ago
image image

Typst uses " without a previous space not as a quotation mark, but as part of the word (like 18" Monitor). Only the show rule changes the from a word to a space and change the meaning. Without compiling the document respecting show rules is not feasible.

Languagetool handles A"Test" with a double missing quotation mark error, which I think is wrong. I only want to convert Typst to Languagetool input, so I don't want to create a workaround for this.

Andrew15-5 commented 5 months ago

Understandable.