access notebook filename in custom latex exporter

21 views
Skip to first unread message

John Kitchin

unread,
Oct 8, 2016, 12:42:27 PM10/8/16
to Project Jupyter
Hi all,

I am building a custom LaTeX template for nbconvert.

I would like to have this line near the end:

\attachfile{filename}

where filename is the name of the ipython notebook. Any idea on how to get that variable in the jinja template?

Thanks!

Thomas Kluyver

unread,
Oct 8, 2016, 4:52:03 PM10/8/16
to Project Jupyter
On 8 October 2016 at 17:42, John Kitchin <johnrk...@gmail.com> wrote:
where filename is the name of the ipython notebook. Any idea on how to get that variable in the jinja template?

Looking at the code, I think one of these should do it:

resources['metadata']['name']
resources['metadata']['path']

John Kitchin

unread,
Oct 8, 2016, 5:51:52 PM10/8/16
to jup...@googlegroups.com
Thanks! That was the ticket.

Here is what I ended up using:

((( resources['metadata']['name'] + '.ipynb'))): \attachfile{((( resources['metadata']['name'] + '.ipynb')))} \\

The path seemed to be an empty string for me, but the name was ok.
--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu
Reply all
Reply to author
Forward
0 new messages