tags:

views:

133

answers:

6

This is a pretty basic question but... How do you write a url in Latex? The subscripts and everything else make the font look very strange when it compiles.

+2  A: 

very simple, use this:

\url{https://stackoverflow.com/}
sza
Assuming you have loaded the hyperref package or url package.
Rob Hyndman
+7  A: 

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 acheive.

mandaleeka
A: 

No, not clickable just to have the verbatim url written. Every time I try to write it, it formats oddly.

danzig
Can you explain what you mean by oddly?
mandaleeka
This should be a comment, not an answer..
Brendan Long
A: 

The http:// has some spaces, the subscripts for instance stack_overflow the o would would be written as an actual subscript, basically I want to be able to write it verbatim so that it looks normal but without having it link as a url (so presumably without hyperref package).

danzig
Without hyperref, use the \url macro. With hyperref, use \nolinkurl.
Joseph Wright
+2  A: 

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

Gabe
The `\verb` command is much less work than that!
Charles Stewart
The only problem with `\verb` is that it uses a typewriter font. I would have suggested `\verbatim` if that's what he asked for.
Gabe
A: 

A minimalist implementation of the \url macro that uses only Tex primitives: \def\url#1{\expandafter\string\csname #1\endcasname}. This url absolutely won't break over lines, though; the hyperref package is better for that.

Charles Stewart