Open Amphiboly opened 1 month ago
For reference, the result looks like this:
I tried creating an image in a note in Word, and I noticed that it footnotes.xml.rels we got a reference to the image:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="media/image1.jpeg"/></Relationships>
So I suspect that is the thing we're missing here.
Current pandoc in footnotes.xml:
<w:footnoteRef />
</w:r>
<w:r>
<w:t xml:space="preserve">
</w:t>
</w:r>
<w:r>
<w:drawing>
<wp:inline>
<wp:extent cx="5334000" cy="891742" />
<wp:effectExtent b="0" l="0" r="0" t="0" />
<wp:docPr descr="" title="" id="22" name="Picture" />
<a:graphic>
<a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/picture">
<pic:pic>
<pic:nvPicPr>
<pic:cNvPr descr="burton_shoulders.png" id="23" name="Picture" />
<pic:cNvPicPr>
<a:picLocks noChangeArrowheads="1" noChangeAspect="1" />
</pic:cNvPicPr>
</pic:nvPicPr>
<pic:blipFill>
<a:blip r:embed="rId21" />
<a:stretch>
<a:fillRect />
</a:stretch>
</pic:blipFill>
<pic:spPr bwMode="auto">
<a:xfrm>
<a:off x="0" y="0" />
<a:ext cx="5334000" cy="891742" />
</a:xfrm>
<a:prstGeom prst="rect">
<a:avLst />
</a:prstGeom>
<a:noFill />
<a:ln w="9525">
<a:noFill />
<a:headEnd />
<a:tailEnd />
</a:ln>
</pic:spPr>
</pic:pic>
</a:graphicData>
</a:graphic>
</wp:inline>
</w:drawing>
</w:r>
</w:p>
</w:footnote>
From the working document.xml:
<w:footnote w:id="1">
<w:p w14:paraId="619C6545" w14:textId="09E8AFA1" w:rsidR="008F1B46" w:rsidRDefault="008F1B46">
<w:pPr>
<w:pStyle w:val="FootnoteText"/>
</w:pPr>
<w:r>
<w:rPr>
<w:rStyle w:val="FootnoteReference"/>
</w:rPr>
<w:footnoteRef/>
</w:r>
<w:r>
<w:t xml:space="preserve"> This is a note.
</w:t>
</w:r>
<w:r>
<w:rPr>
<w:noProof/>
</w:rPr>
<w:drawing>
<wp:inline distT="0" distB="0" distL="0" distR="0" wp14:anchorId="3EA678A6" wp14:editId="472FEAD2">
<wp:extent cx="5943600" cy="3325495"/>
<wp:effectExtent l="0" t="0" r="0" b="1905"/>
<wp:docPr id="90137236" name="Picture 1" descr="A couple of people playing basketball

Description automatically generated"/>
<wp:cNvGraphicFramePr>
<a:graphicFrameLocks xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" noChangeAspect="1"/>
</wp:cNvGraphicFramePr>
<a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">
<a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/picture">
<pic:pic xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture">
<pic:nvPicPr>
<pic:cNvPr id="90137236" name="Picture 1" descr="A couple of people playing basketball

Description automatically generated"/>
<pic:cNvPicPr/>
</pic:nvPicPr>
<pic:blipFill>
<a:blip r:embed="rId1">
<a:extLst>
<a:ext uri="{28A0092B-C50C-407E-A947-70E740481C1C}">
<a14:useLocalDpi xmlns:a14="http://schemas.microsoft.com/office/drawing/2010/main" val="0"/>
</a:ext>
</a:extLst>
</a:blip>
<a:stretch>
<a:fillRect/>
</a:stretch>
</pic:blipFill>
<pic:spPr>
<a:xfrm>
<a:off x="0" y="0"/>
<a:ext cx="5943600" cy="3325495"/>
</a:xfrm>
<a:prstGeom prst="rect">
<a:avLst/>
</a:prstGeom>
</pic:spPr>
</pic:pic>
</a:graphicData>
</a:graphic>
</wp:inline>
</w:drawing>
</w:r>
</w:p>
</w:footnote>
I've tried adding the Relationship to footnotes.xml.rels and linking to that with <a:blip r:embed="(its id)"/>
, but still doesn't work.
Ah -- I had some syntax errors. This works, with
<?xml version="1.0" encoding="UTF-8"?><Relationships
xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
<Relationship Id="rId001"
Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/i\
mage" Target="media/rId21.png"/>
</Relationships>
So, to fix this, we need to do this:
For each image in a footnote, we need to add a Relationship to Relationships in footnotes.xml.rels. This should have a unique id and point to the media file as Target.
The <a:blip r:embed=
in footnotes.xml then needs to point to the Relationship's id rather than the media item's own id.
The current code is a bit ugly. We add References for every external link to footnotes.xml.rel, even for those not in footnotes. We can make this more targeted.
Discussed in https://github.com/jgm/pandoc/discussions/9602
This was initially reported under Pandoc 3.12.3 and persists through the current (3.14) version.