Discussion:
[AUCTeX] Customize tex-ispell.el
Thorsten Grothe
2017-04-25 17:38:06 UTC
Permalink
Hello,

I would like to add the environment of exsheets to tex-ispell.el,
because it's highlighted as error, the env looks like this:

\begin{question}[skip me}]{skip me}
ispell me please
\end{question}

But I have no idea how to do this. I know the file tex-ispell.el but if
I modify it, it get's overwritten with the next update.

Can anyone help me?

Thanks!

Regards

Thorsten Grothe
Arash Esbati
2017-04-25 18:09:18 UTC
Permalink
Post by Thorsten Grothe
Hello,
I would like to add the environment of exsheets to tex-ispell.el,
\begin{question}[skip me}]{skip me}
ispell me please
\end{question}
But I have no idea how to do this. I know the file tex-ispell.el but if
I modify it, it get's overwritten with the next update.
Hi Thorsten,

you find a way in the manual how to do this [1]. You can add something
like this to you init file and restart Emacs:

(eval-after-load "tex-ispell"
'(TeX-ispell-skip-setcdr
'(("question" ispell-tex-arg-end))))

Or as a local variable in your .tex file, depending on your use case.

Best, Arash

Footnotes:
[1] https://www.gnu.org/software/auctex/manual/auctex.html#index-TeX_002dispell_002dextend_002dskip_002dlist
Thorsten Grothe
2017-04-25 21:30:42 UTC
Permalink
Hi Arash,
Post by Arash Esbati
you find a way in the manual how to do this [1]. You can add something
(eval-after-load "tex-ispell"
'(TeX-ispell-skip-setcdr
'(("question" ispell-tex-arg-end))))
Or as a local variable in your .tex file, depending on your use case.
ah thank you, did not know that. Now I got this construct and it's
working fine:

(eval-after-load "tex-ispell"
'(progn
(TeX-ispell-skip-setcar
'(("\\\\blank\\*?" ispell-tex-arg-end 0)
("\\\\titelbwr" ispell-tex-arg-end 6)
("\\\\addlinespace" ispell-tex-arg-end)
))
(TeX-ispell-skip-setcdr
'(("question" ispell-tex-arg-end)
))))

but I got problems with cmidrules, they are defined in tex-ispell.el but
the regexp seems not to work for this construct:

\cmidrule(lr){2-2}

How can I add this to the above setting? Sorry for the silly question,
but I'm a beginner in regexp :-)

Regards

Thorsten
Arash Esbati
2017-04-26 06:54:32 UTC
Permalink
Post by Thorsten Grothe
ah thank you, did not know that. Now I got this construct and it's
(eval-after-load "tex-ispell"
'(progn
(TeX-ispell-skip-setcar
'(("\\\\blank\\*?" ispell-tex-arg-end 0)
("\\\\titelbwr" ispell-tex-arg-end 6)
("\\\\addlinespace" ispell-tex-arg-end)
Thanks for the reminder, I've missed that macro from booktabs.sty.
I've just added it. Note that \addlinespace takes only an optional
argument. Hence, this entry should be like this:

("\\\\addlinespace" ispell-tex-arg-end 0)
Post by Thorsten Grothe
I got problems with cmidrules, they are defined in tex-ispell.el but
\cmidrule(lr){2-2}
Which AUCTeX version do you have? Maybe you update to 11.90.2 first.
I tried this nonsensical example and Ispell (I use Hunspell binary) does
the right thing for me:

\documentclass{article}
\usepackage{booktabs}
\begin{document}
Übersetzugn\cmidrule[Übersetzugn](Übersetzugn){1-2}Übersetzugn
Übersetzugn\cmidrule(Übersetzugn){1-2}Übersetzugn
\end{document}

Can you show the entry for \cmidrule from your tex-ispell.el? It used
to be

("\\\\cmidrule" . "\\(([^)]*)\\)?{[-0-9]+}")

but I changed it to

("\\\\cmidrule" . "{[-0-9]+}")
Post by Thorsten Grothe
How can I add this to the above setting? Sorry for the silly question,
but I'm a beginner in regexp :-)
Quoting Jamie Zawinski:

Some people, when confronted with a problem, think "I know, I'll use
regular expressions." Now they have two problems.

Stay away from them, is the best thing you can do ;-)

Best, Arash
Thorsten Grothe
2017-04-26 12:40:59 UTC
Permalink
Post by Arash Esbati
Thanks for the reminder, I've missed that macro from booktabs.sty.
I've just added it. Note that \addlinespace takes only an optional
("\\\\addlinespace" ispell-tex-arg-end 0)
you are welcome :-) and thanks for the hint!


(...)
Post by Arash Esbati
("\\\\cmidrule" . "{[-0-9]+}")
yes, exactly the same here after updating Auctex and I'm using hunspell
too, but I got problems with german umlauts (ü,ö). I think this is
because hunspell dicts are not coded to utf-8, must find a way to do
that.

Anyway, this entry works fine now:

\cmidrule(lr){2-2}

but this not:

\begin{tabularx}{\linewidth}{@{}>{\sffamily\bfseries}lXX@{}}
5. & & \\\addlinespace[8pt] \cmidrule(lr){2-2}\cmidrule(lr){3-3}
4. & & \\\addlinespace[8pt] \cmidrule(lr){2-2}\cmidrule(lr){3-3}
3. & & \\\addlinespace[8pt] \cmidrule(lr){2-2}\cmidrule(lr){3-3}
2. & & \\\addlinespace[8pt] \cmidrule(lr){2-2}\cmidrule(lr){3-3}
1. & & \\\addlinespace[8pt] \cmidrule(lr){2-2}\cmidrule(lr){3-3}
\end{tabularx}

all cmidrules are flagged red, I think it has to do with tabularx?
Post by Arash Esbati
Some people, when confronted with a problem, think "I know, I'll use
regular expressions." Now they have two problems.
Stay away from them, is the best thing you can do ;-)
Oooh I agree fully with you, regular expression are not the right thing
for me :-) Nice to hear that others make the same experiences :-)

Thorsten
Thorsten Grothe
2017-04-26 12:44:36 UTC
Permalink
Problem solved, it was because of the entry

("\\\\addlinespace" ispell-tex-arg-end 0)

I added the "0" and now it works!
Sorry for the noise!

Thorsten
Thorsten Grothe
2017-04-29 18:06:50 UTC
Permalink
I think this is a bug, I got this message:

Spell-checking VWL_Aufgaben.tex using hunspell with default dictionary...done
apply: Symbol’s function definition is void: ispell-tex-skip-alist

my config looks like this:

(eval-after-load "tex-ispell"
'(progn
(TeX-ispell-skip-setcar
'(("\\\\blank\\*?" ispell-tex-arg-end 0)
("\\\\titelbwr" ispell-tex-arg-end 6)
("\\\\addlinespace" ispell-tex-arg-end 0)
("\\\\pgfplotstabletypeset" ispell-tex-arg-end 0)
;; ("\\\\ID\\*?" ispell-tex-arg-end)
))
(TeX-ispell-skip-setcdr
'(("question" ispell-tex-arg-end)
("kasten" ispell-tex-arg-end)
))))

I first happened with a new env I defined:

\begin{kasten}[\sffamily bla bla}
some text here
\end{kasten}

Then I changed the env to mdframed (the original), that helped, but now I
got the same error and I have no clue where it is. It's a very long
document. With flyspell this does not happen...

Where can I look deeper to find the

Regards

Thorsten Grothe
Arash Esbati
2017-04-30 12:00:12 UTC
Permalink
Post by Thorsten Grothe
Spell-checking VWL_Aufgaben.tex using hunspell with default dictionary...done
apply: Symbol’s function definition is void: ispell-tex-skip-alist
,----
| ispell-tex-skip-alists is a variable defined in ‘ispell.el’.
| Its value is shown below.
|
| Documentation:
| Lists of regions to be skipped in TeX mode.
| First list is used raw.
| Second list has key placed inside \begin{}.
|
| Delete or add any regions you want to be automatically selected
| for skipping in latex mode.
`----

Your message says that Emacs is looking for a function with the same
name, which is not defined. Check your configuration if you have
somewhere:

(ispell-tex-skip-alist ...

Note the opening parenthesis.
Post by Thorsten Grothe
(eval-after-load "tex-ispell"
'(progn
(TeX-ispell-skip-setcar
'(("\\\\blank\\*?" ispell-tex-arg-end 0)
("\\\\titelbwr" ispell-tex-arg-end 6)
("\\\\addlinespace" ispell-tex-arg-end 0)
("\\\\pgfplotstabletypeset" ispell-tex-arg-end 0)
;; ("\\\\ID\\*?" ispell-tex-arg-end)
))
(TeX-ispell-skip-setcdr
'(("question" ispell-tex-arg-end)
("kasten" ispell-tex-arg-end)
))))
\begin{kasten}[\sffamily bla bla}
some text here
\end{kasten}
With the code above, TeX will complain as well ;-) How do you define
your new environment? If you're using

\newmdenv[<options>]{kasten}

put this in your init file:

(setq TeX-parse-self t)

restart Emacs (without your addition), open you're .tex file, hit `C-c
C-n' and try it again. mdframed.el has some code to add new
environments like "kasten" to ispell skip list, i.e. in
`ispell-tex-skip-alists', you should have an entry like:

("kasten" ispell-tex-arg-end 0)
Post by Thorsten Grothe
Then I changed the env to mdframed (the original), that helped, but now I
got the same error and I have no clue where it is. It's a very long
document. With flyspell this does not happen...
The length of your .tex document is not relevant for the error message
above; unless you have local variables with lisp code to be evaluated in
your .tex files.
Post by Thorsten Grothe
Where can I look deeper to find the
Normal procedure is to start Emacs with `-q' switch, paste your code in
scratch buffer, evaluate it, do `M-x toggle-debug-on-error RET' and
invoke the error and see what Emacs says.

And I can't reproduce what you describe.

Best, Arash
Thorsten Grothe
2017-05-01 15:35:54 UTC
Permalink
Hi Arash,

* Arash Esbati: 30.04.2017 (12:00):

(...)
Post by Arash Esbati
Your message says that Emacs is looking for a function with the same
name, which is not defined. Check your configuration if you have
(ispell-tex-skip-alist ...
Note the opening parenthesis.
no, I do not, I thought that this:

(eval-after-load "tex-ispell"
'(progn
(TeX-ispell-skip-setcar ...

would be the way to solve the issue.
Post by Arash Esbati
How do you define
your new environment? If you're using
I defined it like so:

\newmdenv[linewidth=2pt,roundcorner=10pt,frametitlerule=true,
frametitlebackgroundcolor=DarkGreen!45,linecolor=DarkGreen!35,backgroundcolor=gray!5,
frametitlerulecolor=DarkGreen!35,frametitlerulewidth=2pt]{kasten}

and used

\begin[bla]{kasten
\end{kasten}

this works for my tex documents and LaTeX runs through without any error
message.

The other thing is that I made a couple of settings in a personal sty
file, the env kasten too.

In the main document I loaded it with \usepackage, this works without
problems. I tried "TeX-auto-generate" for my personal sty file but this
does not help.
Post by Arash Esbati
(setq TeX-parse-self t)
this is in my init since years :-)


It's definitely the new environment kasten what makes problems. I
replaced it with \begin{mdframed} and the error vanishes. I tried this

\newenvironment{kasten}[1]
{\mdfsetup{
frametitle={\colorbox{white}{\space#1\space}},
innertopmargin=10pt,
frametitleaboveskip=-\ht\strutbox,
frametitlealignment=\center
}
\begin{mdframed}%
}
{\end{mdframed}}

and put it in my personal sty file in texmf and ------ it works without
problems. I spellchecked the whole document with no issue. So I guess it
has something to do with my environment definition, strange.
Post by Arash Esbati
("kasten" ispell-tex-arg-end 0)
tried this too, same effect :-) the old env causes the error, the new
env works fine...

Regards

Thorsten Grothe
Arash Esbati
2017-05-02 10:07:16 UTC
Permalink
Post by Thorsten Grothe
How do you define your new environment? If you're using
\newmdenv[linewidth=2pt,roundcorner=10pt,frametitlerule=true,
frametitlebackgroundcolor=DarkGreen!45,linecolor=DarkGreen!35,backgroundcolor=gray!5,
frametitlerulecolor=DarkGreen!35,frametitlerulewidth=2pt]{kasten}
Hi Thorsten,

this is indeed a bug in mdframed.el and I've just fixed it. You can
fetch mdframed.el from AUCTeX repo and use it until the next release.

Again, thank for catching this.

Best, Arash
Thorsten Grothe
2017-05-02 10:17:56 UTC
Permalink
Hi Arash,

* Arash Esbati: 02.05.2017 (10:07):


[...]
Post by Arash Esbati
this is indeed a bug in mdframed.el and I've just fixed it. You can
fetch mdframed.el from AUCTeX repo and use it until the next release.
I'm glad, that I could help and it was not my fault :-)

Regards
Thorsten

Loading...