pandocpandoc-citeproc

Pandoc conversion to PDF not providing colored hyptertext links


Consider the following snippet of a PDF generated from pandoc by way of latex.

Were you able to identify the hypertext links in there? Neither was I... It turns out that the second Kaplan Meier has a fully functional link to an external site. But how do we divine that?

Note that the following option is already in place in the pandoc preamble - without which the hyperlink would not work at all:

link-citations: true

Short of a "real" solution I'll need to hack something to make hints for the links - possibly via font manipulations.


Solution

  • If you use a recent version of Pandoc (latest is v2.7.3), just add (for example) these to the commandline:

    -V colorlinks=true \
    -V linkcolor=blue \
    -V urlcolor=red \
    -V toccolor=gray
    

    No need to fiddle with the preamble!

    You can investigate the built-in LaTeX template shipping with your own Pandoc by this command:

    pandoc -D latex | less
    

    Then search for link, url, color etc. to see which variables are pre-defined there. Or:

    pandoc -D latex | grep --color -E '(links|color|url|file)'
    

    will give you an idea what other "links" you may want to manipulate.