Documentation of Notebook Helper Functions

Provides the pdflatex_notebook_wrapper shell/dos command, which you run instead of your normal Latex command to build a lab notebook. The results of python environments are cached and only re-run if the code changes, even if the python environments are moved around. This makes the compilation of a Latex lab notebook extremely efficient.

pyspecdata.latexscripts.cache_output_if_needed(scriptnum_as_str, hashstring, showcode=False, show_error=True)

if needed, run the python script numbered by scriptnum_as_str that hashes to hashstring, and output the result to the cache ONLY

pyspecdata.latexscripts.cached_filename(hashstring, returndir=False)

this sets the format for where the cached file is stored we use the first two characters as directory names (so there are just 16 of them

pyspecdata.latexscripts.det_new_pdf_name(thisargv)

based on an original tex or pdf name, determine the original basename (i.e., no extension), as well as one with the final word after the underscore removed

pyspecdata.latexscripts.main()

This looks for scripts/scriptsUsed.csv inside the notebook directory, and checks whether or not it should be run if a command line argument of “flush” is passed, it flushes that script number from the cache

pyspecdata.latexscripts.sha_string(script)

convert the sha hash to a string

pyspecdata.latexscripts.wraplatex()

runs the python scripts after running latex also creates a copy of latex without the final portion under the underscore This prevents the viewer from hanging while it’s waiting for a refresh. This can be used in combination with wrapviewer() and latexmk by using a ~/.latexmkrc file that looks like this:

If you pass the --xelatex argument, xelatex is used instead of pdflatex (note that if you’re using latexmk, you need to add this in the latexmkrc file).

$pdflatex=q/pdflatex_notebook_wrapper %O -synctex=1 %S/;# calls this
function $pdf_previewer=q/pdflatex_notebook_view_wrapper/;# calls the
wrapviewer function
pyspecdata.latexscripts.wrapviewer()

see wraplatex