I am writing out some parameters to JSON files using pythontex, but would like to add context information in form of section numbers (for example \thesection or \thesubsubsection, perhaps also the page number or other counters).
Is there a straightforward way to pass the values of the section counters to Python?
- Josef
\setpythontexcontextis used in the preamble to define a set of contextual data that is always available and up to date. So if you defined it to containsection=\thesection, then within Python codepytex.context.sectionwould always contain the current section number. – G. Poore Mar 01 '19 at 17:23