JunoLab / Weave.jl

Scientific reports/literate programming for Julia
http://weavejl.mpastell.com
MIT License
831 stars 95 forks source link

out-of-order weaving #161

Open ssfrr opened 5 years ago

ssfrr commented 5 years ago

I have a block of code that defines a function necessary for my document. It needs to be run before the blocks where the function is used, but I want to include the code as an appendix at the end, rather than a big block at the beginning.

Is that possible?

ssfrr commented 5 years ago

I figured out an OK hack for this. I put my code in a separate file util.jl. Then at the top of my document I put:

```julia; echo=false; results="hidden"
include("util.jl")
```

and in my appendix at the end I have:

```julia; echo=false; line_width=90
print(String(read("util.jl")))
```

The downside is that the code doesn't get displayed with syntax highlighting.