Search code examples
htmlprintinglatexpandocxelatex

How to get links output in a printer-friendly fashion, e.g. as numbered-citation style incuding a list of links at the end?


pandoc turns input such as

See [that site](http://my.link)

into

See that site

which means the link information will get lost in printing. I would like to get some printer-friendly version, i.e. the links numbered

See [1]

(code See [[1]](http://my.link "that site")

and at the end (or optionally as a footnote when using to get a pdf) a summary of all links, i.e.

[1] that site: http://my.link

(whether the original link title shall be in this list or not is optional).

How can this be achieved? Via a filter or is there already some switch for that?


Solution

  • You can use footnotes:

    Here is a footnote reference[^1]
    
    [^1]: Here is the [footnote](http://my.link)
    

    which will also result in footnotes in HTML output. For more flexibility, see this answer, e.g. this will only work for LaTeX/PDF output:

    pandoc -o myfile.pdf -V links-as-notes=true myfile.md
    

    Edit: this works only if you have the following in your template (from the default-template):

    $if(links-as-notes)$
    % Make links footnotes instead of hotlinks:
    \renewcommand{\href}[2]{#2\footnote{\url{#1}}}
    $endif$