Open jlapeyre opened 3 years ago
In our book we have a custom script that takes any code in a juliaverbatim
block and puts it into a Julia package source file. We add a jlcode
block that loads this package:
\begin{jlcode}
using OurPackage
\end{jlcode}
You could do something similar. The pythontex docs state that the pyconcode
will execute but typeset nothing, so maybe jlconcode
could be used to load the package prior to your juliaconsole
block:
\begin{jlconcode}
using YourPackage
\end{jlconcode}
\begin{juliaconsole}
... use code ...
\end{juliaconsole}
There is an optional session id parameter as well. I think it defaults to a single session, but it may need to be specified.
I think @mossr has some experience with this.
What is a good method for displaying code in a document and then using it in a
juliaconsole
block? The following seems to work, but I suspect there is a simpler way.Then I copy the code in the
juliablock
by hand into a file calledexample_code.jl
. Then I do this: