在 longtable 中使用 href{} 时,它只是以逐字方式打印出来。我怎样才能让它表现得像预期的那样(在显示 href 标签的 pdf 文件中生成一个有效链接?
以下是 MWE:
\documentclass[graybox,envcountchap,sectrefs]{svmono}
\usepackage{mathptmx}
\usepackage{helvet}
\usepackage{courier}
%
\usepackage{type1cm}
\usepackage{makeidx} % allows index generation
\usepackage{graphicx} % standard LaTeX graphics tool
% when including figure files
\usepackage{multicol} % used for the two-column index
\usepackage[bottom]{footmisc}% places footnotes at page bottom
\usepackage{parskip}
\usepackage[breaklinks]{hyperref}
\usepackage{ctable}
\usepackage{fixltx2e}
\usepackage{here}
\usepackage{caption}
\usepackage{fancybox}
\usepackage{longtable}
% define detailled toc
\usepackage[explicit]{titlesec}
\usepackage{titletoc}
% longtable
\usepackage{longtable,lscape}
\usepackage{rotating}
% \usepackage{multirow,multicol}
\begin{document}
\chapter{Links}
\label{cha:tasks} % Always give a unique label
% use \chaptermark{}
% to alter or adjust the chapter heading in the running head
\section*{Tabular Depiction }
\label{sec:tabular-depiction}
\begin{landscape}
\begin{longtable}{ll}
\caption{Caption} \\hline
Task & URI \\hline\hline\endfirsthead
\caption{Caption (cont.)} \Task & URI \\hline\endhead
\hline
& www.uri.org \\hline\endfoot
\hline
Web Site & www.uri.org \\hline\endlastfoot
doors & href{http://code.org/wiki/doors}{http://code.org/wiki/doors} \game & href{http://code.org/wiki/game}{http://code.org/game} \Solve & href{http://code.org/wiki/Solve}{http://code.org/wiki/Solve} \
\end{longtable}
\end{landscape}
\end{document}
答案1
命令是,\href
但您正在使用href
(缺少反斜杠):
\documentclass{article}
\usepackage{mathptmx}
\usepackage{helvet}
\usepackage{courier}
\usepackage{type1cm}
\usepackage{makeidx} % allows index generation
\usepackage{graphicx} % standard LaTeX graphics tool
% when including figure files
\usepackage{multicol} % used for the two-column index
\usepackage[bottom]{footmisc}% places footnotes at page bottom
\usepackage{parskip}
\usepackage{ctable}
\usepackage{fixltx2e}
\usepackage{here}
\usepackage{caption}
\usepackage{fancybox}
\usepackage{longtable}% longtable
% define detailled toc
\usepackage[explicit]{titlesec}
\usepackage{titletoc}
\usepackage{lscape}
\usepackage{rotating}
% \usepackage{multirow,multicol}
\usepackage[breaklinks]{hyperref}
\begin{document}
\chapter{Links}
\label{cha:tasks} % Always give a unique label
% use \chaptermark{}
% to alter or adjust the chapter heading in the running head
\section*{Tabular Depiction }
\label{sec:tabular-depiction}
\begin{landscape}
\begin{longtable}{ll}
\caption{Caption} \\
\hline
Task & URI \\
\hline\hline\endfirsthead
\caption{Caption (cont.)} \\
Task & URI \\
\hline\endhead
\hline
& www.uri.org \\
\hline\endfoot
\hline
Web Site & www.uri.org \\
\hline
\endlastfoot
doors & \href{http://code.org/wiki/doors}{http://code.org/wiki/doors} \\
game & \href{http://code.org/wiki/game}{http://code.org/game} \\
Solve & \href{http://code.org/wiki/Solve}{http://code.org/wiki/Solve} \\
\end{longtable}
\end{landscape}
\end{document}
我使用了article
而不是,svmono
因为我没有后者的类。你加载了两次包longtable
,所以我隐藏了其中一个;我还将其移至hyperref
最后加载的包(除了某些包外,通常建议这样做)。