ubcecon / computing_and_datascience

Sandbox and workspace for computing and datascience infrastructure and course materials.
MIT License
8 stars 12 forks source link

Weave.jl analysis as a backup workflow #71

Closed jlperla closed 5 years ago

jlperla commented 6 years ago

With Weave.jl, we need to see if the following are possible (and if they are easy). Where it is not easily possible, we can discuss alternatives.

You can take over and replace my old attempts in https://github.com/ubcecon/computing_and_datascience/blob/master/julia_sandbox/Weave/README.md and https://github.com/ubcecon/computing_and_datascience/blob/master/julia_sandbox/Weave/

Basic Setup:

Things to check:

Some of the things that I am pretty sure are not there, but we can discuss with others about:

arnavs commented 6 years ago

Sounds good @jlperla. Thanks for breaking this down for me.

jlperla commented 6 years ago

Also note this PR: https://github.com/mpastell/Weave.jl/pull/126 which mentions https://github.com/Evizero/Augmentor.jl/blob/master/docs/exampleweaver.jl

arnavs commented 6 years ago

OK, @jlperla, I've spent some time with this and think this is done. Long story short, essentially all of this stuff but PDF is easily possible. I put an example in the folder under economics_examples.jmd.

Specifically:

  1. There's great LaTeX support for things like numbered systems of equations, referencing equations by label, splitting equations over several lines using align, etc.

  2. Writing to HTML is flawless. Writing to Jupyter doesn't chunk out the LaTeX, so you'd need to post-process it. The tangled option works great (just spits out all the Julia code as if it was in one REPL), so we could run that to test.

  3. There's support for "silent" code (like boilerplate for setup). There's also support for capturing plot output and resizing it.

  4. Headers and footers work great; it's just editing HTML or TeX, using the variables we define in the .jmd and the syntax for calling them given in mustache.jl.

The story on PDF, I think, is twofold. First, there's running it straight with "md2pdf", which I believe fails partly (mainly?) because LaTeX needs to be in shell-escape mode (something to do with minted). I guess we could hack a post-process to enable that (I think you just add a brief note at the top of the document).

If you try and download the PDF from a notebook, it complains because nbconvert can't find Inkscape, which is used to convert SVG images to PDF. People have reported success by installing inscape using Conda, changing the svg2pdf.py file inside nbconvert to point to the install, and downloading.

jlperla commented 6 years ago

Sounds great. We can discuss tomorrow. How is it executing the latex? Can you pass in command line parameters? I suspect there is a way to get the shell escape working...

arnavs commented 6 years ago

Will check re that. I tried running it manually escaped a while back (i.e., go to the repo, do pdflatex [shell-escape flag] ...). I suspect there may be some other roadblocks, but this is the nearest one.

jlperla commented 6 years ago

@Nosferican this is where we discussed some of this.

A few thoughts: