From: Fernando P. <fpe...@gm...> - 2016-01-30 01:20:19
|
On Fri, Jan 29, 2016 at 8:25 AM, Andreas Mueller <t3...@gm...> wrote: > Thanks for your input Fernando. > I thought about cross-posting to Jupyter, but I'm glad you also saw it > here :) > That would help, but not solve all problems. > I guess the Figure could hold a tag for referencing, too. It would be nice > to get a tag and caption from matplotlib. > Maybe Benjamin's reply would help with that. But it sounds like the figure > has a single string attached (which is more the tag). > I guess I can do > IPython.display.Figure(matplotlib_figure, caption="stuff", tag="tag") > That would be acceptable, I think. > Yes, I'd forgotten about the label ("label" is the LaTeX name for what you're calling "tag" here). > But how do I reference that in a markup cell? [maybe I should move that > question to the jupyter list, though] > Yup, this is the slightly trickier part. A sketch of the solution, we need to: - generate a local anchor element for the labeled output. That's the easier part, it would be the job of the displayed output from this hypothetical Figure() object. It needs to wrap the output in `<a name=label>... </a>`. - For markdown referencing, you simply do [link text](#label). - The problem would be latex conversion: by default, the above is converted to \protect\hyperlink{label}{link text} where as you want a \ref{label} call instead. - You also want this to generate the Internal cross-referencing is one of Markdown's main weaknesses for complex more document-oriented workflows that aren't purely HTML oriented. Markdown is really a thin wrapper around HTML, so it doesn't expose the rich labeling/referencing semantics of rST or LaTeX. I didn't say this was a done deal, and there might be some tricky edges to it :) Cheers f -- Fernando Perez (@fperez_org; http://fperez.org) fperez.net-at-gmail: mailing lists only (I ignore this when swamped!) fernando.perez-at-berkeley: contact me here for any direct mail |