首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >LaTeX / hyperref�的error has参数有一个额外的}。结束{文档}

LaTeX / hyperref�的error has参数有一个额外的}。结束{文档}
EN

Stack Overflow用户
提问于 2022-06-13 14:40:05
回答 1查看 2.4K关注 0票数 4

几天前,我买了一台带有Windows10Pro操作系统的新PC,并决定安装TeXstudio + MiKTeX

我在编译LaTeX文件时遇到了问题。问题是,当我尝试添加\usepackage{hyperref}或类似于这一行的代码(在注释行% problem is here if I add this line的代码中有更详细的内容)时,会出现一个错误,即:Argument of � has an extra }. \end{document}

我的代码:

代码语言:javascript
复制
\documentclass[10pt,a4paper]{report}
\usepackage{cmap}
\usepackage{setspace}
\onehalfspacing
\usepackage{multicol}
\usepackage{textcomp}
\usepackage{verbatim}
\usepackage{floatrow,calc}
\DeclareFloatSeparators{mysep}{\hspace{3cm}}
\thisfloatsetup{floatrowsep=mysep}
\usepackage{ucs}
\usepackage[pdftex]{graphicx}
\usepackage{epstopdf}
\usepackage{amssymb,amsmath}
\DeclareGraphicsExtensions{.pdf, .png, .jpg}
\usepackage[labelsep=period]{caption}
\usepackage[utf8x]{inputenc}
\usepackage[T2A]{fontenc}
\usepackage[russian, english]{babel}
\usepackage[left=3cm, right=1.5cm, top=1.5cm, bottom=2cm]{geometry}
\usepackage{indentfirst}
\usepackage{color}
\definecolor{Black}{rgb}{0,0,0}

\usepackage[unicode, colorlinks, linkcolor=Black]{hyperref} % problem is here if I add this line
\usepackage{xcolor}
\definecolor{linkcolor}{HTML}{000000}
\definecolor{urlcolor}{HTML}{000000}
\hypersetup{pdfstartview=FitH, linkcolor=linkcolor, urlcolor=urlcolor, colorlinks=True} % problem is here if I add this line
\fontfamily{ptm}
\parindent=1cm
\sloppy
\bibliographystyle{unsrt}
\usepackage{hyperref} % problem is here if I add this line

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\lhead{\leftmark}
\cfoot{\thepage}
\renewcommand{\headrulewidth}{1pt}

\usepackage{subfig}

\usepackage{epigraph} %%% to make inspirational quotes.

\usepackage{amsfonts}

\begin{document}

Random text
    
${\mathcal {E}}=-{{d\Phi_{B}} \over dt},$ where

${\mathcal {E}}$ — random letter.   

\end{document}

我得到的错误: 错误

当我在、OverLeaf、上尝试这段代码时,我的笔记本、都没有超级参考包-,一切都很好,。但是我需要这个包,例如,我需要添加参考资料.

有人遇到过类似的问题吗?也许我需要安装其他的软件包?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-06-13 18:58:31

引用了hyperref维护者的话

但我建议放弃utf8x/ucs。在处理utf8方面的大多数改进,例如允许您在\标签和文件名中使用它们,都是由utf8x/ucs撤消的。

如果删除了ucs包和utf8x inputenc选项,您的代码就会编译。

  • 此外,您应该从pdftex中删除graphicx。它将自动选择最适合的选项,以匹配您的编译链。
  • 您也不应该多次加载相同的包,特别是不要使用不同的选项。
  • 并在其他包之后加载hyperref (只有非常多的视图异常)
  • 如果您也加载color,则不需要加载xcolor
代码语言:javascript
复制
\documentclass[10pt,a4paper]{report}
\usepackage{cmap}
\usepackage{setspace}
\onehalfspacing
\usepackage{multicol}
\usepackage{textcomp}
\usepackage{verbatim}
\usepackage{floatrow,calc}
\DeclareFloatSeparators{mysep}{\hspace{3cm}}
\thisfloatsetup{floatrowsep=mysep}
%\usepackage{ucs}
\usepackage[
%pdftex
]{graphicx}
\usepackage{epstopdf}
\usepackage{amssymb,amsmath}
\DeclareGraphicsExtensions{.pdf, .png, .jpg}
\usepackage[labelsep=period]{caption}
%\usepackage[utf8x]{inputenc}
\usepackage[T2A]{fontenc}
\usepackage[russian, english]{babel}
\usepackage[left=3cm, right=1.5cm, top=1.5cm, bottom=2cm]{geometry}
\usepackage{indentfirst}
\usepackage{xcolor}
\definecolor{Black}{rgb}{0,0,0}

\fontfamily{ptm}
\parindent=1cm
\sloppy
\bibliographystyle{unsrt}
%\usepackage{hyperref} % problem is here if I add this line

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\lhead{\leftmark}
\cfoot{\thepage}
\renewcommand{\headrulewidth}{1pt}

\usepackage{subfig}

\usepackage{epigraph} %%% to make inspirational quotes.

\usepackage{amsfonts}
%\usepackage{xcolor}
\usepackage[unicode, colorlinks, linkcolor=Black]{hyperref} % problem is here if I add this line

\definecolor{linkcolor}{HTML}{000000}
\definecolor{urlcolor}{HTML}{000000}
\hypersetup{pdfstartview=FitH, linkcolor=linkcolor, urlcolor=urlcolor, colorlinks=True} % problem is here if I add this line


\begin{document}

Random text
    
${\mathcal {E}}=-\frac{{d\Phi_{B}} }{ dt},$ where

${\mathcal {E}}$ — random letter.   

\end{document}
票数 7
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72604709

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档