2

I want to use the folding functionality of AUCTeX, mainly to replace math macros with the corresponding symbols. But at the same time I want to continue to use square or curly brackets additionally to parentheses. But AUCTeX hides then square or curly brackets and their content.

So if I write:

\documentclass{article}

\begin{document}

$a \to [b \to c]$

\end{document}

and then apply TeX-fold-buffer I get as result:

\documentclass{article}

\begin{document}

$a →$

\end{document}

What I would like to get is:

\documentclass{article}

\begin{document}

$a  → [b → c]$

\end{document}

How can I prevent AUCTeX folding from hiding square or curly brackets and their content in math mode?

  • 1
    Actually $a [b \to c]$ is folded as expected to $a [b → c]$, so it isn't a problem with square brackets but perhaps a conflict between the \to and the brackets. – giordano Jul 7 '14 at 9:34
  • @giordano: It seems to be a conflict between any folded math macro and square and curly brackets. For every math macro in LaTeX-fold-math-spec-list I tested the problem appears. – newtothis Jul 7 '14 at 14:12
  • You're right. I found the problem: folding relies on TeX-find-macro-end-helper to detect the end of the macro to be folded, but this considers square brackets and curly braces as part of the macro, so they will be always folded when they follow a math macro. I need to think about a solution (probably a redefinition of TeX-find-macro-end-helper). Thank you for having spotted this issue! – giordano Jul 7 '14 at 15:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.