Skip to content

TIL: You can use hunspell (provided with Firefox, LibreOffice, ...) to spellcheck your text files very easily!

I was looking for a way of spellchecking my huge 30-page mémoire written entirely under LaTeX, and up to now had no better solution than copy-pasting into LibreOffice. It turns out the following command:

hunspell -t mémoire.tex

will bring up a cool interface which will cycle through all unknown words in your file! Type ? to get help the first time you invoke it, it won't change your file until the end.

The most awesome thing is the -t switch tells it it's LaTeX so it doesn't try to correct math formulas or commands, it was extremely clever on my mémoire -- for example it corrected text within math formulas (in textrm) but not the maths itself.

It has a man page if you need other languages too, or other file formats.

209 points26 comments
Open on Reddit
About this post
Posted
Archived
Score
209 · 100% up
Kind
Text
ID
bse6vr

Author

30
posts
118
comments
11
media
View profile

26 comments

If you like a GUI for that, you can use geany:

https://plugins.geany.org/spellcheck.html

21 points

Or a tui, vim has :se spell which highlights them in the editor and then z= with the cursor over the misspelled word brings up spelling suggestions.

20 points

Just a tip, I made a remap nnoremap <keycombo> z=1 in order to just get the first correction auto inputted since usually it’s what I want

2 points

I had some issues with hunspell and compound words (? Can’t remember the term- things ending with “‘ve” for example, like “they’ve”- “ve” is treated as a separate word and therefore marked incorrect. Something like that.). Apparently it’s a known issue and the versions/dictionaries used in Libreoffice and friends are patched to handle it.

Ended up going with aspell for my needs- emacs spell checking- with additional dictionaries. My testing on command line looked similar, though I haven’t looked into OP’s use case as much so I’m not 100% if the interface is the same.

So long story short, that’s another option if you find you have issues with hunspell or wanted to try something different.

2 points

I think it's called a contraction. Are you sure it wasn't about whether the apostrophe is the Unicode curved apostrophe or simply a vertical apostrophe? There's a setting to change that, maybe that was it?

At least I know I use compound words and have no trouble.

2 points

Ah yes thank you.

Yep, I can’t quite recall exactly what the issue was- purged it from memory once I figured out a solution. I believe you can add the regular vertical apostrophe to a list of allowed or ignored characters or whatnot, which is what the patched dictionaries do in addition to some other changes. Main thing I wanted was something that I could install on other systems without having to worry about dealing with that bit manually.

If you would like I could go take a look and refresh my memory. There’s a couple github issues open about it.

3 points

English only or all languages?

1 points
unknown author

Deleted before we saved it.

13 points
unknown author

Deleted before we saved it.

0 points
unknown author

Thanks for sharing, I learned a lot of several and different answers.

1 points

It look like you're French ;) I advise you to use antidote for both French and English text, AFAIK it's the best language corrector, really powerful and can now be used with latex code

-3 points

Only 120€ for a proprietary software? What a steal!

3 points

You can find many not legal (torrent etc...) versions of it... even portable versions.

Still after using it many times, I think for a daily use, it worth the 120€.

​

I think it's the only software which have so many options, precision and can tell me that I missed a "s" somewhere and telling me it's because this word is the subject of the complement of another way before.

​

Plus, it gives you repetitions, strong/weak verbs or nouns, and better ways to formulate your sentences and more.

-1 points

I don't know about antidote but for French there's Grammalecte which is FOSS, has plugins for LibreOffice, Firefox, vim as well as a CLI interface and is really really powerful.

2 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.