0

I'm looking to create a new command in my LaTeX template where I can define a long url, so that if that URL changes, I can change it in one place rather than every place it appears. It would also make it a lot easier and cleaner to insert links to places.

I'm using Markdown with a LaTeX template, so what I have in my Markdown is something like:

[Google](www.google.com)

What I would like to be able to do is something like:

[Google](\google)

except where the link inside \google is a link that is used throughout many documents, is possibly quite long, and liable to change.

So far I have tried to add:

\newcommand{\google}{www.google.com} 
and used it like this in my test document
[Google](\google)

but this produces a link that is trying to link to File:\\google.pdf

Any ideas how I can make this into a regular link?

  • Can you provide an MWE please? – Sango Jan 23 at 13:53
  • As far as i understand you have to use the latex_macros Extension, did you enable that extension? Macro definitions in LaTeX will be passed through as raw LaTeX only if latex_macros is not enabled. pandoc.org/MANUAL.html – Sango Jan 23 at 14:42
1

The comment as an answer: You need to enable the latex_macros extension to have the macros evaluated. From the Manual

Macro definitions in LaTeX will be passed through as raw LaTeX only if latex_macros is not enabled.

To do this, use something like this: pandoc test.tex --from markdown+latex_macros -o test.html

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.