Skip to content
This repository has been archived by the owner on Aug 6, 2021. It is now read-only.

Ignoring arguments in LaTeX commands #3

Closed
andrewfowlie opened this issue Nov 13, 2015 · 3 comments
Closed

Ignoring arguments in LaTeX commands #3

andrewfowlie opened this issue Nov 13, 2015 · 3 comments

Comments

@andrewfowlie
Copy link

I noticed overleaf/overleaf#76, which suggests that the spell checker should ignore arguments to common LaTeX commands, e.g.

\cite{DontCheckMe}
\label{DontCheckMe}
\ref{DontCheckMe}

Does the spell-checker just use aspell through a pipe? From the command line, aspell can ignore specified LaTeX commands, e.g. to ignore the arguments of the above commands,

aspell \
--mode=tex \
--master=en_GB-ise \
--add-tex-command='cite p' \
--add-tex-command='ref p' \
--add-tex-command='label p' \
check MY_FILE.tex

For details about the syntax, see 4.4.1.5 here. This is a very simple way of achieving the desired result.

Can you set-up something similar in the aspell pipe in spelling-sharelatex?

@andrewfowlie
Copy link
Author

Browsing the code, couldn't it be quite simply added here:

@pipe = child_process.spawn("aspell", ["pipe", "-t", "--encoding=utf-8", "-d", language])

Perhaps this could be changed to something like (though tidier):

# TeX commands to ignore
tex_commands  = ["cite p", "ref p", "label p"] 

# Make proper aspell arguments
aspell_commands = ["--add-tex-command=" + "'" + command + "'" for command in tex_commands]
joined_apsell_commands = " ".join(aspell_commands) 
# joined_apsell_commands
# "--add-tex-command='cite p' --add-tex-command='ref p' --add-tex-command='label p'"

# Add them to the aspell call in the spell-checker
@pipe = child_process.spawn("aspell", ["pipe", "-t", "--encoding=utf-8", joined_apsell_commands, "-d", language])

You can add in lots of tex_commands to ignore or load that list from a file etc. There's also a --dont-tex-check-comments argument that could be useful too.

@Philipp91
Copy link

Philipp91 commented Mar 20, 2017

Without this, the spell-checker is too annoying to actually turn on, and hence useless. So +1.

Seems like a solution was implemented here https://github.com/sharelatex/web-sharelatex/blob/07c6346f2a59d4823850cfd3ac18b4d0472835e4/public/js/ace/mode-tex.js#L23 but that's probably unrelated code today.

@das7pad
Copy link
Member

das7pad commented Aug 6, 2021

Hi!

Thank you for taking the time to write up this issue.

We are in the process of migrating to a monorepo at https://github.com/overleaf/overleaf and will mark this repository read-only soon.
You can read more about the monorepo migration at overleaf/overleaf#923.

We are going to close this issue now to avoid any confusion about the inability to comment further.

If you believe this issue still needs addressing, please create a new issue at https://github.com/overleaf/overleaf.

Thanks again!

@das7pad das7pad closed this as completed Aug 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants