Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I know I can use TeXShop or any other word processing program to spell check my document, but I was wondering, if there are any spell checking scripts, which run in a shell/Terminal.

I saw that there is a program called aspell, but it hasn't been updated for a long time. Are there any good programs/scrips out there?

share|improve this question
add comment

3 Answers

The fact that aspell has not been updated for a long time IMHO means that it is good. I use it regularly. You only face a problem of recognizing LaTeX keywords, but after couple documents, you add most of them into your dictionary and then you happily spell-check ;)

share|improve this answer
    
how do you add them to your dictionary permanently? –  Meneldur Apr 15 at 17:07
    
There's a shortcut for that: l if I remember correctly. –  tohecz Apr 15 at 17:39
add comment

While aspell still works well, the new rage seems to be hunspell. It can also check LaTeX files.

share|improve this answer
    
Do you know how to install dictionaries for hunspell? Can' seem to figure it out. Running hunspell -d en_US $FILENAME gives me the error: Can't open affix or dictionary files for dictionary named "en_US" –  cherrung Jan 24 '13 at 13:37
    
@cherrung My dictionaries came with packages like myspell-american etc., since hunspell is based on myspell. I don't know how those packages are called on the Mac (you are on a Mac, right?). –  mafp Jan 24 '13 at 15:46
add comment

aspell

Although aspell has been mentioned, I would like to give some usage examples.

Basic usage

aspell --mode=tex -c sample-file.tex

Languages

List all dictionaries:

aspell dump dicts

Change language to check:

aspell --lang=de --mode=tex -c sample-file.tex

Downsides of aspell

The following is from a German document I've just written. It has 413 lines, so it is rather small.

This should have been recognized as LaTeX, but wasn't:

Before \begin{document}:

  • \sisetup{locale=DE} - "locale"
  • \pgfmathdeclarefunction{strrepeat}{2}{% - "strrepeat"
    • pgfmathint{#2}\pgfmath@count\pgfmathresult and twice later - 3x"count"
    • \let\pgfmathresult\pgfutil@empty - "empty"
    • \pgfutil@loop - "loop"
    • \pgfutil@repeat - "repeat"
  • \pgfmath@smuggleone - "smuggleone"
  • \algtext*{EndIf} - "EndIf", "EndWhile", "EndFunction"
  • \usetikzlibrary{arrows, positioning, calc, shapes} - "arrows", "positioning", "calc", "shapes"
  • \DeclareMathOperator{\ggT}{ggT} - "ggT" (That is valid in a German document about math)

25x words in:

\tikzset{
  Stern Brocot at/.style={at/.pgfmath={
      strcat("([rotate around=180:(!", strrepeat("#1",\SBLevel),")] !",
                                       strrepeat("#1",\SBLevel-1),"2)")}},
  Stern Brocot at*/.style n args={3}{
    at/.pgfmath={strcat("(!",strrepeat("#1",#2),"-| SB@#3)")},
    append after command/.expanded={\ifnum#2<\SBLevel(\noexpand\tikzlastnode)
      edge[densely dotted] (SB@#3@\the\numexpr\SBLLoop+1\relax)\fi}}}

After \begin{document}:

  • Almost everything within TikZ
  • Much in algorithm environment
  • \begin{tabular}{l||ccl} - "ccl"

aspell also has problems with hyphenated words (source)

Workarounds

Create a file called my_def.tex and put your whole preamble in it. Then add \include{my_def} to your preamble. It should be your file in there.

However, this does not solve the TikZ / table issue. But you can apply the same workaround for TikZ images. I guess it is not convenient to do so for tables.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.