In any other programming languages, we have several ways to format our source code. For example, some of the standard styles are:
- Allman(ANSI)
- K&R
- GNU
....
Within LaTeX, I couldn't find a neat way to clean my code. Most of the time, I usually make them align with each other like so:
An example from TikZ Automaton
\begin{tikzpicture}[shorten >=1pt, node distance=3cm,auto,on grid,initial text=, every state/.style={minimum size=3mm,draw=blue!50,very thick,fill=blue!20}]
\node[state] (q_1) {$q_1$};
\node[state] (q_2) [right=of q_1] {$q_2$};
\node[state,accepting] (q_3) [right=of q_2] {$q_3$};
\path[->]
(q_1) edge node {a} (q_2)
(q_1) edge [loop left] node {b} (q_1)
(q_2) edge [bend right] node[yshift=4mm] {a} (q_1)
(q_2) edge node {b} (q_3)
(q_3) edge [bend left] node {a} (q_1)
(q_3) edge [loop right] node {b} (q_3)
;
\end{tikzpicture}
Needless to say, manually doing this is very time-consuming and tedious. Additionally, since it does not follow any rule, the format won't be consistent and it could vary from file to file. So my question is, is there a standard style for formatting .tex
source code?