This question is not about formatting the text/markup of a document. I'm really focused on the programming aspect of LaTeX. I'm working on a fairly large set of document classes and packages, and I'm wondering what's conventional for bracing and indentation.
Looking at the latex.ltx
file, I see some groups which have their closing braces as the end of the last line, e.g.,:
\def\vgl@{\par \dimen@\prevdepth \hrule \@height\z@
\nobreak\vskip\skip@ \prevdepth\dimen@}
Other times the closing brace is in the next line, as in
\def\ltx@sh@ft #1{%
\dimen@ #1%
\kern \strip@pt
\fontdimen1\font \dimen@
} % kern by #1 times the current slant
I suppose the latter style could be called K&R. I don't know if the former has enough adherents in the C world to have a name.
As of this morning I'm considering K&R style braces with indents of four spaces. latex.ltx
and other sources I've read use two, but four seems a bit more readable. Extra newlines means one has to be careful about extra spaces and \par
s being added, but for purposes of readability I like the space.
I'm interested to hear what other conventions LaTeX programmers have used and come to like.