标签: hyperref

在LaTeX样式表中自动设置pdftitle和pdfauthor

我使用下面的代码在pdf文档属性中设置标题和作者.

\usepackage[pdftex]{hyperref}
\hypersetup{
    pdftitle = {The documents title},
    pdfauthor = {me}
}
Run Code Online (Sandbox Code Playgroud)

我希望通过将它放在样式表中来自动化(.sty)以下是我的尝试,但它不起作用.编译pdf(pdflatex)时出错.但是pdf文档属性仍然是空的.

\usepackage[pdftex]{hyperref}
\hypersetup{
    pdftitle = {\@title},
    pdfauthor = {\@author}
}
Run Code Online (Sandbox Code Playgroud)

我使用\ _title和\ _author变量来创建自定义标题页.所以我知道那些工作.

有什么建议?

latex stylesheet hyperref

26
推荐指数
2
解决办法
1万
查看次数

如何使用hyperref显式结束LaTeX中的\ part

我有一个LaTeX文档,其中包含以下内容:

\tableofcontents
\chapter{Chapter One}
\part{Part One}
...
\part{Final Part}
\chapter{Final Part Chapters}
\chapter{Chapter not Part of Part}
Run Code Online (Sandbox Code Playgroud)

当我将其编译为带有hyperref的PDF时,最后一章作为书签最后一部分的一部分.(我包括hyperref,如下所示.)

\usepackage[xetex,breaklinks,a4paper]{hyperref}
Run Code Online (Sandbox Code Playgroud)

我想知道的是如何在最后一章之前明确地结束该部分,以便在创建PDF时hyperref将此书签提升到顶级.

任何帮助,将不胜感激.

latex hyperref

17
推荐指数
1
解决办法
1万
查看次数

LaTeX使用hyperref包和natbib更改文本引用的颜色

我现在用的是natbibhyperref宏包我的LaTeX文档中,并希望各地从基线绿色超级引用引用框的颜色改变为更柔和的颜色(紫色或深蓝色).但是,在使用建议的代码执行此操作时,我无法更改引文链接颜色.MWE:

\usepackage[usenames,dvipsnames]{color}
\usepackage[round]{natbib}
\usepackage[hyperfootnotes=false]{hyperref}
\hypersetup{
 colorlinks=false,
 citecolor=Violet,
 linkcolor=Red,
 urlcolor=Blue}

 \begin{document}

 \bibliographystyle{apsr}
 \bibliography{exp_final}
 \end{document}
Run Code Online (Sandbox Code Playgroud)

但是,当我编译(我编译多次以确保)时,我的pdf文件看起来就像我排除了格式\hypersetup(仍然是相同的绿色).我也想把脚注引用.

latex hyperref

17
推荐指数
1
解决办法
6万
查看次数

LaTeX hyperref链接转到了错误的页面

我正在尝试创建一个不使用标题的浮点数的引用.如果我在float中包含\ label {foo}并使用\ pageref {foo}引用它,则在我的pdf文档中显示正确的页码,但是由hyperref包创建的超链接链接到不同的页面(第一页)部分).如果我在float中的标签之前包含标题,则hyperref链接将转到正确的页面.

有没有办法让hyperref链接正常工作而不在浮点数中包含标题?或者有没有办法抑制标题的显示,所以我可以包括一个没有显示?

以下是一个最小的例子.如果我使用pdflatex处理它,我会得到三页."图"显示在第二页上,第三页正确显示"见第2页上的图".但是'2'上的超链接表示"转到第1页",如果我点击它,则会将我带到第1页.

如果我在\ label {foo}之前放置一个空的\ caption {},那么超链接可以正常工作,但我不想为我的浮点显示一个标题.

\documentclass[11pt]{memoir}

\usepackage{hyperref}

\begin{document}

some text
\clearpage


\begin{figure}
  a figure
  \label{foo}
\end{figure}

more text
\clearpage


See figure on page \pageref{foo}.

\end{document}
Run Code Online (Sandbox Code Playgroud)

latex hyperref

15
推荐指数
2
解决办法
1万
查看次数

乳胶| 超引用错误 | 的论证?有一个额外的}。\结束{文档}

几天前我买了一台装有 Windows 10 Pro 操作系统的新电脑,并决定安装TeXstudio + MiKTeX

\n

我在编译 LaTeX 文件时遇到了问题。问题是,当我尝试添加\\usepackage{hyperref}或编码与此行类似的内容(在带有注释行的代码中更详细% problem is here if I add this line)时,我收到一条错误消息:Argument of \xef\xbf\xbd has an extra }. \\end{document}

\n

我的代码:

\n
\\documentclass[10pt,a4paper]{report}\n\\usepackage{cmap}\n\\usepackage{setspace}\n\\onehalfspacing\n\\usepackage{multicol}\n\\usepackage{textcomp}\n\\usepackage{verbatim}\n\\usepackage{floatrow,calc}\n\\DeclareFloatSeparators{mysep}{\\hspace{3cm}}\n\\thisfloatsetup{floatrowsep=mysep}\n\\usepackage{ucs}\n\\usepackage[pdftex]{graphicx}\n\\usepackage{epstopdf}\n\\usepackage{amssymb,amsmath}\n\\DeclareGraphicsExtensions{.pdf, .png, .jpg}\n\\usepackage[labelsep=period]{caption}\n\\usepackage[utf8x]{inputenc}\n\\usepackage[T2A]{fontenc}\n\\usepackage[russian, english]{babel}\n\\usepackage[left=3cm, right=1.5cm, top=1.5cm, bottom=2cm]{geometry}\n\\usepackage{indentfirst}\n\\usepackage{color}\n\\definecolor{Black}{rgb}{0,0,0}\n\n\\usepackage[unicode, colorlinks, linkcolor=Black]{hyperref} % problem is here if I add this line\n\\usepackage{xcolor}\n\\definecolor{linkcolor}{HTML}{000000}\n\\definecolor{urlcolor}{HTML}{000000}\n\\hypersetup{pdfstartview=FitH, linkcolor=linkcolor, urlcolor=urlcolor, colorlinks=True} % problem is here if I add this line\n\\fontfamily{ptm}\n\\parindent=1cm\n\\sloppy\n\\bibliographystyle{unsrt}\n\\usepackage{hyperref} % problem is here if I add this line\n\n\\usepackage{fancyhdr}\n\\pagestyle{fancy}\n\\fancyhf{}\n\\lhead{\\leftmark}\n\\cfoot{\\thepage}\n\\renewcommand{\\headrulewidth}{1pt}\n\n\\usepackage{subfig}\n\n\\usepackage{epigraph} %%% to make inspirational …
Run Code Online (Sandbox Code Playgroud)

latex hyperref pdflatex

10
推荐指数
1
解决办法
8598
查看次数

在LaTeX中设置作者或地址字符串变量

LaTeX是一种用于编写文档的精彩语言.使用hyperref软件包pdflatex,您可以轻松生成包含元数据的文档,这是一个很好的功能,可以在Web上引用您的文档.

我经常使用以下模板:

\documentclass[11pt]{article}
\usepackage[pdftex, pdfusetitle,colorlinks=false,pdfborder={0 0 0}]{hyperref}%
\hypersetup{%
pdftitle={My title},%
pdfauthor={My name},%
pdfkeywords={my first keyword, my second keyword, more keywords.},%
}%
\begin{document}

\title{My title}
\author{My name}
\date{}
\maketitle

{\bf Keywords:} my first keyword, my second keyword, more keywords.%

My text is here...

\end{document}
Run Code Online (Sandbox Code Playgroud)

到目前为止,它很好.我的问题从示例中弹出:有没有办法在标题中定义字符串变量,以便它们可以作为参数传递给hyperref然后传递给frontmatter或文本.就像是:

\documentclass[11pt]{article}
%-------definitions-----
\def\Author{My name}
\def\Title{My title}
\def\Keywords{my first keyword, my second keyword, more keywords.}
%--------------------------
\usepackage[pdftex, pdfusetitle,colorlinks=false,pdfborder={0 0 0}]{hyperref}%
\hypersetup{%
pdftitle={\Title},%
pdfauthor={\Author},%
pdfkeywords={\Keywords},%
}%
\begin{document}
\title{\Title}
\author{\Author}
\date{}
\maketitle

{\bf …
Run Code Online (Sandbox Code Playgroud)

latex hyperref pdflatex

7
推荐指数
1
解决办法
7040
查看次数

当我点击其中的内容时,LaTeX hyperref 链接会转到错误的页面

我想问如何使用 \hyperref 因为我已经在谷歌上搜索了大量答案,但我找不到。我创建了自己的目录。然后我包含了 \hyperref 包。然后内容会自动成为超链接,这很好。但随后它就转到了错误的页面。我用谷歌搜索了很多,但找不到答案。我点击的内容转到了错误的页面。

\documentclass[10pt,a4paper]{report}

\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{enumerate}

\usepackage{hyperref}
% %\usepackage[colorlinks]{hyperref}


% %\renewcommand*{\contentsname}{\hyperlink{contents}{Contents}}
% %\renewcommand*{\contentsname}{\hyperref[contents]{\arabic{page}}}

\begin{document}

\input{coverPage}
\maketitle

\tableofcontents
\addcontentsline{toc}{chapter}{Table of Contents}
\pagebreak

\addcontentsline{toc}{chapter}{List of Figures}
\listoffigures
\pagebreak

% % (1) ==============================================
\setcounter{chapter}{1}
\addcontentsline{toc}{chapter}{1. Introduction}
\input{introduction}
\pagebreak

\addcontentsline{toc}{chapter}{2. References}
\input{references}
\pagebreak

\addcontentsline{toc}{chapter}{3. Glossary}
\input{glossary}
\pagebreak

\end{document}
Run Code Online (Sandbox Code Playgroud)

latex tex hyperref tableofcontents

6
推荐指数
1
解决办法
7863
查看次数

如何获取页码以链接到 Latex 中的目录?

我看过一个 pdf LaTeX 文档,其中页面底部的页码是 hyperref 链接,单击它们会使您跳转到目录表。我没有 tex 文件,无法弄清楚它是如何从 hyperref 包中完成的。任何人都可以帮忙吗?

latex hyperref

5
推荐指数
1
解决办法
3975
查看次数

hyperref软件包的pdftex驱动程序不适用于utf-8编码的.tex文件

我使用pdflatex生成pdf文件。由于非英语字符,我的源文件都是utf-8编码的。没有\usepackage{hyperref}代码,就可以毫无问题地进行编译。但是当我把\usepackage{hyperref}(甚至没有任何\href{}{}代码)放在包装清单中时,会出现一个错误,说

**************************************
! Use of \@chapter doesn't match its definition.  
\CJK@altchar ...fx \csname \reserved@a \endcsname   
                                                  \relax \CJKsymbol {\@tempc...  
l.1 \chapter{XXX}                    
?  
**************************************
Run Code Online (Sandbox Code Playgroud)

其中“ XXX”代表非英语字符。

然后我在Google上搜索了很多,发现原因是hyperref使用pdftex驱动程序,该驱动程序不适用于utf-8编码的文件。我检查了以下页面:http : //www.tug.org/applications/hyperref/manual.html,但是找不到适合pdflatex的驱动程序。

我尝试过\usepackage[utf8]{inputenc},但仍然无法正常工作。

有人可以帮我吗?谢谢!

latex hyperref pdflatex

5
推荐指数
1
解决办法
3765
查看次数

通过 pandoc 转换 docx -> tex 时禁用超链接生成

我有一个docx包含大量交叉引用的文件。然而,大多数这些交叉引用都是虚假的。我想将其转换为 LaTeX,但这会导致许多\hyperlink命令分散在整个文档中。我想pandoc转换文件但不创建超链接。

pandoc -s myfile.docx -o myfile.tex
Run Code Online (Sandbox Code Playgroud)

我在https://pandoc.org/MANUAL.html中搜索了hyperrefhyperlink、 和 ,但唯一的命中是关于将生成超链接的评论,而不是关于如何避免创建超链接的建议。cross-reference

hyperref pandoc

5
推荐指数
0
解决办法
1130
查看次数

标签 统计

hyperref ×10

latex ×9

pdflatex ×3

pandoc ×1

stylesheet ×1

tableofcontents ×1

tex ×1