I am using LyX 2.0.5.1 and the spell checker here does not seem to have a well developed dictionary – a lot of words that are marked as wrong are actual words. Is there a way to install another spellchecker to work with LyX? I saw the documentation online but it does not provide step by step directions. Could someone do this? I am on Windows machine.
[Tex/LaTex] better spellchecker for lyx
lyxspelling
Related Solutions
You can do it manually by using syn match
. For example, your problem with \somevariable
can be solved with
syn match texSomevariable "\\somevariable{[^}]\{-}}"hs=s+14,he=e-1 containedin=texStatement contains=@NoSpell
This will disable spellcheking in between {
and }
after \somevariable
. (It assumes that you do not use }
inside the argument.)
Depending on how complicated the part of your document in which you do not want the spell checker on, it might get quite complicated to do something similar. Your example with Tikz seems to be dificult, but the solution above should work with somevariable
changed to anything else.
EDIT: If you would like to have {
and }
highlighted as well, as per default, then you should include texDelimiter
in contains
, so that it becomes contains=@NoSpell,texDelimiter
instead of contains=@NoSpell
EDIT: There can be problems if \somevariable
matches something special, like \cite
. Since \cite
is highlighted with texRefZone
, this should be added to containedin
, so the command should be:
syn match texSomevariable "\\cite{[^}]\{-}}"hs=s+6,he=e-1 containedin=texStatement,texRefZone contains=@NoSpell
Thanks Scott! Your answer about changing the Hunspell path in Tools > Preferences > Paths worked for me. I pointed the path to
"C:\Program Files (x86)\MiKTeX 2.9\hunspell\dicts"
Lastly, had to restart Lyx and the spell checking started working.
I tried pointing it to the dict files in the Lyx resources directory ("C:\Program Files (x86)\LyX 2.1\Resources\dicts"
), but that didn't work. Mine was a clean install of Lyx 2.1.4 on Windows 10.
Scott, since you're working in the Lyx project, I think you should have them set the default Hunspell path on the Windows install to the correct one, instead of leaving it blank. I just clean installed it a few days ago, so I don't think I touched any of the settings to affect this.
Also note that at least for me, the dict files in the MikTex directory were a few years old, as opposed to the ones in the Lyx resources directory which were much newer.
(Sorry I'm replying this as an answer, but I just joined and I don't have enough reputation to comment.)
Best Answer
The support for "aspell" in LyX has been dropped. For Windows, the latest binaries of aspell are dated from Dec 2002, see here or GNU Aspell on Wikipedia. (And "ispell" is even a predecessor of "aspell".) More and more programs are switching to "hunspell". Of course, this does not say using "hunspell" is the best choice in every case.
There is another way to look at it. Often one can choose among different dictionaries in "hunspell" for the same language... There is the often cited repository of OpenOffice (and others may exist). One can download a dictionary, extract the
.dic
,.aff
andREADME-
files from the zip file and store them in the directory used by the operating system for hunspell dictionaries. If the filename of the.dic
and.aff
files do not have a pattern likexx_XX.xxx
orxx.xxx
, one needs to rename them. For example, "en-US.aff" should become "en_US.aff" or just "en.aff". (This information can be found here.)Update:
For installing a Hunspell dictionary for a language and using it in LyX, one can follow these instructions (I think of particular importance is to set the path "Tools > Preferences > Paths > Hunspell" correctly. Since warnings (or errors) about the spellchecker are not shown as pop-up messages in the LyX frontend it can help to run LyX from the command prompt/shell with
lyx -dbg files
.There are two ways to increase a spell check dictionary.
By adding words to a personal word list in the spellchecker in LyX (or directly to the file of the personal word list;
While spell checking (F7) there is the "Add" button to add unknown words to the personal word list. Then they will be know in the future. If the document language is set to "English", the words will be added to the file
pwl_english.dict
in the home directory of LyX. Search for this file and you can also edit this file with a text editor and add more words manually (just one word per line).If you want to removing a words from it, you can do this also in LyX. Right click on a word that should be remove and select "Remove from personal dictionary".
By replacing an installed Hunspell dictionary by a dictionary created by yourself;
It seems possible to take two or more dictionaries and merge them into one new dictionary (possibly, ".aff" files have to be merged, too). Then this new dictionary can replace the old one. Since this is only related to Hunspell, questions about this might be better asked on a different SE site. Here is at least a link with some background information about how dictionaries in Hunspell to get started.