valentjn / vscode-ltex

LTeX: Grammar/spell checker :mag::heavy_check_mark: for VS Code using LanguageTool with support for LaTeX :mortar_board:, Markdown :pencil:, and others
https://valentjn.github.io/ltex
Mozilla Public License 2.0
807 stars 28 forks source link

Spell-checking sidenotes #583

Open MevenBertrand opened 2 years ago

MevenBertrand commented 2 years ago

Is your feature request related to a problem? Please describe. In my current document I use a lot of footnote-like environment (for the record, it uses the kaobook template, following the style set down by E. Tufte, which is designed to have large margins, making it tempting and easy to put a lot of notes there). With the current LTeX I usually get at least 3 errors when I use a footnote: one reporting the end of a sentence without a period (the part of the sentence before the footnote), one reporting the start of a sentence with a lower case letter (the part of the sentence after the footnote), and one saying that a weird word is not recognized (composed of the last word before and the first on after the note).

Describe the solution you'd like What I’d like is that the sentence inside the footnote is checked, and the one outside the footnote also is as one single sentence. So basically the footnote is treated as with the current ignore value, but its content is also checked, by itself. It could probably become a new value for the environment setting? I think footnotes are a recurring enough feature that it is useful to implement such a feature. It might also make sense for other kinds of environments where we want to check the content independently of the context.

Describe alternatives you've considered As far as I can tell, with the current settings it is not easy to attain the previous goal. I can completely ignore the footnote and its content using the ignore value for environment, but in this case I loose checking for the content of the note.

valentjn commented 2 years ago

Please add an example plus how it's currently checked vs. how you would like it to check.

MevenBertrand commented 2 years ago

Here it is:

\documentclass{article}

\usepackage{sidenotes}

\begin{document}

This is a text%
\sidenote{This is a side-note.}
with a footnote in the middle.

\end{document}

which gives two warnings:

'textThis': Possible spelling mistake found.

and

This sentence does not start with an uppercase letter.

I would expect that this raises no warning.

In crafting my MWE, it seems to me like the case of footnote is treated correctly. Is there special code for it already? If so, giving access to a way to call that for other environments should be enough.

esclear commented 1 year ago

I'd like to see the same functionality in ltex.

It seems to me that headings (parts, sections, paragraphs) are also treated a bit differently from footnotes? At least that's what I gather based on finding this while taking a quick look at the language server part.

It would be great if we could define not only custom (foot|side|margin)notes, but also custom headings.

andrewufrank commented 1 week ago

I have the same problem but using markdown. here an example of the markdown code. The above example is then in two possible formats:

This is some text^[With a footnote.] in the middle. 
Another sentence with ^[note2] a note set in a separate paragraph. 

[^note2]: This is the text of the footnote. 

It is then converted to a footnote or a sidenote, depending on the conversion settings. The second format gives less problems with ltex but is less convenient to write.

Thank you for adjusting the markdown parser!