manubot / rootstock

Clone me to create your Manubot manuscript
https://manubot.github.io/rootstock/
Other
452 stars 178 forks source link

Figure tooltips don't behave as expected with pandoc-crossref #207

Open slochower opened 5 years ago

slochower commented 5 years ago

This comment references https://github.com/manubot/rootstock/pull/191#issuecomment-483934398, where there are more details.

In brief: subfigures added using the pandoc-crossref filter, where figures can be created by directly using <div>s to group multiple panels together, do not play nicely with the tooltips.

  1. Hovering over the tooltip shows an embedded preview of the entire page.
  2. Captions for these directly created <div>s are not styled the same as "normal" figure captions.

If possible, it'd be nice to get the behavior of these figures and "normal" figures consistent, due to the expanded flexibility afforded by pandoc-crossref over pandoc-fignos.

dhimmel commented 5 years ago

Reproducing @slochower's original report form https://github.com/manubot/rootstock/pull/191#issuecomment-483934398:


I'm running an unsupported mix of Manubot features, including replacing the usual figure filter pandoc-fignos with pandoc-crossref due to the latter's subigure support.

See this manuscript for reference: https://slochower.github.io/smirnoff-host-guest-manuscript/v/a2fec1ee6bf387a1e664186f8ddd2c15facadcf7/

A tooltip that points to a plain figure, like Figure 1, works as expected. A tooltip that points to a combined subfigure, like Figure 2, does not work as expected -- the preview basically shows an embedded copy of the entire HTML page.

The subfigures are created like so:

<div id="fig:atom-names">
![](images/atom-names-trimer.png){width=3.5in}
![](images/gaff-atom-types.png){width=3.5in}

Atom names (left) and GAFF atom types (right) for a glucose monomer in αCD shown with two flanking monomers. The remaining three glucose monomers are hidden for clarity.
</div>

The subfigure tooltips do link to anchoring elements (#...) on the page that do resolve to the right place (although I'm not sure if this is due to a quirk of my setup or not, sometimes I have to refresh twice to go to the right place on the page). Note that I'm using one combined caption for both subfigures, not individual subfigure captions that would go between the []s.

Just curious if you think adjusting the tooltips to deal with this would be easy and quick or not.

A slightly related point is that the figure and subfigure captions in the generated PDF are styled differently. The plain figure captions are reduced in size, but the subfigure captions are not, probably because they use different style markup (which you can check in the HTML, too).