但是当使用下面的 MWE 时:
\documentclass[
12pt,
oneside,
a4paper,
hyphens,
chapter=TITLE, % títulos de capítulos convertidos em letras maiúsculas
section=TITLE, % títulos de seções convertidos em letras maiúsculas
%subsection=TITLE, % títulos de subseções convertidos em letras maiúsculas
%subsubsection=TITLE, % títulos de subsubseções em letras maiúsculas
%subsubsubsection=TITLE,
%sumario=abnt-6027-2012,
%sumario=tradicional,
english,
brazil,
]{abntex2} %
%
\hypersetup{hidelinks}
\setlength\bibitemsep{3\itemsep}
%Configurando Fontes
\setlength{\cftbeforechapterskip}{0pt}
\renewcommand{\ABNTEXchapterfont}{\normalfont\bfseries}
\renewcommand{\ABNTEXchapterfontsize}{\normalsize}
\renewcommand{\ABNTEXsectionfont}{\normalfont}
\renewcommand{\ABNTEXsectionfontsize}{\normalsize}
\renewcommand{\ABNTEXsubsectionfont}{\normalfont\bfseries}
\renewcommand{\ABNTEXsubsectionfontsize}{\normalsize}
\renewcommand{\ABNTEXsubsubsectionfont}{\normalfont\bfseries\itshape}
\renewcommand{\ABNTEXsubsubsectionfontsize}{\normalsize}
\setlength\afterchapskip{\baselineskip}
\usepackage{etoc}
\makeatletter
\setlength{\cftbeforechapterskip}{\baselineskip} % Espaçamento entre capítulos
\setlength{\cftchapternumwidth}{2em}
\let\old@chapter\l@chapter
\let\old@chapternumberline\chapternumberline
\etocsetstyle{chapter}{}{}{\old@chapter{\old@chapternumberline{\etocnumber}\etoclink{\normalsize\bfseries\MakeUppercase\etocthename}}{\etocpage}}{}%
\let\old@section\l@section
\etocsetstyle{section}{}{}
{\old@section{\normalfont\numberline{\etocnumber}\etocname}{\etocpage}}{}%
\let\old@subsection\l@subsection
\etocsetstyle{subsection}{}{}
{\old@subsection{\normalfont\bfseries\numberline{\etocnumber}\etocname}{\etocpage}}{}%
\let\old@subsubsection\l@subsubsection
\etocsetstyle{subsubsection}{}{}
{\old@subsubsection{\normalfont\bfseries\itshape\numberline{\etocnumber}{\etocname}}{\etocpage}}{}%
\makeatother
\usepackage{lipsum}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@ARTICLE{example,
author = {Other, Anthony Norman},
title = {Some things I did},
year = {2014},
journal = {J.~Irrep. Res.},
volume = {1},
number = {1},
pages = {1-10}
}
\end{filecontents*}
\usepackage[
style = abnt, % Sistema alfabético
backend = biber, % Força usar Biber
%style = abnt-numeric, % Sistema numérico
%style = abnt-ibid, % Notas de referência
giveninits,
repeatfields,
justify,
%indent,
]{biblatex}
\addbibresource{\jobname.bib}
\begin{document}
\tableofcontents*
\chapter{Introdução}
\lipsum[3-5]\cite{example}.
\section{INTRO I}
\lipsum[3-6]\cite{example}.
\subsection{Intro II}
\lipsum[7-9]\cite{example}.
\subsubsection{Intro III}
\lipsum[9-10]\cite{example}.
\chapter{Revisão}
\lipsum[12-14]\cite{example}.
\section{REVISÃO I}
\lipsum[11-14]\cite{example}.
\subsection{Revisão II}
\lipsum[14-16]\cite{example}.
\subsubsection{Revisão III}
\lipsum[17-18]\cite{example}.
\printbibliography
\end{document}
然而我得到的是:
“REFERÊNCIAS”文本应该与其余部分对齐,但是它之前有一个未包含在任何地方的空格。
如果我检查“MWE.toc”辅助文件,我会发现以下行:
\setlength {\cftchapterindent }{\cftlastnumwidth } \setlength {\cftchapternumwidth }{2em}
我怀疑它是罪魁祸首,但找不到它包含在“.toc”文件中的位置(已经检查了所有类文件但无济于事)。如果我使用 LuaLaTeX 编译它(原始文件上的字体规范需要它)。
现在更让我烦恼的是,如果我切换%sumario=abnt-6027-2012和%sumario=传统,随机地,并且不要删除“ .toc”文件,有时它会按预期打印,但它几乎是随机的,第一次执行时出现的次数比后者多。
答案1
该类abntex2
似乎定义了一个魔法命令\tocprintchapter
,当您尝试添加章节目录条目时需要发出该命令。这意味着我们需要重新定义参考书目标题(来自abnt.bbx
)
\makeatletter
\defbibheading{bibliography}[\refname]{%
\chapter*{#1}%
\if@twoside
\markboth{\abx@MakeMarkcase{#1}}{\abx@MakeMarkcase{#1}}%
\else
\markright{\abx@MakeMarkcase{#1}}%
\fi
\ifmemoirbibintoc
{\phantomsection
\tocprintchapter
\addcontentsline{toc}{chapter}{#1}}
{}}
\makeatother
总共
\documentclass[
12pt,
oneside,
a4paper,
hyphens,
chapter=TITLE,
section=TITLE,
english,
brazil,
]{abntex2} %
\setlength\bibitemsep{3\itemsep}
%Configurando Fontes
\setlength{\cftbeforechapterskip}{0pt}
\renewcommand{\ABNTEXchapterfont}{\normalfont\bfseries}
\renewcommand{\ABNTEXchapterfontsize}{\normalsize}
\renewcommand{\ABNTEXsectionfont}{\normalfont}
\renewcommand{\ABNTEXsectionfontsize}{\normalsize}
\renewcommand{\ABNTEXsubsectionfont}{\normalfont\bfseries}
\renewcommand{\ABNTEXsubsectionfontsize}{\normalsize}
\renewcommand{\ABNTEXsubsubsectionfont}{\normalfont\bfseries\itshape}
\renewcommand{\ABNTEXsubsubsectionfontsize}{\normalsize}
\setlength\afterchapskip{\baselineskip}
\usepackage{etoc}
\makeatletter
\setlength{\cftbeforechapterskip}{\baselineskip} % Espaçamento entre capítulos
\setlength{\cftchapternumwidth}{2em}
\let\old@chapter\l@chapter
\let\old@chapternumberline\chapternumberline
\etocsetstyle{chapter}{}{}{\old@chapter{\old@chapternumberline{\etocnumber}\etoclink{\normalsize\bfseries\MakeUppercase\etocthename}}{\etocpage}}{}%
\let\old@section\l@section
\etocsetstyle{section}{}{}
{\old@section{\normalfont\numberline{\etocnumber}\etocname}{\etocpage}}{}%
\let\old@subsection\l@subsection
\etocsetstyle{subsection}{}{}
{\old@subsection{\normalfont\bfseries\numberline{\etocnumber}\etocname}{\etocpage}}{}%
\let\old@subsubsection\l@subsubsection
\etocsetstyle{subsubsection}{}{}
{\old@subsubsection{\normalfont\bfseries\itshape\numberline{\etocnumber}{\etocname}}{\etocpage}}{}%
\makeatother
\usepackage{lipsum}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@ARTICLE{example,
author = {Other, Anthony Norman},
title = {Some things I did},
year = {2014},
journal = {J.~Irrep. Res.},
volume = {1},
number = {1},
pages = {1-10}
}
\end{filecontents*}
\usepackage[
style = abnt, % Sistema alfabético
backend = biber, % Força usar Biber
%style = abnt-numeric, % Sistema numérico
%style = abnt-ibid, % Notas de referência
giveninits,
repeatfields,
justify,
%indent,
]{biblatex}
\addbibresource{\jobname.bib}
\makeatletter
\defbibheading{bibliography}[\refname]{%
\chapter*{#1}%
\if@twoside
\markboth{\abx@MakeMarkcase{#1}}{\abx@MakeMarkcase{#1}}%
\else
\markright{\abx@MakeMarkcase{#1}}%
\fi
\ifmemoirbibintoc
{\phantomsection
\tocprintchapter
\addcontentsline{toc}{chapter}{#1}}
{}}
\makeatother
\begin{document}
\tableofcontents*
\chapter{Introdução}
\lipsum[3-5]\cite{example}.
\section{INTRO I}
\lipsum[3-6]\cite{example}.
\subsection{Intro II}
\lipsum[7-9]\cite{example}.
\subsubsection{Intro III}
\lipsum[9-10]\cite{example}.
\chapter{Revisão}
\lipsum[12-14]\cite{example}.
\section{REVISÃO I}
\lipsum[11-14]\cite{example}.
\subsection{Revisão II}
\lipsum[14-16]\cite{example}.
\subsubsection{Revisão III}
\lipsum[17-18]\cite{example}.
\printbibliography
\end{document}