2010-04-15 12 views
13

क्या कोई Emacs मामूली-मोड (या elisp कोड का टुकड़ा) है जो आपको लाटेक्स मोड में चुनिंदा वातावरण को चुनने/दिखाने देता है? उदाहरण के लिए, मैं एक लंबे \begin{figure} ब्लॉक की शुरुआत में जाना चाहता हूं, एक कीस्ट्रोक दबाएं, और उस आंकड़े पर्यावरण की सामग्री को देखने से छुपाएं। इसी तरह \begin{proof} और इसी तरह, और आदर्श रूप से \subsection एस के साथ भी।Emacs में LaTeX के लिए कोड फोल्डिंग

क्या यह संभव है? मैंने बस hs-minor-mode, allout-mode, और outline-minor-mode की कोशिश की, लेकिन उनमें से अधिकतर लाटेक्स के वातावरण को पहचान नहीं पाए, उदा। एचएस-नाबालिग मोड "स्कैन त्रुटि: असंतुलित कोष्ठक" के साथ विफल रहता है। मैं {{{folding-mode में {{{जैसे स्पष्ट फ़ोल्डिंग अंक दर्ज नहीं करना चाहता हूं।

[आदर्श रूप में इसे अगर तह persistent थे बहुत अच्छा होगा, लेकिन मुझे लगता है कि इस सवाल का अभी तक एक स्वीकृत जवाब नहीं है।]

उत्तर

13

AUCTeX तह करता है: http://www.gnu.org/software/auctex/manual/auctex.html#Folding

A popular complaint about markup languages like TeX and LaTeX is that there is too much clutter in the source text and that one cannot focus well on the content. There are macros where you are only interested in the content they are enclosing, like font specifiers where the content might already be fontified in a special way by font locking. Or macros the content of which you only want to see when actually editing it, like footnotes or citations. Similarly you might find certain environments or comments distracting when trying to concentrate on the body of your document.

With AUCTeX’s folding functionality you can collapse those items and replace them by a fixed string, the content of one of their arguments, or a mixture of both. If you want to make the original text visible again in order to view or edit it, move point sideways onto the placeholder (also called display string) or left-click with the mouse pointer on it. (The latter is currently only supported on Emacs.) The macro or environment will unfold automatically, stay open as long as point is inside of it and collapse again once you move point out of it. (Note that folding of environments currently does not work in every AUCTeX mode.)

In order to use this feature, you have to activate TeX-fold-mode which will activate the auto-reveal feature and the necessary commands to hide and show macros and environments. You can activate the mode in a certain buffer by typing the command M-x TeX-fold-mode RET or using the keyboard shortcut C-c C-o C-f . If you want to use it every time you edit a LaTeX document, add it to a hook:

(add-hook 'LaTeX-mode-hook (lambda() 
          (TeX-fold-mode 1))) 

If it should be activated in all AUCTeX modes, use TeX-mode-hook instead of LaTeX-mode-hook .

Once the mode is active there are several commands available to hide and show macros, environments and comments...

+0

दरअसल, धन्यवाद ! मैं अब बेवकूफ की तरह महसूस करता हूँ। :-) – ShreevatsaR

+4

आप एम-एक्स छुपा-बॉडी और एम-एक्स शो-सबट्री जैसे रूपरेखा आदेशों का भी उपयोग कर सकते हैं। रेफटेक्स भी देखें, जिसमें एक टीओसी नेविगेशन सुविधा है। –

संबंधित मुद्दे