In Markdown, you can do


In LaTeX, I've tried


But that doesn't work, and I'm tired of having long URLs in my document. How do you label and reference a URL?

  • 2
    FWIW, this is the default style in ConTeXt: see documentation for \useURL – Aditya Jun 12 '13 at 13:43
  • Is there any package I can import to get this functionality in regular LaTeX? – Scott Jun 12 '13 at 13:49

Here a small suggestion:



   \string\expandafter\string\gdef\string\csname\space markdownlink#1\string\endcsname{#2}%

  {\typeout{Undefined ref~markdownlink#1}\textbf{#2}}%



The procedure can be simplified if you define your links in the preamble. Then you don't need to write something to the aux file.


A simple solution. In my document preamble, I wrote:


Then, when I wanted to reference it, I used

\href{\sage}{This text will be linked to sagemath.org}

And I've since written a package called latex-markdown-linking to include similar formatting.

\usepackage{hyperref} % required by linking.sty
\usepackage{linking}  % include linking.sty in your compile folder

% Markdown equivalent: [Bode Miller]:https://...
\SSdefine{Bode Miller}{https://en.wikipedia.org/wiki/Bode_Miller}

% Markdown equivalent: [Bode Miller] has won...
\SSlink{Bode Miller} has won 6 Olympic medals and 5 World Cup medals.

will give you

Bode Miller has won 6 Olympic medals and 5 World Cup medals.

  • LaTeX Error: FIle linkg.sty not found. When trying to import "linking" on overleaf. – Sebastian Nielsen Sep 2 '20 at 9:40

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.