Subject: Re: bug#31722: 12.1.1; TeX Fold fontification problem

From: Arash Esbati <[email-masked]>
Date: Sun, 01 Jul 2018 11:55:16 +0200

Marco Falconi <[email-masked]> writes:

> I have a custom definition of math macros to be folded. It is the
> following (taken from .emacs in the customize part, I have set it
> using customize):
>
> '(LaTeX-fold-math-spec-list
>    (quote
>     (("[{1}/{2}]"
>       ("frac" "tfrac"))
>      ("[{1}⇣{2}]"
>       ("underset"))
>      ("[{1}⇡{2}]"
>       ("overset"))
>      ("︷[{1}]"
>       ("underbrace"))
>      ("√[{1}]"
>       ("sqrt")))))
>
> In the ones with two arguments (frac, tfrac, underset, overset), the
> first argument gets fontified in the folded string, but the second one
> is not fontified (in the unfolded string, everything is fontified
> correctly). This macro for example has such behavior:
>
> \underset{\hslash\to 0}{ \longrightarrow}
>
> The macros with just one argument are fontified correctly also when folded.

Hi Marco,

I can't reproduce what you're describing.  For me, a minimal .tex file
looks like this:

Here is the code of the file:

--8<---------------cut here---------------start------------->8---
\documentclass[10pt]{article}

\usepackage{amsmath}

\begin{document}

\begin{verbatim}
(setq LaTeX-fold-math-spec-list
      (append '(("[{1}/{2}]"
                 ("frac" "tfrac"))
                ("[{1}⇣{2}]"
                 ("underset"))
                ("[{1}⇡{2}]"
                 ("overset"))
                ("√[{1}]"
                 ("sqrt")))
              LaTeX-fold-math-spec-list))
\end{verbatim}

$\frac{1}{2} \tfrac{1}{2} \overset{1}{2}
\underset{\hslash\to 0}{ \longrightarrow}
\sqrt{9}$

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

What I did was:
1) Open a new tex file
2) Eval the setq form (put cursor after the last parenthesis and hit
`C-x C-e'
3) Hitting `M-x TeX-fold-mode RET' and `C-c C-o C-b'.

Best, Arash