You can use the detex tool to strip LaTeX commands. If you do detex file.tex
, it will output to stdout. Then, you can use the diction tool to analyse your text, and suggest improvements. Putting it all together:
detex file.tex | diction -bs
This will strip the LaTeX, and pipe it into diction with suggestions and "beginner mistakes" enabled.
For Debian/Ubuntu:
sudo apt-get install diction texlive-extra-utils
This will install detex and diction, as well as several other useful tools.
Since you mentioned that you're using Emacs, there is also diction.el which provides diction integration with Emacs. You can do M-x diction-buffer
, and it will take care of detexing/dehtmling and show the diction results in a separate buffer. You can even hit enter on the individual results to be taken to approximately where the phrase is.
(If you do use diction.el, my version of detex didn't have the -C flag. I'm not sure of what it was meant to do, but if you search for 'detex -C' in the file, you can add other command line options if you want. Also, I recommend replacing 'diction -L' with 'diction -bsL')
Vim has built in spell checking. You do not need external spell checkers. Simply use :set spell
to enable spell checking.
To disable spell checking in code listings, you need to modify the vim syntax file for tex.
Copy $VIMRUNTIME/syntax/tex.vim
to $HOME/.vim/syntax/tex.vim
. Around line 402, this file has:
syn region texZone start="\\begin{verbatim}" end="\\end{verbatim}\|%stopzone\>" contains=@Spell
syn region texZone start="\\begin{code}" end="\\end{code}\|%stopzone\>" contains=@Spell
" listings package:
syn region texZone start="\\begin{lstlisting}" end="\\end{lstlisting}\|%stopzone\>" contains=@Spell
" moreverb package:
syn region texZone start="\\begin{verbatimtab}" end="\\end{verbatimtab}\|%stopzone\>" contains=@Spell
syn region texZone start="\\begin{verbatimwrite}" end="\\end{verbatimwrite}\|%stopzone\>" contains=@Spell
syn region texZone start="\\begin{boxedverbatim}" end="\\end{boxedverbatim}\|%stopzone\>" contains=@Spell
Change each of these @Spell
to @NoSpell
and vim will not spell check in the respective environments.
Best Answer
there is an option for that, you just have to add
in your
.vimrc
.About the internals, this variable is used in the file
/usr/share/vim/vim73/syntax/tex.vim
in my installation.[Edit for older versions]
Checking vim source tree in older versions, this variable appears from revision 1073, which is after vim 7.0 and 7.1. As stated by the diff, this modification introduces the lines
so maybe adding
in your
.vimrc
would do the trick, at least it works on vim 7.3. If this does not work, you could try to get a more recent syntax file and put it into.vim/syntax/tex.vim