Hello,
I am working with a quarto book rendering rendering .qmd files into word.
I have a .bib reference file and I'm adding citations using: "@citation1 ". When rendering to html this adds a hyperlink to the refererence, however when rendering to word the citation is only plain text, e.g.: "Knuth (1984)" - there is no citation or numbering. A reference list is generated at the end.
Is there a way to add automatic numbering and hyperlinks to the references to the citations in word, similar as when generating a pdf from a latex document?
Carlos
cderv
July 26, 2023, 3:50pm
2
I think this requires better Pandoc support
opened 12:53PM - 03 Feb 22 UTC
enhancement
Similar to #7886, #7875 and #7840, but related to native citation/bibliography s… upport already present in Word (docx).
It would be nice if pandoc coud both read and write using docx's native support for citations.
~I'll update this with info on the XML parts involved~
<details>
<summary>relevant additions to document.xml (long text)</summary>
```xml
<w:r w:rsidRPr="00FA6B19">
<w:rPr>
<w:lang w:val="en-GB"/>
</w:rPr>
<w:t>Sample file to demonstrate native c</w:t>
</w:r>
<w:r>
<w:rPr>
<w:lang w:val="en-GB"/>
</w:rPr>
<w:t>itation with docx/Word</w:t>
</w:r>
<w:sdt>
<w:sdtPr>
<w:rPr>
<w:lang w:val="en-GB"/>
</w:rPr>
<w:id w:val="141786920"/>
<w:citation/>
</w:sdtPr>
<w:sdtContent>
<w:r w:rsidR="0054542B">
<w:rPr>
<w:lang w:val="en-GB"/>
</w:rPr>
<w:fldChar w:fldCharType="begin"/>
</w:r>
<w:r w:rsidR="0054542B" w:rsidRPr="0054542B">
<w:rPr>
<w:lang w:val="en-GB"/>
</w:rPr>
<w:instrText xml:space="preserve"> CITATION Exa22 \l 3082 </w:instrText>
</w:r>
<w:r w:rsidR="0054542B">
<w:rPr>
<w:lang w:val="en-GB"/>
</w:rPr>
<w:fldChar w:fldCharType="separate"/>
</w:r>
<w:r w:rsidR="0054542B">
<w:rPr>
<w:noProof/>
<w:lang w:val="en-GB"/>
</w:rPr>
<w:t xml:space="preserve"> </w:t>
</w:r>
<w:r w:rsidR="0054542B" w:rsidRPr="0054542B">
<w:rPr>
<w:noProof/>
<w:lang w:val="en-GB"/>
</w:rPr>
<w:t>[1]</w:t>
</w:r>
<w:r w:rsidR="0054542B">
<w:rPr>
<w:lang w:val="en-GB"/>
</w:rPr>
<w:fldChar w:fldCharType="end"/>
</w:r>
</w:sdtContent>
</w:sdt>
<w:r>
<w:rPr>
<w:lang w:val="en-GB"/>
</w:rPr>
<w:t>.</w:t>
</w:r>
</w:p>
<w:p w14:paraId="48C4A947" w14:textId="73C51BA1" w:rsidR="0054542B" w:rsidRDefault="0054542B">
<w:pPr>
<w:rPr>
<w:lang w:val="en-GB"/>
</w:rPr>
</w:pPr>
<w:r>
<w:rPr>
<w:lang w:val="en-GB"/>
</w:rPr>
<w:t>A second reference</w:t>
</w:r>
<w:sdt>
<w:sdtPr>
<w:rPr>
<w:lang w:val="en-GB"/>
</w:rPr>
<w:id w:val="876506361"/>
<w:citation/>
</w:sdtPr>
<w:sdtContent>
<w:r>
<w:rPr>
<w:lang w:val="en-GB"/>
</w:rPr>
<w:fldChar w:fldCharType="begin"/>
</w:r>
<w:r>
<w:instrText xml:space="preserve"> CITATION Boo22 \l 3082 </w:instrText>
</w:r>
<w:r>
<w:rPr>
<w:lang w:val="en-GB"/>
</w:rPr>
<w:fldChar w:fldCharType="separate"/>
</w:r>
<w:r>
<w:rPr>
<w:noProof/>
</w:rPr>
<w:t xml:space="preserve"> </w:t>
</w:r>
<w:r w:rsidRPr="0054542B">
<w:rPr>
<w:noProof/>
</w:rPr>
<w:t>[2]</w:t>
</w:r>
<w:r>
<w:rPr>
<w:lang w:val="en-GB"/>
</w:rPr>
<w:fldChar w:fldCharType="end"/>
</w:r>
</w:sdtContent>
</w:sdt>
</w:p>
<w:sdt>
<w:sdtPr>
<w:id w:val="-1157219546"/>
<w:docPartObj>
<w:docPartGallery w:val="Bibliographies"/>
<w:docPartUnique/>
</w:docPartObj>
</w:sdtPr>
<w:sdtEndPr>
<w:rPr>
<w:rFonts w:asciiTheme="minorHAnsi" w:eastAsiaTheme="minorHAnsi" w:hAnsiTheme="minorHAnsi" w:cstheme="minorBidi"/>
<w:color w:val="auto"/>
<w:sz w:val="22"/>
<w:szCs w:val="22"/>
</w:rPr>
</w:sdtEndPr>
<w:sdtContent>
<w:p w14:paraId="7EA662A7" w14:textId="7F438CF5" w:rsidR="0054542B" w:rsidRDefault="0054542B">
<w:pPr>
<w:pStyle w:val="Heading1"/>
</w:pPr>
<w:proofErr w:type="spellStart"/>
<w:r>
<w:t>Bibliography</w:t>
</w:r>
<w:proofErr w:type="spellEnd"/>
</w:p>
<w:sdt>
<w:sdtPr>
<w:id w:val="111145805"/>
<w:bibliography/>
</w:sdtPr>
<w:sdtContent>
<w:p w14:paraId="0EDBCA8E" w14:textId="77777777" w:rsidR="0054542B" w:rsidRDefault="0054542B">
<w:pPr>
<w:rPr>
<w:noProof/>
</w:rPr>
</w:pPr>
<w:r>
<w:fldChar w:fldCharType="begin"/>
</w:r>
<w:r>
<w:instrText xml:space="preserve"> BIBLIOGRAPHY </w:instrText>
</w:r>
<w:r>
<w:fldChar w:fldCharType="separate"/>
</w:r>
</w:p>
<w:tbl>
<w:tblPr>
<w:tblW w:w="5000" w:type="pct"/>
<w:tblCellSpacing w:w="15" w:type="dxa"/>
<w:tblCellMar>
<w:top w:w="15" w:type="dxa"/>
<w:left w:w="15" w:type="dxa"/>
<w:bottom w:w="15" w:type="dxa"/>
<w:right w:w="15" w:type="dxa"/>
</w:tblCellMar>
<w:tblLook w:val="04A0" w:firstRow="1" w:lastRow="0" w:firstColumn="1" w:lastColumn="0" w:noHBand="0" w:noVBand="1"/>
</w:tblPr>
<w:tblGrid>
<w:gridCol w:w="322"/>
<w:gridCol w:w="8182"/>
</w:tblGrid>
<w:tr w:rsidR="0054542B" w14:paraId="1BEE1D64" w14:textId="77777777">
<w:trPr>
<w:divId w:val="2141799766"/>
<w:tblCellSpacing w:w="15" w:type="dxa"/>
</w:trPr>
<w:tc>
<w:tcPr>
<w:tcW w:w="50" w:type="pct"/>
<w:hideMark/>
</w:tcPr>
<w:p w14:paraId="20B73523" w14:textId="505603C7" w:rsidR="0054542B" w:rsidRDefault="0054542B">
<w:pPr>
<w:pStyle w:val="Bibliography"/>
<w:rPr>
<w:noProof/>
<w:sz w:val="24"/>
<w:szCs w:val="24"/>
</w:rPr>
</w:pPr>
<w:r>
<w:rPr>
<w:noProof/>
</w:rPr>
<w:t xml:space="preserve">[1] </w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="0" w:type="auto"/>
<w:hideMark/>
</w:tcPr>
<w:p w14:paraId="2F7E50CA" w14:textId="77777777" w:rsidR="0054542B" w:rsidRDefault="0054542B">
<w:pPr>
<w:pStyle w:val="Bibliography"/>
<w:rPr>
<w:noProof/>
</w:rPr>
</w:pPr>
<w:r w:rsidRPr="0054542B">
<w:rPr>
<w:noProof/>
<w:lang w:val="en-GB"/>
</w:rPr>
<w:t xml:space="preserve">E. author, «Name of the reference,» 31 1 2022. </w:t>
</w:r>
<w:r>
<w:rPr>
<w:noProof/>
</w:rPr>
<w:t>[En línea]. Available: https://www.example.com.</w:t>
</w:r>
</w:p>
</w:tc>
</w:tr>
<w:tr w:rsidR="0054542B" w:rsidRPr="0054542B" w14:paraId="7DC11F74" w14:textId="77777777">
<w:trPr>
<w:divId w:val="2141799766"/>
<w:tblCellSpacing w:w="15" w:type="dxa"/>
</w:trPr>
<w:tc>
<w:tcPr>
<w:tcW w:w="50" w:type="pct"/>
<w:hideMark/>
</w:tcPr>
<w:p w14:paraId="18EA4E29" w14:textId="77777777" w:rsidR="0054542B" w:rsidRDefault="0054542B">
<w:pPr>
<w:pStyle w:val="Bibliography"/>
<w:rPr>
<w:noProof/>
</w:rPr>
</w:pPr>
<w:r>
<w:rPr>
<w:noProof/>
</w:rPr>
<w:t xml:space="preserve">[2] </w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="0" w:type="auto"/>
<w:hideMark/>
</w:tcPr>
<w:p w14:paraId="6FC543A6" w14:textId="77777777" w:rsidR="0054542B" w:rsidRPr="0054542B" w:rsidRDefault="0054542B">
<w:pPr>
<w:pStyle w:val="Bibliography"/>
<w:rPr>
<w:noProof/>
<w:lang w:val="en-GB"/>
</w:rPr>
</w:pPr>
<w:r w:rsidRPr="0054542B">
<w:rPr>
<w:noProof/>
<w:lang w:val="en-GB"/>
</w:rPr>
<w:t xml:space="preserve">B. author, Book title, Atlantis: Lost City, 2022. </w:t>
</w:r>
</w:p>
</w:tc>
</w:tr>
</w:tbl>
<w:p w14:paraId="74E0918F" w14:textId="77777777" w:rsidR="0054542B" w:rsidRPr="0054542B" w:rsidRDefault="0054542B">
<w:pPr>
<w:divId w:val="2141799766"/>
<w:rPr>
<w:rFonts w:eastAsia="Times New Roman"/>
<w:noProof/>
<w:lang w:val="en-GB"/>
</w:rPr>
</w:pPr>
</w:p>
<w:p w14:paraId="50239960" w14:textId="0571F152" w:rsidR="0054542B" w:rsidRDefault="0054542B">
<w:r>
<w:rPr>
<w:b/>
<w:bCs/>
<w:noProof/>
</w:rPr>
<w:fldChar w:fldCharType="end"/>
</w:r>
</w:p>
```
</details>
There are also references in `[Content_Types].xml`
<Override PartName="/customXml/itemProps1.xml" ContentType="application/vnd.openxmlformats-officedocument.customXmlProperties+xml"/>
In `document.xml.rels`
<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml" Target="../customXml/item1.xml"/>
In `styles.xml`
```xml
<w:style w:type="paragraph" w:styleId="Bibliography">
<w:name w:val="Bibliography"/>
<w:basedOn w:val="Normal"/>
<w:next w:val="Normal"/>
<w:uiPriority w:val="37"/>
<w:unhideWhenUsed/>
<w:rsid w:val="0054542B"/>
</w:style>
```
In `webSettings.xml` a bunch of ids (the file was mostly empty before using citations)
<details>
<summary>New file in customXml/item1.xml (long text)</summary>
```xml
<?xml version="1.0" standalone="no"?>
<b:Sources xmlns:b="http://schemas.openxmlformats.org/officeDocument/2006/bibliography" xmlns="http://schemas.openxmlformats.org/officeDocument/2006/bibliography" SelectedStyle="\IEEE2006OfficeOnline.xsl" StyleName="IEEE" Version="2006">
<b:Source>
<b:Tag>Exa22</b:Tag>
<b:SourceType>DocumentFromInternetSite</b:SourceType>
<b:Guid>{85BC4F8D-91C0-444D-B378-E4A48878B53E}</b:Guid>
<b:Author>
<b:Author>
<b:NameList>
<b:Person>
<b:Last>author</b:Last>
<b:First>Example</b:First>
</b:Person>
</b:NameList>
</b:Author>
</b:Author>
<b:Title>Name of the reference</b:Title>
<b:Year>2022</b:Year>
<b:Month>1</b:Month>
<b:Day>31</b:Day>
<b:URL>https://www.example.com</b:URL>
<b:RefOrder>1</b:RefOrder>
</b:Source>
<b:Source>
<b:Tag>Boo22</b:Tag>
<b:SourceType>Book</b:SourceType>
<b:Guid>{39AEE514-A3E0-45BD-A372-E8FAF3B04D71}</b:Guid>
<b:Title>Book title</b:Title>
<b:Year>2022</b:Year>
<b:Author>
<b:Author>
<b:NameList>
<b:Person>
<b:Last>author</b:Last>
<b:First>Book</b:First>
</b:Person>
</b:NameList>
</b:Author>
</b:Author>
<b:City>Atlantis</b:City>
<b:Publisher>Lost City</b:Publisher>
<b:RefOrder>2</b:RefOrder>
</b:Source>
</b:Sources>
```
</details>
New file `customXml/itemProps1.xml`
```xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<ds:datastoreItem ds:itemID="{5D4D6755-6A11-4FB3-A355-55FD8D503966}" xmlns:ds="http://schemas.openxmlformats.org/officeDocument/2006/customXml">
<ds:schemaRefs>
<ds:schemaRef ds:uri="http://schemas.openxmlformats.org/officeDocument/2006/bibliography"/>
</ds:schemaRefs>
</ds:datastoreItem>
```
and `customXml/_rels/item1.xml.rels`
```xml
<?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/customXmlProps" Target="itemProps1.xml"/>
</Relationships>
```
The sample file: [pandoc_7889_ref.docx](https://github.com/jgm/pandoc/files/7994797/pandoc_7889_ref.docx)
Thanks!
system
Closed
August 16, 2023, 3:51pm
3
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed. If you have a query related to it or one of the replies, start a new topic and refer back with a link.