Discussion:
[AUCTeX] Support for empheq
Hong Xu
2016-08-07 01:48:27 UTC
Permalink
Hi all,

Empheq, an environment to typeset math equations, is currently not
supported by auctex. Is there any plan to support it? Thanks!

Hong
Mosè Giordano
2016-08-07 15:23:48 UTC
Permalink
Hi Hong,
Post by Hong Xu
Hi all,
Empheq, an environment to typeset math equations, is currently not
supported by auctex. Is there any plan to support it? Thanks!
We don't have a style file for empheq.sty in AUCTeX, yet, but you can
generate one right now from within Emacs with the following command:

M-x TeX-auto-generate RET /path/to/empheq.sty RET RET

Replace "/path/to/empheq.sty" with the actual path of your
"empheq.sty" file. Restart Emacs and you'll enjoy autocompletion for
macros and environments (including "empheq", with its optional and
mandatory arguments) provided by empheq package.

Bye,
Mosè
Hong Xu
2016-08-08 05:27:20 UTC
Permalink
Post by Mosè Giordano
Hi Hong,
Post by Hong Xu
Hi all,
Empheq, an environment to typeset math equations, is currently not
supported by auctex. Is there any plan to support it? Thanks!
We don't have a style file for empheq.sty in AUCTeX, yet, but you can
M-x TeX-auto-generate RET /path/to/empheq.sty RET RET
Replace "/path/to/empheq.sty" with the actual path of your
"empheq.sty" file. Restart Emacs and you'll enjoy autocompletion for
macros and environments (including "empheq", with its optional and
mandatory arguments) provided by empheq package.
Hi Mosè,

Thanks for your reply. I've run the auto generation command, but one
important feature is missing: the contents within the environment is not
highlighted as math. How can we solve it? Thanks!

Hong
Arash Esbati
2016-08-10 11:26:10 UTC
Permalink
Hi Hong,
Post by Hong Xu
Post by Mosè Giordano
Post by Hong Xu
Empheq, an environment to typeset math equations, is currently not
supported by auctex. Is there any plan to support it? Thanks!
We don't have a style file for empheq.sty in AUCTeX, yet, but you can
M-x TeX-auto-generate RET /path/to/empheq.sty RET RET
Replace "/path/to/empheq.sty" with the actual path of your
"empheq.sty" file. Restart Emacs and you'll enjoy autocompletion for
macros and environments (including "empheq", with its optional and
mandatory arguments) provided by empheq package.
Thanks for your reply. I've run the auto generation command, but one
important feature is missing: the contents within the environment is not
highlighted as math. How can we solve it? Thanks!
Writing a style file for empheq.sty was on my list for a long time. I
had a skeleton, but now I finished it. Could you test the attached file
and report back? I will install the file then for the next release.

And while we're at it: Are you also using features from mathtools.sty?
I think AUCTeX's style file has a bug in \shoveleft and \shoveright.

Best, Arash
Hong Xu
2016-08-10 22:23:53 UTC
Permalink
Post by Mosè Giordano
Hi Hong,
Post by Hong Xu
Post by Mosè Giordano
Post by Hong Xu
Empheq, an environment to typeset math equations, is currently not
supported by auctex. Is there any plan to support it? Thanks!
We don't have a style file for empheq.sty in AUCTeX, yet, but you can
M-x TeX-auto-generate RET /path/to/empheq.sty RET RET
Replace "/path/to/empheq.sty" with the actual path of your
"empheq.sty" file. Restart Emacs and you'll enjoy autocompletion for
macros and environments (including "empheq", with its optional and
mandatory arguments) provided by empheq package.
Thanks for your reply. I've run the auto generation command, but one
important feature is missing: the contents within the environment is not
highlighted as math. How can we solve it? Thanks!
Writing a style file for empheq.sty was on my list for a long time. I
had a skeleton, but now I finished it. Could you test the attached file
and report back? I will install the file then for the next release.
And while we're at it: Are you also using features from mathtools.sty?
I think AUCTeX's style file has a bug in \shoveleft and \shoveright.
Hi Arash,

Thanks for the empheq style file -- it works well for me! Unfortunately
I've never used mathtools.sty, and I don't really know what kind of bug
ACUTeX has on them.

Hong
Hong Xu
2016-11-12 08:53:18 UTC
Permalink
Post by Hong Xu
Post by Mosè Giordano
Hi Hong,
Post by Hong Xu
Post by Mosè Giordano
Post by Hong Xu
Empheq, an environment to typeset math equations, is currently not
supported by auctex. Is there any plan to support it? Thanks!
We don't have a style file for empheq.sty in AUCTeX, yet, but you can
M-x TeX-auto-generate RET /path/to/empheq.sty RET RET
Replace "/path/to/empheq.sty" with the actual path of your
"empheq.sty" file. Restart Emacs and you'll enjoy autocompletion for
macros and environments (including "empheq", with its optional and
mandatory arguments) provided by empheq package.
Thanks for your reply. I've run the auto generation command, but one
important feature is missing: the contents within the environment is not
highlighted as math. How can we solve it? Thanks!
Writing a style file for empheq.sty was on my list for a long time. I
had a skeleton, but now I finished it. Could you test the attached file
and report back? I will install the file then for the next release.
And while we're at it: Are you also using features from mathtools.sty?
I think AUCTeX's style file has a bug in \shoveleft and \shoveright.
Thanks for the empheq style file -- it works well for me! Unfortunately
I've never used mathtools.sty, and I don't really know what kind of bug
ACUTeX has on them.
Hi Arash and Mos?FFC3?FFA8,

It looks like in the latest version, the math highlighting is gone, with
a minimal non-working example as follows:


\documentclass{article}
\usepackage{empheq}

\begin{document}
\begin{empheq}{align}
x = y
\end{empheq}
\end{document}


Can you help me with it, please? Thanks! My AUCTeX-version is
"2016-11-04".

Hong
Arash Esbati
2016-11-12 10:50:54 UTC
Permalink
Hi Hong,
Post by Hong Xu
It looks like in the latest version, the math highlighting is gone, with
\documentclass{article}
\usepackage{empheq}
\begin{document}
\begin{empheq}{align}
x = y
\end{empheq}
\end{document}
Can you help me with it, please? Thanks! My AUCTeX-version is
"2016-11-04".
For me, it looks like this:
Hong Xu
2016-11-12 19:09:15 UTC
Permalink
I use AUCTeX from git. What do you see?
I also use AUCTeX from git. My screenshot is attached.

Hong
Arash Esbati
2016-11-12 21:30:12 UTC
Permalink
Post by Hong Xu
I use AUCTeX from git. What do you see?
I also use AUCTeX from git. My screenshot is attached.
Hmm, I can't tell what's going wrong. Do you use a theme? Maybe you
disable it and try it again. You could also check the information on
characters fontified and not by putting point on them and hitting `C-u
C-x ='. For me, I get this when I check an `a' inside an empheq env:

...
There are text properties here:
face (font-latex-math-face)
font-lock-multiline t
fontified t

You could also check `M-x list-load-path-shadows'.

Best, Arash
Hong Xu
2016-11-13 10:32:42 UTC
Permalink
Post by Arash Esbati
Hmm, I can't tell what's going wrong. Do you use a theme? Maybe you
disable it and try it again. You could also check the information on
characters fontified and not by putting point on them and hitting `C-u
...
face (font-latex-math-face)
font-lock-multiline t
fontified t
You could also check `M-x list-load-path-shadows'.
I tried that, for the align environment, I got:

There are text properties here:
face (font-latex-math-face)
font-lock-multiline t
fontified t

For the empheq environment, I got:

There are text properties here:
fontified t

I'm currently using the built-in theme 'wombat, but switching to default
does not help.

Hong
Arash Esbati
2016-11-13 18:11:04 UTC
Permalink
Post by Arash Esbati
Post by Arash Esbati
Hmm, I can't tell what's going wrong. Do you use a theme? Maybe you
disable it and try it again. You could also check the information on
characters fontified and not by putting point on them and hitting `C-u
...
face (font-latex-math-face)
font-lock-multiline t
fontified t
You could also check `M-x list-load-path-shadows'.
face (font-latex-math-face)
font-lock-multiline t
fontified t
fontified t
I'm currently using the built-in theme 'wombat, but switching to default
does not help.
What was the result of `M-x list-load-path-shadows RET'?

Sorry, I'm out of ideas here. Last thing comes to mind is you start
Emacs with `-q' switch, eval minium expressions to load AUCTeX in
scratch buffer and try to find the culprit. You can file a bug report
if you have something.

Best, Arash

Mosè Giordano
2016-08-11 17:55:42 UTC
Permalink
Hi Arash,
Post by Arash Esbati
Writing a style file for empheq.sty was on my list for a long time. I
had a skeleton, but now I finished it. Could you test the attached file
and report back? I will install the file then for the next release.
Looks good, thank you! I was wondering why you used
`dolist'+`add-to-list' to add the options of mathtools and amsmath to
those of empheq, but I found the answer in mathtools style file: avoid
duplicate (or even triplicate) entries. Right? I think you can drop
a comment to explain it to other readers ;-) However, mathtools
already adds amsmath's options to its owns, do you need to repeat it
also in empheq style file?

A feature request: do you think you can make `TeX-insert-item' work in
`empheq' environment when one specifies `align', `gather', or
`alignat' ams-environments, just like it works in the parent
environments? This may not really easy to implement, tough.
Post by Arash Esbati
And while we're at it: Are you also using features from mathtools.sty?
I think AUCTeX's style file has a bug in \shoveleft and \shoveright.
What do you refer to?

Bye,
Mosè
Arash Esbati
2016-08-12 10:09:55 UTC
Permalink
Hi Mosè,
Post by Mosè Giordano
Post by Arash Esbati
Writing a style file for empheq.sty was on my list for a long time. I
had a skeleton, but now I finished it. Could you test the attached file
and report back? I will install the file then for the next release.
Looks good, thank you!
Thank you for looking at the code.
Post by Mosè Giordano
I was wondering why you used `dolist'+`add-to-list' to add the options
of mathtools and amsmath to those of empheq, but I found the answer in
mathtools style file: avoid duplicate (or even triplicate) entries.
Right? I think you can drop a comment to explain it to other readers
;-)
You are right, I've added a comment.
Post by Mosè Giordano
However, mathtools already adds amsmath's options to its owns, do you
need to repeat it also in empheq style file?
Nice catch! My mistake while copy&pasting. Thnx.
Post by Mosè Giordano
A feature request: do you think you can make `TeX-insert-item' work in
`empheq' environment when one specifies `align', `gather', or
`alignat' ams-environments, just like it works in the parent
environments? This may not really easy to implement, tough.
Done, new version is attached, the function is called
`LaTeX-empheq-item-equation'. One thing occured to me as I wrote it:
AUCTeX inserts an `\item' if one hits `M-RET' in an equation env:

--8<---------------cut here---------------start------------->8---
\documentclass{article}

\usepackage[overload]{empheq}

\begin{document}

\begin{equation}
\label{eq:1}
Hit `M-RET' here
\end{equation}

\begin{empheq}{equation}
\label{eq:2}
Hit `M-RET' here
\end{empheq}

\end{document}
--8<---------------cut here---------------end--------------->8---

I added some code to `LaTeX-empheq-item-equation' to suppress this.
Should AUCTeX do something like this for standard equation? WDYT?
Post by Mosè Giordano
Post by Arash Esbati
And while we're at it: Are you also using features from mathtools.sty?
I think AUCTeX's style file has a bug in \shoveleft and \shoveright.
What do you refer to?
Hit `C-c C-m shoveleft RET 4 RET 5 RET' in example above and AUCTeX asks
for a width and height resulting in \shoveleft(4,5){}. \shoveleft takes
an optional dimension argument, it should be \shoveleft[1cm]{} (see
mathtools doc page 17). The entries

'("shoveleft" [ TeX-arg-size ] 1)
'("shoveright" [ TeX-arg-size ] 1)

should be

'("shoveleft" [ TeX-arg-length ] 1)
'("shoveright" [ TeX-arg-length ] 1)

Best, Arash
Mosè Giordano
2016-08-13 14:44:55 UTC
Permalink
Hi Arash,
Post by Arash Esbati
Post by Mosè Giordano
A feature request: do you think you can make `TeX-insert-item' work in
`empheq' environment when one specifies `align', `gather', or
`alignat' ams-environments, just like it works in the parent
environments? This may not really easy to implement, tough.
Done, new version is attached, the function is called
`LaTeX-empheq-item-equation'.
Thank you so much, that's exactly what I was thinking!
Post by Arash Esbati
--8<---------------cut here---------------start------------->8---
\documentclass{article}
\usepackage[overload]{empheq}
\begin{document}
\begin{equation}
\label{eq:1}
Hit `M-RET' here
\end{equation}
\begin{empheq}{equation}
\label{eq:2}
Hit `M-RET' here
\end{empheq}
\end{document}
--8<---------------cut here---------------end--------------->8---
I added some code to `LaTeX-empheq-item-equation' to suppress this.
Should AUCTeX do something like this for standard equation? WDYT?
I think this is fine in `empheq' environment, not sure it's valuable
elsewhere. One shouldn't use it in environments that doesn't have an
item-like style: I consider it an error of the user to try to issue
C-c C-j in an `equation' environment. We could prevent them from
doing the wrong thing, but I consider a feature having
`TeX-insert-item' inserting "\item" macro in an environment not
present in `LaTeX-item-list': there can be environments that we don't
support that require "\item"s and users can easily insert them even
without a proper style file in AUCTeX.
Post by Arash Esbati
Post by Mosè Giordano
Post by Arash Esbati
And while we're at it: Are you also using features from mathtools.sty?
I think AUCTeX's style file has a bug in \shoveleft and \shoveright.
What do you refer to?
Hit `C-c C-m shoveleft RET 4 RET 5 RET' in example above and AUCTeX asks
for a width and height resulting in \shoveleft(4,5){}. \shoveleft takes
an optional dimension argument, it should be \shoveleft[1cm]{} (see
mathtools doc page 17). The entries
'("shoveleft" [ TeX-arg-size ] 1)
'("shoveright" [ TeX-arg-size ] 1)
should be
'("shoveleft" [ TeX-arg-length ] 1)
'("shoveright" [ TeX-arg-length ] 1)
Oh, yes, I think you're right, good catch.

I think you can install this empheq style file.

Bye,
Mosè
Arash Esbati
2016-08-13 18:19:54 UTC
Permalink
Hi Mosè,
Post by Mosè Giordano
Post by Arash Esbati
Post by Mosè Giordano
A feature request: do you think you can make `TeX-insert-item' work in
`empheq' environment when one specifies `align', `gather', or
`alignat' ams-environments, just like it works in the parent
environments? This may not really easy to implement, tough.
Done, new version is attached, the function is called
`LaTeX-empheq-item-equation'.
Thank you so much, that's exactly what I was thinking!
Thank you for double checking!
Post by Mosè Giordano
Post by Arash Esbati
[...]
I added some code to `LaTeX-empheq-item-equation' to suppress this.
Should AUCTeX do something like this for standard equation? WDYT?
I think this is fine in `empheq' environment, not sure it's valuable
elsewhere. One shouldn't use it in environments that doesn't have an
item-like style: I consider it an error of the user to try to issue
C-c C-j in an `equation' environment.
Yes, I agree that pressing C-c C-j in such a case is an user error.
Then let keep it this way, I leave the code in empheq.el as is.
Post by Mosè Giordano
Post by Arash Esbati
Post by Mosè Giordano
Post by Arash Esbati
And while we're at it: Are you also using features from mathtools.sty?
I think AUCTeX's style file has a bug in \shoveleft and \shoveright.
What do you refer to?
Hit `C-c C-m shoveleft RET 4 RET 5 RET' in example above and AUCTeX asks
for a width and height resulting in \shoveleft(4,5){}. \shoveleft takes
an optional dimension argument, it should be \shoveleft[1cm]{} (see
mathtools doc page 17). The entries
'("shoveleft" [ TeX-arg-size ] 1)
'("shoveright" [ TeX-arg-size ] 1)
should be
'("shoveleft" [ TeX-arg-length ] 1)
'("shoveright" [ TeX-arg-length ] 1)
Oh, yes, I think you're right, good catch.
I see that mathtools.el has also some other issues. I have to go
through the manual of mathtools since I've never used it (applies to
empheq as well ;-)
Post by Mosè Giordano
I think you can install this empheq style file.
Thanks for the thumbs-up; I added some code to update the key-value when
new delimiters are defined with \Declare(Left|Right)Delimiter. I'll do
some final tests and install the file.

Best, Arash
Loading...