# Source Code Indentation

I was wondering if it is possible to indent the code like in most programming languages as shown below:

``````\part
\chapter
\section
\subsection    etc.
``````

This would make the source code much more readable. So is it possible? If yes how?

-
possibly related question: tex.stackexchange.com/questions/26102/… –  doncherry Dec 17 '11 at 16:31
Whilst I think this is a bad idea in general, it could be useful for table or figure environments, and especially for TikZ. –  Mark S. Everitt Dec 17 '11 at 17:59
Yes, it is possible. Spaces at the begin of source lines is always ignored by TeX. However, I disagree that it is more readable for a normal document. Having several paragraphs of a, say `\subsubsection` indented by many spaces is not really readable to me. Instead I normally add certain separation lines before the sectioning commands, like 80-120x `%`. You can use two or more of them for higher sectioning commands. Multiple chapters and parts should be not in one source file anyway, IMHO, but instead split over several files which are then included in the main document using `\include` or `\input`.