Julia language: a concise tutorial
  • Introduction
  • Language core
    • 1 - Getting started
    • 2 - Data types
    • 3 - Control flow
    • 4 - Functions
    • 5 - Custom structures
    • 6 - Input - Output
    • 7 - Managing run-time errors (exceptions)
    • 8 - Interfacing Julia with other languages
    • 9 - Metaprogramming
    • 10 - Performance (parallelisation, debugging, profiling..)
    • 11 - Developing Julia packages
  • Useful packages
    • Plotting
    • DataFrames
    • JuMP
    • SymPy
    • Weave
    • LAJuliaUtils
    • IndexedTables
    • Pipe
Powered by GitBook
On this page
  • Weave
  • Subsubsection
  • References
  1. Useful packages

Weave

PreviousSymPyNextLAJuliaUtils

Last updated 4 years ago

Weave

allows to produce dynamic documents where the script that produce the output is embedded directly in the document, with optionally only the output rendered.

Save the document below in a file with extension jmd (e.g. testWeave.jmd)

---
title : Test of a document with embedded Julia code and citations
date : 5th September 2018
bibliography: biblio.bib
---
​

# Section 1 (leave two rows from document headers)
​
This is a strong affermation that needs a citation [see @Lecocq:2011, pp. 33-35; @Caurla:2013b, ch. 1].
​
@Lobianco:2016b [pp. 8] affirms something else.

## Subsection 1.1
​
This should print a plot. Note that I am not showing the source code in the final PDF:

```{julia;echo=false}
using Plots
pyplot()
plot(sin, -2pi, pi, label="sine function")

Here instead I will put in the PDF both the script source code and the output:

using DataFrames
df = DataFrame(
         colour = ["green","blue","white","green","green"],
         shape  = ["circle", "triangle", "square","square","circle"],
         border = ["dotted", "line", "line", "line", "dotted"],
         area   = [1.1, 2.3, 3.1, missing, 5.2]
    )
df

Note also that I can refer to variables defined in previous chunks (or "cells", following Jupyter terminology):

df[:colour]

Subsubsection

References

```

You can then "compile" the document (from within Julia) with:

using Weave; weave("testWeave.jmd", out_path = :pwd, doctype = "pandoc2pdf")

For a much more complete example see the .

To obtain the :

Page 1
Page 2

In Ubuntu Linux (but most likely also in other systems), weave needs pandora and LaTeX (texlive-xetex ) already installed in the system. If you use Ununtu, the version of pandora in the official repositories is too old. Use instead the deb available in .

While an updated, expanded and revised version of this chapter is available in "Chapter 11 - Utilities" of , this tutorial remains in active development.

Weave
Weave documentation
following pdf
https://github.com/jgm/pandoc/releases/latest
Antonello Lobianco (2019), "Julia Quick Syntax Reference", Apress