You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
\begin{example}
\begin{juliablock}
some code
\end{juliablock}
\caption{example code}
\end{example}
Then I copy the code in the juliablock by hand into a file called example_code.jl.
Then I do this:
\begin{juliaconsole}
include("example_code.jl"); nothing... use code...\end{juliaconsole}
The text was updated successfully, but these errors were encountered:
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.
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:
The text was updated successfully, but these errors were encountered: