2

Auctex comes with a folding mode that already folds most of the uninteresting things. However, acronym macros are not folded. How can I instruct Auctex to fold acronym macros (e.g., \ac, \acp, \acf, etc.)?

\documentclass[12pt]{article}

\usepackage[printonlyused,nolist]{acronym}

% Acronyms
\begin{acronym}
  \acro{IDS}{Intrusion Detection Systems}
  \acro{ML}{Machine Learning}
\end{acronym}

\begin{document}

\title{Just another Auctex document}

\section{Section 1}
This section uses acronyms. For example, \ac{IDS} or \ac{ML}.

\end{document}

If I enable folding mode (TeX-fold-mode), how could I instruct Auctex to also fold the macros \ac{}?

2

I have discovered the variable "TeX-fold-macro-spec-list". This variable contains a list of macros that are folded by "TeX-fold-mode". To fold the acronym macros (e.g.: \ac{}, \acp{}, \acf{}, \acpf{}), I have placed the following lines in my init.el file:

;; Set custom folds for Acronyms
(add-to-list 'TeX-fold-macro-spec-list '("{1}" ("ac" "acf")))
(add-to-list 'TeX-fold-macro-spec-list '("{1}s" ("acp" "acpf")))

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.