忽略href中的%字符

时间:2017-07-12 18:06:13

标签: latex special-characters href

我想使用\href来缩短网址。 我目前的文件如下:

\documentclass[11pt]{article}
\usepackage[dvipsnames]{xcolor}
\usepackage[colorlinks=true,urlcolor=Blue]{hyperref}
...
\begin{document}
\href{https://www.flickr.com/search/?safe_search=1&license=2%2C3%2C4%2C5%2C6%2C9&dimension_search_mode=min&height=640&width=640&media=photos}{https://www.flickr.com/search/?license=2%2C3%2C4%2C5%2C6%2C9}
\end{document}

我想要的输出是网址https://www.flickr.com/search/?license=2%2C3%2C4%2C5%2C6%2C9,点击后会链接到长链接。

目前,latex会将网址中的%解释为评论的开头,并且根本不会显示网址。

1 个答案:

答案 0 :(得分:1)

我在Ubuntun的TeXstudio中对它进行了测试,当你在%前面放一个反斜杠时,它似乎有效。 % => \%

\documentclass[11pt]{article}
\usepackage[dvipsnames]{xcolor}
\usepackage[colorlinks=true,urlcolor=Blue]{hyperref}
...
\begin{document}
\href{https://www.flickr.com/search/?safe_search=1&license=2\%2C3\%2C4\%2C5\%2C6\%2C9&dimension_search_mode=min&height=640&width=640&media=photos}{https://www.flickr.com/search/?license=2\%2C3\%2C4\%2C5\%2C6\%2C9}
\end{document}
相关问题