我对 LaTeX 还很陌生。生成 pdf 时,我收到错误:
扫描使用 \kvsetkeys 时文件结束
我正在使用巴西一所大学开发的标准代码来撰写我的博士论文。
有人能帮助我吗?
以下是代码:
\documentclass[
12pt,
openright,
oneside,
a4paper,
english,
french,
spanish,
brazil
]{abntex2}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage{ucs}
\usepackage[utf8]{inputenc}
\usepackage{lastpage}
\usepackage{indentfirst} .
\usepackage{color}
\usepackage{graphicx}
\usepackage{microtype}
\usepackage{amsmath}
\usepackage{chngcntr}
\usepackage[table]{xcolor}
\usepackage{pgf-pie}
\usepackage{multirow}
\usepackage[normalem]{ulem}
\useunder{\uline}{\ul}{}
\usepackage[brazilian,hyperpageref]{backref}
\usepackage[alf,abnt-etal-list=0,abnt-etal-cite=2,abnt-etal-text=it,abnt-repeated-author-omit=yes]{abntex2cite}
\renewcommand{\backrefpagesname}{Citado na(s) página(s):~}
\renewcommand{\backref}{}
\renewcommand*{\backrefalt}[4]{
\ifcase #1 %
Nenhuma citação no texto.%
\or
Citado na página #2.%
\else
Citado #1 vezes nas páginas #2.%
\fi}%
\counterwithout{equation}{chapter}
\makeatletter
\hypersetup{
%pagebackref=true,
pdftitle={\@title},
pdfauthor={\@author},
pdfsubject={\imprimirpreambulo},
pdfcreator={LaTeX with abnTeX2},
pdfkeywords={abnt}{latex}{abntex}{abntex2}{trabalho acadêmico},
colorlinks=true,
linkcolor=black,
citecolor=black,
filecolor=magenta,
urlcolor=black,
%bookmarksdepth=4}
\makeatother
\setlength{\parindent}{1.3cm}
\setlength{\parskip}{0.2cm} % tente também \onelineskip
\makeindex
\begin{document}
\selectlanguage{brazil}
\frenchspacing
\imprimircapa
\imprimirfolhaderosto
\setlength{\absparsep}{18pt}
\begin{resumo}
\vspace{\onelineskip}
\end{resumo}
\begin{resumo}[Abstract]
\vspace{\onelineskip}
\noindent
\end{resumo}
\pdfbookmark[0]{\listfigurename}{lof}
\listoffigures*
\cleardoublepage
\pdfbookmark[0]{\listtablename}{lot}
\listoftables*
\cleardoublepage
\begin{siglas}
\end{siglas}
\pdfbookmark[0]{\contentsname}{toc}
\tableofcontents*
\cleardoublepage
\textual
\chapter{Introdução}
\section{Apresentação}
\phantompart
\postextual
\bibliography{Bibliografia}
\begin{apendicesenv}
\end{apendicesenv}
\begin{anexosenv}
\end{anexosenv}
\phantompart
\printindex
\end{document}
答案1
这里的主要错误是命令中注释掉的右括号\hypersetup
。将其更改为(参见标记<=======
:
\hypersetup{%
% pagebackref=true,
pdftitle={\@title},
pdfauthor={\@author},
pdfsubject={\imprimirpreambulo},
pdfcreator={LaTeX with abnTeX2},
pdfkeywords={abnt}{latex}{abntex}{abntex2}{trabalho acadêmico},
colorlinks=true,
linkcolor=black,
citecolor=black,
filecolor=magenta,
urlcolor=black,
%bookmarksdepth=4 % <===================================================
} % <===================================================================
在注释掉其他几个选项并添加一些缺失的命令后,您的代码就可以编译了。请参阅以下 MWE(请检查标有 的行<====
):
\documentclass[%
12pt,
openright,
oneside,
a4paper,
%english,
%french,
%spanish,
brazil
]{abntex2}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage{ucs}
\usepackage[utf8]{inputenc}
\usepackage{lastpage}
\usepackage{indentfirst} %.<=====================================
\usepackage{color}
\usepackage{graphicx}
\usepackage{microtype}
\usepackage{amsmath}
\usepackage{chngcntr}
\usepackage[table]{xcolor}
\usepackage{pgf-pie}
\usepackage{multirow}
\usepackage[normalem]{ulem}
\useunder{\uline}{\ul}{}
\usepackage[brazilian,hyperpageref]{backref}
\usepackage[alf,abnt-etal-list=0,abnt-etal-cite=2,abnt-etal-text=it,abnt-repeated-author-omit=yes]{abntex2cite}
\renewcommand{\backrefpagesname}{Citado na(s) página(s):~}
\renewcommand{\backref}{}
\renewcommand*{\backrefalt}[4]{
\ifcase #1 %
Nenhuma citação no texto.%
\or
Citado na página #2.%
\else
Citado #1 vezes nas páginas #2.%
\fi}%
\counterwithout{equation}{chapter}
\makeatletter
\hypersetup{%
% pagebackref=true,
pdftitle={\@title},
pdfauthor={\@author},
pdfsubject={\imprimirpreambulo},
pdfcreator={LaTeX with abnTeX2},
pdfkeywords={abnt}{latex}{abntex}{abntex2}{trabalho acadêmico},
colorlinks=true,
linkcolor=black,
citecolor=black,
filecolor=magenta,
urlcolor=black,
%bookmarksdepth=4 % <===================================================
} % <===================================================================
\makeatother
\setlength{\parindent}{1.3cm}
\setlength{\parskip}{0.2cm} % tente também \onelineskip
\makeindex
\author{John Doe} % <===================================================
\title{title of document}
\date{\today}
\begin{document}
\selectlanguage{brazil}
\frenchspacing
\imprimircapa
%\imprimirfolhaderosto % <============== causes errors
\setlength{\absparsep}{18pt}
\begin{resumo}
\vspace{\onelineskip}
\end{resumo}
\begin{resumo}[Abstract]
\vspace{\onelineskip}
\noindent
\end{resumo}
\pdfbookmark[0]{\listfigurename}{lof}
\listoffigures*
\cleardoublepage
\pdfbookmark[0]{\listtablename}{lot}
\listoftables*
\cleardoublepage
%\begin{siglas}
%\end{siglas}
\pdfbookmark[0]{\contentsname}{toc}
\tableofcontents*
\cleardoublepage
\textual
\chapter{Introdução}
\section{Apresentação}
\phantompart
\postextual
\bibliography{Bibliografia}
\begin{apendicesenv}
\end{apendicesenv}
\begin{anexosenv}
\end{anexosenv}
\phantompart
\printindex
\end{document}
请检查注释行以评估那里的错误然后更改原始代码...
答案2
正如初始评论中所预测的那样,您有{
超过}
\hypersetup{
没有匹配}
请注意,您未显示的完整错误消息准确地显示了问题,该问题以开头{
并表示已到达文件末尾
Runaway argument?
{ pdftitle={\@title }, pdfauthor={\@author }, pdfsubject={\imprimirpreambulo \E
TC.
! File ended while scanning use of \kvsetkeys.
<inserted text>
\par
\kvsetkeys
是使用的内部命令,\hypersetup
但错误消息突出显示了{ pdftitle...
源文件中的参数。