Disable hyperlink generation when converting docx -> tex via pandoc
Asked Answered
S

0

6

I have a single docx file with a lot of cross-references. However, most of these cross-references are spurious. I'd like to convert it to LaTeX but that results in a many \hyperlink commands scattered throughout the document. I'd like pandoc to convert the file but not create hyperlinks.

pandoc -s myfile.docx -o myfile.tex

I searched for hyperref, hyperlink, and cross-reference in https://pandoc.org/MANUAL.html but the only hits were comments that hyperlinks would be generated, not advice about how to avoiding creating them.

Scrummage answered 11/12, 2017 at 6:16 Comment(6)
Not sure whether there is a built-in way, but you can always write a simple pandoc filter to remove the links.Colonial
Could you give an example of what you mean by a "spurious" cross-reference in docx?Huzzah
A link to Figure 1 under text “see fig. 2”Scrummage
Is this link spurious because there's no corresponding anchor in the file pandoc produces, or just because you'd rather not have this linked?Huzzah
It's spurious because the author or Word made a mistake and linked the wrong caption. But that's just one cause: other spurious links include links to a table of contents (which will just be replaced by \tableofcontents), links to endnote references which have since been removed, links to the wrong entry in the bibliography, and hyperlinks that simply have no clear anchor or purpose. Of course, many of them are correct, but enough are wrong that I'd rather not have them.Scrummage
As a work around I remove all hyperlinks in the Word document at once with: crtl + a then crtl + shift + F9 (Mac: cmd + a then cmd + shift + F9) (Source: extendoffice.com/documents/word/…)Cromwell

© 2022 - 2024 — McMap. All rights reserved.