开发者

How to write URLs in Latex? [closed]

开发者 https://www.devze.com 2022-12-31 15:02 出处:网络
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. 开发者_高级运维

This question does not appear to be about programming within the scope defined in the help center.

Closed 9 years ago.

Improve this question

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/}


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消