2014-12-08 18:15:03 +01:00
|
|
|
\documentclass[12pt]{article}
|
2014-12-08 18:51:05 +01:00
|
|
|
\usepackage[utf8]{inputenc}
|
|
|
|
\usepackage{textgreek}
|
|
|
|
\usepackage{graphicx}
|
|
|
|
\usepackage{fancyvrb}
|
2014-12-08 18:15:03 +01:00
|
|
|
\usepackage{hyperref}
|
2014-12-08 18:51:05 +01:00
|
|
|
|
|
|
|
\DefineVerbatimEnvironment{juliaout}{Verbatim}{}
|
|
|
|
\DefineVerbatimEnvironment{juliacode}{Verbatim}{fontshape=sl}
|
2014-12-08 19:46:18 +01:00
|
|
|
\DefineVerbatimEnvironment{juliaterm}{Verbatim}{}
|
|
|
|
|
2014-12-08 18:15:03 +01:00
|
|
|
|
|
|
|
\title{Introduction to Julia Weave}
|
|
|
|
|
|
|
|
\begin{document}
|
|
|
|
\maketitle
|
|
|
|
|
|
|
|
This a sample \href{http://julialang.org/}{Julia} latex document that can
|
|
|
|
be executed using Weave. Output from code chunks and Gadfly
|
|
|
|
plots will be included in the weaved document.
|
|
|
|
|
|
|
|
This documented can be turned into Latex document with captured
|
|
|
|
result from Julia prompt.
|
|
|
|
|
|
|
|
\section*{Terminal chunk}
|
|
|
|
<<term=true>>=
|
|
|
|
x = 1:10
|
|
|
|
d = {"Weave" => "testing"}
|
|
|
|
y = [2, 4 ,8]
|
|
|
|
@
|
|
|
|
|
|
|
|
\section*{Capturing figures}
|
|
|
|
|
|
|
|
The figures and code can be included in the output.
|
|
|
|
|
|
|
|
<<fig_cap="sin(x) function."; label="sin_fun"; fig_pos="ht">>=
|
|
|
|
using Gadfly
|
|
|
|
x = linspace(0, 2π, 200)
|
|
|
|
plot(x=x, y = sin(x), Geom.line)
|
|
|
|
@
|
|
|
|
|
|
|
|
<<echo=false; fig_cap="cos(x) function.">>=
|
|
|
|
plot(x=x, y = cos(x), Geom.line)
|
|
|
|
@
|
|
|
|
|
|
|
|
<<echo=false; label="cos2_fun">>=
|
|
|
|
plot(x=x, y = cos(2x), Geom.line)
|
|
|
|
@
|
|
|
|
|
|
|
|
|
2014-12-08 19:46:18 +01:00
|
|
|
\end{document}
|