Iain Mac Donald wrote:
Hello LyXers,

I use LyX for producing a lot of large documents with substantial
amounts of code and scripts. They all come out looking wonderful and are
easy to produce. Great so far.

There is one thing which would make life easier though - being able to
configure the spellchecker to ignore all the sections of LyX-Code. I do
not see a way to do it using the preferences. I have Googled and even
read the manual but haven't found anything. I did notice that if you use
pspell you can spell check in different languages. Is this a clue?

If this is not possible please consider this as a feature request.

Any help or suggestions would be much appreciated. I don't think my left
mouse button can hold out much longer :-)


I haven't gotten this to work myself, but this is supposed to work by marking the stuff you don't want checked and changing it to some other
language than the language used in your document.
This doesn't work with ispell, but is supposed to work with aspell. I
gave up trying to compile lyx with aspell when it turned out that
the aspell wordlists lacked lots of common words that ispell have.
That may have changed, or the situation may be different for your
language of choice.



Four ways of working around this problem:


1. Skipping code snippets manually - no changes to your documents.
When ispell find the first bad word in code, terminate spellchecking.
Move the cursor after your code and press F7 to restart spellchecking
at that point.  Unfortunately, you loose the "ignore alls" from the
previous spellchecking session

2. Put code in separate documents
In the main document, use insert->include file
and specify "input" as the way of including the file containing lyxcode.
The printed result is identical to having lyxcode inside
the document, but it won't be spellchecked because it is
in another file.  You can edit your code files from withing
the main document by clicking on the little "input" boxes you get.

3. Consider the listings package.  Currently, that means using
some latex, although support for this package is planned.
(Latex code isn't spellchecked)
The listings package has many advantages. It can list your source
files directly, so you need only one source file that will be used both
for compiling/interpreting and for printing.  And you can get stuff like
automatic line numbers and syntax highlighting if you like.

4. Take a look at the .tex file produced from a file containing lyx code.
The lyxcode part isn't that difficult. Write your code entirely in ERT
instead of using lyxcode. ERT isn't spellchecked, and you get everything in a single document.


Helge Hafting




Reply via email to