How do you write a URL in Latex?
The subscripts and everything else make the font look very strange when it compiles.
How do you write a URL in Latex?
The subscripts and everything else make the font look very strange when it compiles.
You can use \url
\usepackage{hyperref}
\url{http://stackoverflow.com/}
&
or _
automatically, when its part of the url? Those characters are often getting used in URLs as separator for dynamic values. –
Acaulescent \href{https://example.com}{links label}
–
Lobito You just need to escape characters that have special meaning: # $ % & ~ _ ^ \ { }
So
http://stack_overflow.com/~foo%20bar#link
would be
http://stack\_overflow.com/\~foo\%20bar\#link
\verb
command is much less work than that! –
Soonsooner \verb
is that it uses a typewriter font. I would have suggested \verbatim
if that's what he asked for. –
Phonotypy \url{https://asdfg.com\#123}
produces #
in text, however, the actual link it produces is https://asdfg.com%23123
. –
Kilogrammeter Here is all the information you need in order to format clickable hyperlinks in LaTeX:
http://en.wikibooks.org/wiki/LaTeX/Hyperlinks
Essentially, you use the hyperref
package and use the \url
or \href
tag depending on what you're trying to achieve.
A minimalist implementation of the \url
macro that uses only Tex primitives:
\def\url#1{\expandafter\string\csname #1\endcsname}
This url absolutely won't break over lines, though; the hypperef package is better for that.
© 2022 - 2024 — McMap. All rights reserved.
_
s in your URLs, Latex will not be nice to you. – Soonsooner