I don't think there are many standard styles of coding outside the world of C/C++ and languages with C-like syntax. In fact, the styles you named in the questions are all C styles. I cannot recall any named styles for lua, PHP, Lisp, etc. There certainly are styles widely used for many languages, but except for C/C++, you can hardly find any "style guides".
TeX, whose syntax is quite unique, does not really has a style. It is perhaps even impossible to define a style in my opinion. For example, in C, someone (I think it is Linus) once said if your code has three or more nested levels, then you should redesign it. However, for TeX, it is not uncommon for a math formula to have many levels of brackets and one needs to deal with those long formulas, i.e., how to break them into lines, where to align them, etc. It is hard to define clear rules to be applied for all situations in the TeX world.
But readability of the code is still very important: this is the reason styles were invented in the first place. In my experience, alignment is perhaps the most important tool to improve the readability of TeX code. In fact there are tools, for example the Align plugin for Vim, available to make this task easier. And indentation is just as important to TeX as it is in other languages. I just don't think it is better to define a consistent rule for all TeX code. Instead, I believe TeX is more close to human languages and requires us to improve its readability based on the context.
Recently I have finished my thesis, and I added an appendix with some CINT (C/C++) code. I used listings
package, adding those lines on my preamble:
\definecolor{listinggray}{gray}{0.9}
\definecolor{lbcolor}{rgb}{0.9,0.9,0.9}
\lstset{
backgroundcolor=\color{lbcolor},
tabsize=4,
% rulecolor=,
language=[GNU]C++,
basicstyle=\scriptsize,
upquote=true,
aboveskip={1.5\baselineskip},
columns=fixed,
showstringspaces=false,
extendedchars=false,
breaklines=true,
prebreak = \raisebox{0ex}[0ex][0ex]{\ensuremath{\hookleftarrow}},
frame=single,
numbers=left,
showtabs=false,
showspaces=false,
showstringspaces=false,
identifierstyle=\ttfamily,
keywordstyle=\color[rgb]{0,0,1},
commentstyle=\color[rgb]{0.026,0.112,0.095},
stringstyle=\color[rgb]{0.627,0.126,0.941},
numberstyle=\color[rgb]{0.205, 0.142, 0.73},
% \lstdefinestyle{C++}{language=C++,style=numbers}’.
}
\lstset{
backgroundcolor=\color{lbcolor},
tabsize=4,
language=C++,
captionpos=b,
tabsize=3,
frame=lines,
numbers=left,
numberstyle=\tiny,
numbersep=5pt,
breaklines=true,
showstringspaces=false,
basicstyle=\footnotesize,
% identifierstyle=\color{magenta},
keywordstyle=\color[rgb]{0,0,1},
commentstyle=\color{Darkgreen},
stringstyle=\color{red}
}
The output I get looks like that:

Best Answer
Better than list R code, you can make a
my_sweave_file.Rnw
file and compile it usingknitr
to execute the code, list it and show real results.To compile this .Rnw file you can do:
But with editors like RStudio or LyX you can compile this files directly.
Note that the listed R code of you MWE is confusing and not reproducible, as you do not explain where
dpareto()
come from, so. If you use the libraryPtProcess
instead of the listed function above, the result will be ratter different:Or with the library
actuar
: