auctex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[AUCTeX] How to indent the tex file properly?


From: Cody Chan
Subject: [AUCTeX] How to indent the tex file properly?
Date: Wed, 14 Sep 2016 17:21:01 +0800

When I'm editing a org-mode file, the structure of mine is like this(you may need configuration in init.el):

-------------------snippet starts-------------------------
    * A section
      This is the content of the section
      #+BEGIN_SRC lang
        code here
      #+END_SRC
      ** A subsection
         This is the content of the subsection
    * Another section
      This is the content of another section
-------------------snippet ends-----------------------------

But when when I'm editing a tex file using auctex, the structure of the tex file is this after I indented the whole buffer:

-------------------snippet starts----------------
    \documentclass{article}

    \begin{document}

    \section{A section}
    This is the content of the section.

    \begin{verbatim}
    some verbatim text
    \end{verbatim}

    \subsection{A subsection}
    This is the content of the subsection

    \section{Another section}
    This is the content of another section

    \end{document}
-------------------snippet ends-----------------
It is not easy to view the whole structure, I know I can use **C-c =** to view the toc, but how can I make it like org-mode such as:

-------------------snippet starts----------------
    \documentclass{article}

    \begin{document}

      \section{A section}
         This is the content of the section.

        \begin{verbatim}
          some verbatim text
        \end{verbatim}

        \subsection{A subsection}
          This is the content of the subsection

      \section{Another section}
        This is the content of another section

    \end{document}
-------------------snippet ends--------------------

So, how can I indent the tex file (just using **TAB** and **ENTER** keys when editing it or indent the whole buffer using **TAB** or indent command)?

I mean, every block (section, subsection, **EVERY** `\begin{}...\end{}` pair no matter what is inside the {}) should be a part and should be in its place related to its parent? And the indent-level should be configurable.

How can do I do that? I googled a lot and found nothing useful.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]