In many MWE here on TeX.SE the LaTeX code is written without explanatory comments and as compact as possible. An Example:
\documentclass[ngerman,fontsize=12pt,pagesize]{scrreprt}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage[backref=page,breaklinks,colorlinks]{hyperref}
\hypersetup{pdftitle={Titel},pdfauthor={username}}
\begin{document}
Blindtext. \url{http://tex.stackexchange.com}.
\end{document}
This is particularly difficult to read for LaTeX beginners and to understand. So I got used a certain style of writing MWEs. I use a space (to be changed to a % character if neccessary) in front of macros like \usepackage{} or I write each option for a document class or a package in a seperate line with a leading coma. So I'm able to comment the meaning of the option. And one can see which lines are commented. Added now to the example: You can easy switch between two fonts or two encriptions. The same example pretty printed:
\documentclass[%
ngerman
%,paper=a4 % Papiergröße (Voreinstellung)
,fontsize=12pt % Brotschrift-Grad
%,parskip=full % Abstand Absätze, erste Zeile nicht eingezogen.
,pagesize % entscheidet zur Laufzeit, ob dvips oder pdf
]{scrreprt}
\usepackage{lmodern} % Latin Modern
%\usepackage{libertine} % Libertine Legacy
\usepackage[T1]{fontenc} % Ausgabezeichensatz
\usepackage[latin9]{inputenc} % Windows PC
%\usepackage[utf8]{inputenc} % Unicode
\usepackage[%
backref=page % Verweis auf Seite
% ,pagebackref % wie zuvor
,breaklinks % Links überleben einen Zeilenumbruch
,colorlinks % Links farbig für PDF-Betrachtung
]{hyperref}
\hypersetup{% % Konfiguration hyperref
pdftitle={Titel} % Titel
,pdfauthor={username} % Verfasser
%,linktoc=all % Alles als Link setzen
}
\begin{document}
Blindtext. \url{http://tex.stackexchange.com}.
\end{document}
Question: Are there any objections to format a LaTeX code like this? For example,
can the leading space of macro
\usepackage{}lead to errors,can the notation
,option = valuelead to errors (I prefer this kind of notation to get rid of missing commas. If all commas are in the same column, it is much harder to forget one (the first line must not have a leading comma)).
latexindent. – Werner Jan 28 '13 at 19:44