Automatic reporting and reproducible research using Maxima, RStudio, Latex, and knitr
Subject: Automatic reporting and reproducible research using Maxima, RStudio, Latex, and knitr
From: Kai Velten
Date: Sat, 26 Oct 2013 10:46:15 +0200
I've found a way to use Maxima in RStudio as follows (e.g. in
Ubuntu-Linux):
1. In RStudio: File, New, R Sweave (package knitr required in R).
2. Paste the template below into the Latex-Document.
3. Compile using Ctrl+Shift+I.
In this way Maxima computations can be integrated into Latex documents.
You can also use R computations (r-project.org) in the same document.
Let me know about your experiences - maybe you have ideas how this can
be further improved.
Regards, Kai Velten
Note: Uncomment and adapt the system commands to set options if
required.
Mit freundlichen Gr??en,
Kai Velten
--
Kai Velten
Hochschule Geisenheim University
Zentrum f?r Weinforschung und Verfahrenstechnologie der Getr?nke
AG Modellierung und Systemanalyse
von-Lade-Stra?e 1
D-65366 Geisenheim,
Germany
Tel. +49 6722.502.734, 0157.354.353.89
Fax 03212.1092579
kai.velten at hs-gm.de
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Template}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
<<results='markup',tidy=FALSE,size='footnotesize'>>=
write("
f(x):=61+x-(249+x/0.75*0.5);
plot2d(f(x),[x,0,1000]
);
print(solve(f(x)=0));
",file="/home/velten/.maxima/programm.mac")
@
<<results='markup',tidy=FALSE,size='footnotesize',echo=FALSE>>=
options(width=40)
#system("mv /home/velten/.maxima/programm.mac /home/velten/.maxima/prog.mac")
#system("cat /home/velten/.maxima/optionen.mac /home/velten/.maxima/prog.mac #> /home/velten/.maxima/programm.mac")
txt=system2("maxima", " -q --batch-string \"
load(string(programm))$
\" ",stdout=TRUE); for (ex in txt) cat(paste(ex,"\n"))
system("cp /home/velten/maxplot.png /home/velten/.maxima/2013-10-16a.png")
@
% \begin{figure}[h!]
% \begin{center}
% \includegraphics[width=8cm]{/home/velten/.maxima/2013-10-16a.png}
% % log3 . eps: 540x378 pixel, 72dpi, 19.05x13.34 cm, bb=0 0 540 378
% \end{center}
% \end{figure}
%