忽略 href 中的 % 字符

问题描述 投票:0回答:1

我想使用

\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 将 url 中的

%
解释为评论的开始,并且根本不显示 url。

latex special-characters href
1个回答
2
投票

我在 Ubuntu 上的 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}
© www.soinside.com 2019 - 2024. All rights reserved.