要求 aspell 跳过部分文档
Ask aspell to skip part of document
我正在使用 aspell 对 Linux 上的 LaTeX 文档进行拼写检查。我的文档经常包含各种编程语言的代码示例,我希望 aspell 在拼写检查时跳过这些行。
我可以在我的文档中写些什么来关闭一段文本的 aspell 吗?类似于:
This line should be spell checked.
% Hey, aspell, don't check the following lines
\begin{lstlisting}
if (xyzzy > foobar) {
doSomethingSilly();
}
\end{lstlisting}
% Hey, aspell, please check the following
This line should be spell checked.
aspell 跳过部分文档
拼写检查 LaTeX 文档
LaTeX 文档需要多做一些工作。
命令
aspell --lang=en_GB --add-tex-command="mySkip op" -c teste.tex
- 在开始
\mySkip[
之后再 { 放一个 \mySkip[
teste.tex
\documentclass{article}
\makeatletter
\def\myComment{\@ifnextchar[{\@with}{\@without}}
\def\@with[#1]#2{Hello #1, have you met #2?}
\def\@without#1{Goodbye #1.}
\makeatother
\mySkip[
if (xyzzy > foobar) {
\mySkip[
doSomethingSilly();
doSomethingOther();
doSomethingExtra();
}
]]
This liine should be spell checked.
在您需要的代码 \mySkip[
中的每个左大括号 { 之后出现问题
\mySkip[
if (abcdef > foobar) {
\mySkip[
doSomethingSilly();
if (test > 100) {
\mySkip[
doSomethingOther();
}
doSomethingExtra();
}
]]
This liine should be spell checked.
通过搜索和替换,您可以准备好代码
替换前
替换后
sgml
更容易。
循序渐进
- 创建一个文件夹
aspell60-7
- 复制teste.html到.
teste.html
This line should be spell checked.
<nospell>
if (xyzzy > foobar) {
doSomethingSilly();
}
</nospell>
<script>
if (xyzzy > foobar) {
doSomethingSilly();
}
</script>
This line should be spell checked.
- 更改
teste.html
中的一个字母
- cd 进入文件夹
aspell60-7
- 输入以下命令
aspell --lang=en_GB --add-filter=sgml --add-sgml-skip=nospell --add-sgml-skip=script -c -S teste.html
在 运行 命令之后
- 在为
1) line
输入 1 之后。
aspell
终止。
Gedit 告诉文件 teste.html
已更改。
在new load
之后
- 之前修改的词
liine
是正确的。
- 所有被
<nospell>
和 <script>
包围的行都被忽略。
这也适用于 windows,但仅适用于 aspell6
。
我正在使用 aspell 对 Linux 上的 LaTeX 文档进行拼写检查。我的文档经常包含各种编程语言的代码示例,我希望 aspell 在拼写检查时跳过这些行。
我可以在我的文档中写些什么来关闭一段文本的 aspell 吗?类似于:
This line should be spell checked.
% Hey, aspell, don't check the following lines
\begin{lstlisting}
if (xyzzy > foobar) {
doSomethingSilly();
}
\end{lstlisting}
% Hey, aspell, please check the following
This line should be spell checked.
aspell 跳过部分文档
拼写检查 LaTeX 文档
LaTeX 文档需要多做一些工作。
命令
aspell --lang=en_GB --add-tex-command="mySkip op" -c teste.tex
- 在开始
\mySkip[
之后再 { 放一个\mySkip[
teste.tex
\documentclass{article}
\makeatletter
\def\myComment{\@ifnextchar[{\@with}{\@without}}
\def\@with[#1]#2{Hello #1, have you met #2?}
\def\@without#1{Goodbye #1.}
\makeatother
\mySkip[
if (xyzzy > foobar) {
\mySkip[
doSomethingSilly();
doSomethingOther();
doSomethingExtra();
}
]]
This liine should be spell checked.
在您需要的代码 \mySkip[
\mySkip[
if (abcdef > foobar) {
\mySkip[
doSomethingSilly();
if (test > 100) {
\mySkip[
doSomethingOther();
}
doSomethingExtra();
}
]]
This liine should be spell checked.
通过搜索和替换,您可以准备好代码
替换前
替换后
sgml
更容易。
循序渐进
- 创建一个文件夹
aspell60-7
- 复制teste.html到.
teste.html
This line should be spell checked.
<nospell>
if (xyzzy > foobar) {
doSomethingSilly();
}
</nospell>
<script>
if (xyzzy > foobar) {
doSomethingSilly();
}
</script>
This line should be spell checked.
- 更改
teste.html
中的一个字母
- cd 进入文件夹
aspell60-7
- 输入以下命令
aspell --lang=en_GB --add-filter=sgml --add-sgml-skip=nospell --add-sgml-skip=script -c -S teste.html
在 运行 命令之后
- 在为
1) line
输入 1 之后。 aspell
终止。Gedit 告诉文件
teste.html
已更改。在
new load
之后
- 之前修改的词
liine
是正确的。 - 所有被
<nospell>
和<script>
包围的行都被忽略。
这也适用于 windows,但仅适用于 aspell6
。