Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions manual/aspell.1
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ encoding the document is expected to be in. The default depends on the
current locale.
.TP
\fB\-\-add-email\-quote=\fR\fI<list>\fR, \fB\-\-rem-email\-quote=\fR\fI<list>\fR
Add or Remove a list of email quote characters.
Add or remove a list of email quote characters.
.TP
\fB\-\-email\-margin=\fR\fI<integer>\fR
Number of chars that can appear before the quote char.
Expand All @@ -191,14 +191,14 @@ Add or remove a list of HTML attributes to always check. For example,
look inside alt= tags.
.TP
\fB\-\-add\-html\-skip=\fR\fI<list>\fR, \fB\-\-rem\-html\-skip=\fR\fI<list>\fR
Add or remove a list of HTML attributes to always skip while spell
Add or remove a list of HTML tags to always skip while spell
checking.
.TP
\fB\-\-add\-sgml\-check=\fR\fI<list>\fR, \fB\-\-rem\-sgml\-check=\fR\fI<list>\fR
Add or remove a list of SGML attributes to always check for spelling.
.TP
\fB\-\-add\-sgml\-skip=\fR\fI<list>\fR, \fB\-\-rem\-sgml\-skip=\fR\fI<list>\fR
Add or remove a list of SGML attributes to always skip while spell
Add or remove a list of SGML tags to always skip while spell
checking.
.TP
\fB\-\-sgml\-extension=\fR\fI<list>\fR
Expand All @@ -208,7 +208,22 @@ SGML file extensions.
Check TeX comments.
.TP
\fB\-\-add\-tex\-command=\fR\fI<list>\fR, \fB\-\-rem\-tex\-command=\fR\fI<list>\fR
Add or Remove a list of TeX commands.
Add or remove a list of TeX commands.
.TP
\fB\-\-add\-tex\-ignore\-env=\fR\fI<list>\fR, \fB\-\-rem\-tex\-ignore\-env=\fR\fI<list>\fR
Add or remove a list of LaTeX environments to skip while spell checking.
.TP
\fB\-\-add\-texinfo\-ignore=\fR\fI<list>\fR, \fB\-\-rem\-texinfo\-ignore=\fR\fI<list>\fR
Add or remove a list of Texinfo commands.
.TP
\fB\-\-add\-texinfo\-ignore\-env=\fR\fI<list>\fR, \fB\-\-rem\-texinfo\-ignore\-env=\fR\fI<list>\fR
Add or remove a list of Texinfo environments to ignore.
.TP
\fB\-\-context\-visible\-first, \fB\-\-dont\-context\-visible\-first
Switch the context which should be visible to Aspell.
.TP
\fB\-\-add\-context\-delimiters=\fR\fI<list>\fR, \fB\-\-rem\-context\-delimiters=\fR\fI<list>\fR
Add or remove pairs of delimiters.
.SH RUN\-TOGETHER WORD OPTIONS
These may be used to control the behavior of run\-together words.
.TP
Expand Down
74 changes: 72 additions & 2 deletions manual/aspell.texi
Original file line number Diff line number Diff line change
Expand Up @@ -1065,6 +1065,10 @@ being readable text in LaTeX output from Aspell.
@i{(list)}
@TeX{} commands

@item tex-ignore-env
@i{(list)}
@TeX{} environments to always skip over

@item tex-check-comments
@i{(boolean)}
check @TeX{} comments
Expand Down Expand Up @@ -1363,13 +1367,15 @@ all their parameters and/or options checked. The format for each item
is

@example
<command> <a list of p,P,o and Os>
<command> <a list of 'p', 'P', 'o', 'O' and 'T's>
@end example

The first item is simply the command name. The second item controls
which parameters to skip over. A 'p' skips over a parameter while a
'P' doesn't. Similarly an 'o' will skip over an optional parameter
while an 'O' doesn't. The first letter on the list will apply to the
while an 'O' doesn't. A 'T' will force spell-checking of a parameter
even if the command occurs within a parameter or an environment Aspell
is told to skipped over. The first letter on the list will apply to the
first parameter, the second letter will apply to the second parameter
etc. If there are more parameters than letters Aspell will simply
check them as normal. For example the option
Expand All @@ -1392,6 +1398,25 @@ over the next optional parameter, if it is present, and will skip over
the second parameter --- even if the optional parameter is not present
--- and will check any additional parameters.

@example
add-tex-command foo T
@end example

@noindent
will @emph{check} the first parameter of the @code{foo} command even
if Aspell is currently skipping over an argument or environment. For
example, if Aspell has been told to skip over the @code{bar}
environment (@pxref{Ignoring LaTeX Environments}), then in the text

@example
\begin@{bar@} don't check \foo@{check@} don't check \end@{bar@}
@end example

@noindent
it will nevertheless @emph{check} the argument to @code{foo}. This is
useful to force checking of arguments to text-related commands like
@code{hbox}, @code{text} or @code{intertext} inside math environments.

A @samp{*} at the end of the command is simply ignored. For example
the option

Expand All @@ -1414,6 +1439,50 @@ rem-tex-command foo
will remove the command foo, if present, from the list of @TeX{}
commands.

@anchor{Ignoring LaTeX Environments}
The option
@option{add|rem-tex-ignore-env}
controls which @TeX{} environments are skipped over. By default,
Aspell will skip over math formulas inside @code{$...$}, @code{$$...$$}
and @code{\[...\]} and over several common LaTeX and AMS-LaTeX math
environments like @code{equation} and @code{gather}. For example,

@example
add-tex-ignore-env thebibliography
@end example

@noindent
will tell Aspell to skip over the bibliography as well (which may or
may not be a good idea). As with commands, skipping applies to the
starred form of the environment as well.

@example
rem-tex-ignore-env equation
@end example

@noindent
will make Aspell spell-check the contents of @code{equation} and
@code{equation*} environments. Skipping the contents of @code{$...$},
@code{$$...$$} and @code{\[...\]} cannot be turned off.

Note that one can force spell-checking of arguments to TeX commands
inside ignored environments with the 'T' parameter to the
@option{add-tex-command} option.

As a last resort, spell checking can be switched off by putting the
text @code{aspell:off} into the file. Similarly, with @code{aspell:on}
one can turn it on again. This can be useful for macro definitions,
for example

@example
% aspell:off
\def\doi#1@{\href@{http://dx.doi.org/#1@}@{doi:#1@}@}
% aspell:on
@end example

@noindent
This feature is implemented via the @ref{Context Filter}.

The TeX filter mode is also available via @option{latex} alias name.

@c The TeXfilter mode also contains a decoding and a encoding filter for
Expand Down Expand Up @@ -1514,6 +1583,7 @@ escapes
(@code{\(}) and extended (@code{\[comp1 comp2 @dots{}]}) form.
@end itemize

@anchor{Context Filter}
@subsubsection Context Filter

The @emph{context} filter allows Aspell to distinguish between visible
Expand Down
1 change: 1 addition & 0 deletions modules/filter/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ namespace {

PosibErr<bool> ContextFilter::setup(Config * config){
name_ = "context-filter";
order_num_ = 0.15;
StringList delimiters;
StringEnumeration * delimiterpairs;
const char * delimiterpair=NULL;
Expand Down
5 changes: 4 additions & 1 deletion modules/filter/modes/tex.amf
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@ MAGIC /0:256:^[ \t]*\\documentclass\[[^\[\]]*\]\{[^\{\}]*\}/tex

DESCRIPTION mode for checking TeX/LaTeX documents

FILTER url
FILTER context
OPTION clear-context-delimiters
OPTION add-context-delimiters aspell:off aspell:on
OPTION enable-context-visible-first
FILTER tex
56 changes: 48 additions & 8 deletions modules/filter/tex-filter.info
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,35 @@ DESCRIPTION check TeX comments
DEFAULT false
ENDOPTION

OPTION ignore-env
TYPE list
DESCRIPTION LaTeX environments to be ignored
# LaTeX
#DEFAULT thebibliography
DEFAULT equation
DEFAULT eqnarray
# AMS-LaTeX
DEFAULT gather
DEFAULT multline
DEFAULT align
DEFAULT flalign
DEFAULT alignat
# Babel
DEFAULT otherlanguage
ENDOPTION

OPTION command
TYPE list
DESCRIPTION TeX commands
# plain TeX / LaTeX
DEFAULT addtocounter pp
DEFAULT addtolength pp
DEFAULT alpha p
DEFAULT alph p
DEFAULT Alph p
DEFAULT arabic p
DEFAULT fnsymbol p
DEFAULT roman p
DEFAULT Roman p
DEFAULT stepcounter p
DEFAULT setcounter pp
DEFAULT usecounter p
Expand All @@ -42,7 +62,8 @@ DEFAULT newtheorem poPo
DEFAULT newfont pp
DEFAULT documentclass op
DEFAULT usepackage op
DEFAULT begin po
# Do NOT change the next line!
DEFAULT begin so
DEFAULT end p
DEFAULT setlength pp
DEFAULT addtolength pp
Expand All @@ -54,15 +75,17 @@ DEFAULT hyphenation p
DEFAULT pagenumbering p
DEFAULT pagestyle p
DEFAULT addvspace p
DEFAULT framebox ooP
DEFAULT framebox ooT
DEFAULT hspace p
DEFAULT vspace p
DEFAULT makebox ooP
DEFAULT parbox ooopP
DEFAULT raisebox pooP
DEFAULT hbox T
DEFAULT vbox T
DEFAULT makebox ooT
DEFAULT parbox ooopT
DEFAULT raisebox pooT
DEFAULT rule opp
DEFAULT sbox pO
DEFAULT savebox pooP
DEFAULT savebox pooT
DEFAULT usebox p
DEFAULT include p
DEFAULT includeonly p
Expand All @@ -76,13 +99,30 @@ DEFAULT fontshape p
DEFAULT fontsize pp
DEFAULT usefont pppp
DEFAULT documentstyle op
DEFAULT cite p
DEFAULT cite Op
DEFAULT nocite p
DEFAULT psfig p
DEFAULT selectlanguage p
DEFAULT includegraphics op
DEFAULT bibitem op
DEFAULT bibliography p
DEFAULT bibliographystyle p
DEFAULT geometry p
# AMS-LaTeX
DEFAULT address p
DEFAULT email p
DEFAULT mathbb p
DEFAULT mathfrak p
DEFAULT eqref p
DEFAULT text T
DEFAULT intertext T
DEFAULT DeclareMathOperator pp
DEFAULT DeclareMathAlphabet ppppp
# hyperref
DEFAULT href pP
DEFAULT autoref p
DEFAULT url p
DEFAULT texorpdfstring Pp
ENDOPTION

#OPTION multi-byte
Expand Down
Loading