我的目标是创建一个标题页,其中包含类似于此处提供的 pdfrender 包第一页的链接:http://ctan.math.utah.edu/ctan/tex-archive/macros/latex/contrib/oberdiek/pdfrender.pdf
侧面有一个书签,并且有彩色超链接。(我希望封面与 pdfrender 标题页相同。在左侧,您会看到书签。在首页上,您会看到蓝色的超链接。这就是我想要的。overleaf 的代码生成了 pdf,但当我将其上传到 google drive 时,它却不生成。)
我想知道怎么做,所以我在 overleaf 上找到了类似的模板:https://www.overleaf.com/3739199258sncjysqnwkjh
我打印出 pdf 并将其上传到 Google Drive。
https://drive.google.com/file/d/1IVt-Pa8qXUuN2Ht_RMgxJX2WqYDXMxID/view
超链接无效,没有书签。
我是否遗漏了说明中的任何内容?请提供意见。我是 Latex 的新手。
\documentclass{book}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{hyperref}
\hypersetup{
colorlinks=true,
linkcolor=blue,
filecolor=magenta,
urlcolor=cyan,
pdftitle={Sharelatex Example},
bookmarks=true,
pdfpagemode=FullScreen,
}
\urlstyle{same}
\begin{document}
\tableofcontents
\chapter{First Chapter}
This will be an empty chapter and I will put some text here
\begin{equation}
\label{eq:1}
\sum_{i=0}^{\infty} a_i x^i
\end{equation}
The equation \ref{eq:1} shows a sum that is divergent. This formula will be latter used in the page \pageref{second}.
For further references see \href{http://www.sharelatex.com}{Something Linky} or go to the next url: \url{http://www.sharelatex.com} or open the next file \href{run:./file.txt}{File.txt}
It's also possible to link directly any word or \hyperlink{thesentence}{any sentence} in you document.
If you read this text, you will get noinformation. Really? Is there no information?
For instance \hypertarget{thesentence}{this sentence}.
\Blindtext
\clearpage
\section{Second section} \label{second}
\blindtext
\Blinddocument
\end{document}
答案1
使用article
类来获取这样的标题页。您需要从章节更改为部分并使用\maketitle
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{hyperref}
\hypersetup{
colorlinks=true,
linkcolor=blue,
filecolor=magenta,
urlcolor=cyan,
pdftitle={Sharelatex Example},
bookmarks=true,
pdfpagemode=FullScreen,
}
\urlstyle{same}
\title{text}
\author{names}
\begin{document}
\maketitle
\tableofcontents
\section{First Chapter}
This will be an empty chapter and I will put some text here
\begin{equation}
\label{eq:1}
\sum_{i=0}^{\infty} a_i x^i
\end{equation}
The equation \ref{eq:1} shows a sum that is divergent. This formula will be latter used in the page \pageref{second}.
For further references see \href{http://www.sharelatex.com}{Something Linky} or go to the next url: \url{http://www.sharelatex.com} or open the next file \href{run:./file.txt}{File.txt}
It's also possible to link directly any word or \hyperlink{thesentence}{any sentence} in you document.
If you read this text, you will get noinformation. Really? Is there no information?
For instance \hypertarget{thesentence}{this sentence}.
\Blindtext
\clearpage
\section{Second section} \label{second}
\blindtext
\Blinddocument
\end{document}
答案2
好吧,如果我理解正确的话,您有以下问题:
- 您的代码中没有打印标题。您忘记添加
\maketitle
和相关命令\title{Title}
和\author{John Doe}
。请参阅以下内容... - 标题的艺术取决于所使用的 documentclass。
book
创建一个完整的页面作为 titlepage,classarticle
在文章开头创建一个标题,文本紧随其后——这似乎就是您想要的。因此,您需要将 documentclass 更改book
为article
(然后您还必须更改\chapter{}
为\section{}
... - 书签问题可能取决于您使用的 pdf 查看器。有些 pdf 查看器显示书签时没有特殊选项,有些则不显示。为了更加确定,请添加选项
bookmarksopen,
以hyperref
在查看器中打开 pdf 时显示打开的书签... - 为了向您显示超链接正在工作,我将颜色更改
blue
为green
。如果您单击我的 mwe 生成的 pdf 中的目录中的绿线,您将看到单击的页面显示...
请参阅以下 MWE
\documentclass{article} % book
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{hyperref}
\hypersetup{%
colorlinks=true,
linkcolor=green, % <================================ your color was blue
filecolor=magenta,
urlcolor=cyan,
pdftitle={Sharelatex Example},
% bookmarks=true,
bookmarksopen, % <====================================================
pdfpagemode=FullScreen,
}
\urlstyle{same}
\title{test}
\author{John Doe}
\begin{document}
\maketitle
\tableofcontents
%\chapter{First Chapter} % <============================ start with class book
\section{First Section} % <============================ start with class article
This will be an empty chapter and I will put some text here
\begin{equation}
\label{eq:1}
\sum_{i=0}^{\infty} a_i x^i
\end{equation}
The equation \ref{eq:1} shows a sum that is divergent. This formula will be latter used in the page \pageref{second}.
For further references see \href{http://www.sharelatex.com}{Something Linky} or go to the next url: \url{http://www.sharelatex.com} or open the next file \href{run:./file.txt}{File.txt}
It's also possible to link directly any word or \hyperlink{thesentence}{any sentence} in you document.
If you read this text, you will get noinformation. Really? Is there no information?
For instance \hypertarget{thesentence}{this sentence}.
\Blindtext
\clearpage
\section{Second section} \label{second}
\blindtext
\Blinddocument
\end{document}
及其结果:
顺便说一句:我使用我当前的 MiKTeX 2.9 进行编译,没有错误或警告!