如何在 \section 中创建长超链接

如何在 \section 中创建长超链接

我正在为我的学生写一份文件(最后是 MWE 和乳胶输出),其中有一章的标题很长:

\chapter{Inadequacy of the classical physics, and the birth of a new theory for microscopic phenomena}

这个标题似乎分为两行,既在目录中,也在章节开始的页面中,但我对这种分割并不反感,对我来说这样就足够了。(我发现有很多问题,不同意这种做法,但这不是我的问题。)

进入包hyperref。它起作用了,也就是说,它使目录中的标题可点击,点击后会转到该章节,但拒绝在目录中分割行:它超出了纸张的左边缘,效果很糟糕。hyperref 的文档提到了选项 [breaklinks=true],因此:

\usepackage[breaklinks=true]{hyperref}

但同时告诉我,由于“PDF 驱动程序”,将链接拆分成两行是不行的,并建议不要使用该选项,因为链接将被“置换”。而且确实置换了,而且置换得非常厉害,因为(打开该选项后)章节标题确实被拆分了:但单击任何一行,实际上单击整个页面都没有任何效果。

有人知道如何解决我的问题吗(除了显而易见的问题,即缩短章节标题)?

我提到(在许多帖子中似乎都大肆宣扬这一点)我在 Xubuntu 上使用命令“latex”,但无论如何,这似乎为我调用了“pdflatex”。或者可能是“pdfTeX”?

latex -interaction=batchmode Ift.tex
This is pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017/Debian) (preloaded format=latex)
 restricted \write18 enabled.
entering extended mode

感谢大家的帮助!

\documentclass[12pt]{book}
\usepackage[small]{titlesec}

% Make internal hyperlinks
\usepackage[breaklinks=true]{hyperref}
\hypersetup{
    colorlinks=true,
    linkcolor=blue,
    filecolor=magenta,      
    urlcolor=cyan,
}
\urlstyle{same}
%
% Set the beginning of a LaTeX document
\begin{document}

% Set to use the "plain" pagestyle
\pagestyle{plain}

\tableofcontents
\clearpage

\chapter{Inadequacy of the classical physics, and the birth of a new theory for microscopic phenomena}
\label{ch:Intro}

% Set the ending of a LaTeX document
\end{document}
LaTeX2e <2017-04-15>
Babel <3.18> and hyphenation patterns for 22 language(s) loaded.
(/usr/share/texlive/texmf-dist/tex/latex/base/book.cls
Document Class: book 2014/09/29 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/bk12.clo))
(/usr/share/texlive/texmf-dist/tex/latex/titlesec/titlesec.sty)
(/usr/share/texlive/texmf-dist/tex/latex/hyperref/hyperref.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/hobsub-hyperref.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/hobsub-generic.sty))
(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/share/texlive/texmf-dist/tex/generic/ifxetex/ifxetex.sty)
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/auxhook.sty)
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/kvoptions.sty)
(/usr/share/texlive/texmf-dist/tex/latex/hyperref/pd1enc.def)
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/hyperref.cfg)
(/usr/share/texlive/texmf-dist/tex/latex/url/url.sty))
(/usr/share/texlive/texmf-dist/tex/latex/hyperref/hdvips.def
(/usr/share/texlive/texmf-dist/tex/latex/hyperref/pdfmark.def

Package hyperref Warning: You have enabled option `breaklinks'.
(hyperref)                But driver `hdvips.def' does not suppport this.
(hyperref)                Expect trouble with the link areas of broken links.

(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/rerunfilecheck.sty)))
(./Ift.aux) (/usr/share/texlive/texmf-dist/tex/latex/graphics/color.sty
(/usr/share/texlive/texmf-dist/tex/latex/graphics-cfg/color.cfg)
(/usr/share/texlive/texmf-dist/tex/latex/graphics-def/dvips.def)
(/usr/share/texlive/texmf-dist/tex/latex/graphics/dvipsnam.def))
(/usr/share/texlive/texmf-dist/tex/latex/hyperref/nameref.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/gettitlestring.sty))
(./Ift.out) (./Ift.out) (./Ift.toc) [1] [2]
Chapter 1.

Overfull \hbox (1.70032pt too wide) in paragraph at lines 23--23
|\OT1/cmr/bx/n/20.74 Inadequacy of the clas-si-cal physics, and
[3] (./Ift.aux) )
(see the transcript file for additional information)
Output written on Ift.dvi (3 pages, 4476 bytes).
Transcript written on Ift.log.

相关内容