I have been using LaTeX for a long time now, but still all my document files look a bit messy. Now I want to get rid of this bad habit and get some order into my code.
That is why I am wondering whether there are any coding style guidelines for LaTeX. Not necessarily anything official. It could for example make recommendations on how to format your code with respect to:
- Setting comments in the text/preamble
- Whether to highlight sections/subsections etc. by some comments
- How to indent environements
- How to organize your preamble to make it readable
- etc.
If nothing as such exists (yet), it would be great if you could just post how you do it if you think your code looks rather nice.
%
characters to highlight new sections. Only indent environments that are composed of few lines, and for which structure is important, such as figures and tables. Don't indent paragraphs, it gets tiresome. Use some common sense and you won't go far wrong, especially with synctex.