muede's right, auctex's folding functionality works very good. you can add environments to be folded customizing TeX-fold-env-spec-list
, and give a string that should be shown as replacement, for example [table]
(or even have it show on of the environment's arguments, so not all look the same).
How to define hide mode for tex \begin & \end in emacs auctex mode? [duplicate]
Domanda
I recently write a lot of tables in my tex documents. I would like to hide the table block when I am editing otherwise it will be messy.
here is the documents:
\documentclass{article}
\begin{document}
\begin{table}[htbp]
\centering
\begin{tabular}{c|c|c}
\hline
My & Name & is \\
What's & your & name\\
\hline
\end{tabular}
\caption{My table}
\end{table}
\end{document}
Since I am using Emacs with AucTeX (under windows7), I would like to hide table block as below:
\begin{table}...\end{table}
I am try to define
(add-to-list 'hs-special-modes-alist
'(LaTeX-mode
"\\\\begin" ;; regexp for start block
"\\\\end" ;; regexp for end block
"%" ;; regexp for comment start
nil
nil))
But I didn't get what I want. Can anyone help here? thanks a lot!
Soluzione
Altri suggerimenti
There is a similar feature already in Auctex, called folding.
(info "(auctex) Folding")
muede
hs-grok-mode-type
expects "latex" as major-mode. Also move-forward needs it's slot.
(add-to-list 'hs-special-modes-alist
'(latex-mode
"\\\\begin" ;; regexp for start block
"\\\\end" ;; regexp for end block
"%" ;; regexp for comment start
(lambda (arg)(search-forward "\\end"))
nil))
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow