Re: How to create and use an additional word list ?

Timothy Madden <[email protected]> Mon, 26 Sep 2011 15:54:43 +0300
Newsgroups gmane.comp.gnu.aspell.user
Message-ID <[email protected]>
On 23.09.2011 20:27, Kevin Atkinson wrote:
> On Fri, 23 Sep 2011, Timothy Madden wrote:
>
>> Now I have the problem that I do not know how to add a tex-command on
>> the command line to aspell list. As embedded in my .tex document, my
>> current command to check my text is:
>>
>> \write 18
>> {
>> aspell
>> --encoding=utf-8
>> --lang=en
>> --add-extra-dicts=./\currfilebase.rws
>> --mode=tex
>> --add-tex-command="autoref p"
>> --add-tex-command="nameref p"
>> --add-tex-command="url p"
>> --add-tex-command="href opP"
>> --add-tex-command="hyperdef ppP"
>> --add-tex-command="write pp"
>> list<\currfilepath
>> }
>>
>> However something is wrong with the arguments because the arguments to
>> all those LaTeX commands (autoref, nameref, url, href, hyperdef,
>> write) are still being output by aspell list as being misspelled words.
>>
>> What is the proper way to add a new TeX command on the aspell command
>> line ?
>
> What you have should work. I suggest you try it manually to isolate the
> problem. When I spot checked it, things seamed to work.

Indeed it seems to work for the most part, the problems are:
	- blocks within an argument
	- the \write18 TeX primitive

For the first case, if I have --add-tex-command="href opP" (which means 
the first 2 arguments to \href should not be checked) and the following 
text:

\href [pdfstartview={FitH 0}] {./file.html} {Link Text}

than it follows that `[pdfstartview={FitH 0}]` should not be checked. 
However I find that aspell still checks the block inside it, {FitH 0}. 
This may be desirable in some situations, but as this example shows, it 
can also be a problem in others.

Can this please be avoided ?

For the second case, \write18, in TeX a number terminates the name of a 
backslash command, so when I say \write18, what I really say is \write 
18. That is the `\write` command, with the (first) argument `18`. The 
`\write` primitive in TeX has two arguments:
	- the write number, which is actually the file descriptor number
	- the string to be written to the given file.

However in the case of file descriptor 18, the descriptor is not an 
actual file, but a command line interpreter. That is, any data written 
to it in the normal way starts the command interpreter to to carry out 
the data as a command.

So \write18 {cmd ...} is actually \write 18 {cmd...}

The problem is that in either form aspell can not understand it as such, 
and with any of --add-tex-command="write pp" or 
--add-tex-command="write18 p", aspell wants to spell check {cmd ...} 
either way.

The next step would be to try `\write {18} {cmd ...}` and see what 
aspell can do. Such a form however is not accepted by TeX, which 
complains that {18} is not a number. The only way to get it working was
	\newcommand {\shellcmd} [1] {\write 18 {#1}}
The macro in turn may some implications related to LaTeX command 
expansion, if for example the {cmd ...} has some brace '}' or pipes '|' 
characters in the command line.

Is there some way to make aspell understand `\write 18 {cmd ...}` ? Can 
this be fixed ? Or can this case be documented in the tex mode/filter 
page in the documentation ?

Thank you,
Timothy Madden