5

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.

Hugh
  • 15,521
  • 12
  • 57
  • 100
  • 2
    Not sure whether there is a built-in way, but you can always write a simple pandoc filter to remove the links. – mb21 Dec 11 '17 at 09:55
  • Could you give an example of what you mean by a "spurious" cross-reference in docx? – John MacFarlane Dec 11 '17 at 21:35
  • A link to Figure 1 under text “see fig. 2” – Hugh Dec 11 '17 at 22:10
  • 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? – John MacFarlane Dec 12 '17 at 00:03
  • 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. – Hugh Dec 12 '17 at 00:07
  • 1
    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: https://www.extendoffice.com/documents/word/635-word-remove-all-hyperlinks.html) – thando Feb 28 '19 at 08:18

0 Answers0