sisl / tufte_algorithms_book

A template for textbooks in the same style as Algorithms for Optimization
350 stars 66 forks source link

Weave inserts sandbox module #27

Open jlapeyre opened 3 years ago

jlapeyre commented 3 years ago

Weave creates a kind of gensym module or namespace that pollutes the rendered latex

\begin{juliaconsole}
struct A end
A()
\end{juliaconsole}

Renders as this:

julia> struct A end
julia> A()
Main.##WeaveSandBox#245.A()

Did you encounter this in your book? Is there a way around it?

tawheeler commented 3 years ago

I don't know that I've tried printing a function in a juliaconsole. I'm not familiar with the workings of the weave sandbox, but maybe you can overwrite Base.show(io::IO, ::MIME"image/svg+xml, f::Main.##WeaveSandBox#245.A())" or similar?

Might also be worth asking a question on the Weave package github.

jlapeyre commented 3 years ago

Well, this happens with any identifier: variable, function, whatever. It is qualified because the execution is in a kind of temporary namespace. I was hoping maybe you had seen it. I'll look into Weave. How to configure it in a way that works with building the book might be a chore. I will post here if I solve it.