Pythontex and Julia


#1

Pythontex provides very nice support for typesetting documents with Julia code embedded—however, it does not support the Julia console, like it does for Python. See sec. 3 here for an example. It looks like there are a few options for adding this functionality. I am hoping the community might have some thoughts on the second option proposed here.


#2

FYI, a good Julia alternative if you need one right now is Weave.jl:

Though I think the Jupyter kernal approach for Pythontex would be a good way to expand the functionality.


#3

You can also use Jupyter/IJulia with nbconvert to output LaTeX. (For things like course notes, I usually leave documents in the form of notebooks so that students can easily run them.)


#4

Thanks guys! Weave.jl looks really nice and I use Julia notebooks for my lectures. I’m working, however, on a textbook that is all done in latex with the tufte-book style.


#5

Weave.jl supports latex so you can use it with tufte-book style as well. You could also use Weave.jl to implement the second option for Pythontex.

Open an issue on Weave repo if something doesn’t work as it should.


#6

For Pythontex option 2: if you have julia file minitex.jl with the following contents:

#+ term=true
x = 1:10
y = Dict(:language => "julia")

you can call weave:

using Weave
julia> weave("minitex.jl", "tex")
INFO: Weaving chunk 1 from line 2
INFO: Report weaved to minitex.tex

And minitex.tex contains the output:

\begin{juliaterm}
julia> x = 1:10
1:10

julia> y = Dict(:language => "julia")
Dict{Symbol,String} with 1 entry:
  :language => "julia"

\end{juliaterm}