\documentclass{minimal}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage{hyperref} % hyper-referencing/link capabilities in PDF
\begin{document}
\hyperref{http://vulkan-spec-chunked.ahcox.com/ch31s03.html#VkFormat}{test}
\end{document}
编译这个最小示例将会出现错误:
line 11: Paragraph ended before \@@hyperref was complete.
这是为什么?
答案1
使用命令\href
而不是\hyperref
类似
\documentclass{minimal}%minimal standalone
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage{hyperref} % hyper-referencing/link capabilities in PDF
\begin{document}
% \hyperref{http://vulkan-spec-chunked.ahcox.com/ch31s03.html#VkFormat}{test}
\href{http://vulkan-spec-chunked.ahcox.com/ch31s03.html#VkFormat}{test} % <===========
\end{document}
text
如果你将鼠标移到上面,就会显示文本和链接: