auctex-devel
[Top][All Lists]

## Re: [AUCTeX-devel] How to indent the tex file properly?

 From: Tassilo Horn Subject: Re: [AUCTeX-devel] How to indent the tex file properly? Date: Wed, 14 Sep 2016 18:34:33 +0200 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

> 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)?

You can't do that.  One reason that cannot be done is that nothing stops
you to define your own \mysection{Foo bar baz} macro which just emits
\section[Foo...]{Foo bar baz}, but how could AUCTeX know that for
producing the right indentation.

AUCTeX does indent in nested structures, e.g., when you put an itemize
environment in an enumerate environment, that will be indented, or when
you have nesting in terms of {...}.

> 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?

Please note that this wouldn't be possible, or rather not produce the
desired output, with some verbatim environments, e.g., with

--8<---------------cut here---------------start------------->8---
\part{Foo}

\chapter{Bar}

\section{Baz}

\subsection{Quux}

\paragraph{Quexl}

\subparagraph{Bla}

\begin{verbatim}
this stuff has 14 spaces in front even in the compiled output
\end{verbatim}
--8<---------------cut here---------------end--------------->8---

the verbatim text will also have 14 spaces in front of it in the
compiled PDF output, because well, verbatim means put the stuff in there
just as I've typed it.  I guess you don't want that, and you'd need to
write

--8<---------------cut here---------------start------------->8---
\part{Foo}

\chapter{Bar}

\section{Baz}

\subsection{Quux}

\paragraph{Quexl}

\subparagraph{Bla}

\begin{verbatim}
this stuff has 14 spaces in front even in the compiled output
\end{verbatim}
--8<---------------cut here---------------end--------------->8---

which pretty much defeats the purpose of the whole indentation ceremony.

Bye,
Tassilo