以下 MWE 根据节级别生成具有不同对齐方式的 ToC。如何强制所有节级别左对齐?
梅威瑟:
\documentclass[12pt]{report}
%-> For bibliography
\usepackage[num, overcite]{abntex2cite}
%-> Generate dummy text
\usepackage{lipsum}
%-> Change section numbering style
\renewcommand{\thesection}{\arabic{section}}
%-> Add References to ToC
% \usepackage[nottoc, section]{tocbibind}
\usepackage{etoolbox}
\usepackage[hang]{footmisc}
\begin{document}
\tableofcontents
\newpage
\section{Section one}
\subsection{Section one, subsection one}
\lipsum[1]
And here, in this paragraph, I need to cite someone~\cite{ClrT10ca}. This reference will appear in the bibliography area below. And here I will add a footnote%
\footnote{This is the desired footnote}
because I want to see how it is displayed.
\subsection{Section one, subsection two}
\lipsum[2]
\section{Section two}
\lipsum[3]
\addcontentsline{toc}{section}{\protect\numberline{}\bibname}
\bibliographystyle{abntex2-num}
\bibliography{bib}
\end{document}
围兜文件:
@article{ClrT10ca,
author = {Tracey M. Clarke and James R. Durrant},
title = {Charge Photogeneration in Organic Solar Cells},
journal = {Chemical Reviews},
volume = {110},
number = {11},
pages = {6736-6767},
year = {2010} }
更新:
注意:这个abntex2cite
包裹对于我的工作至关重要,任何其他包裹都无法替代。
答案1
有了这个包就可以了tocloft
。
\usepackage{tocloft}
\setlength{\cftpartindent}{0em}
\setlength{\cftchapindent}{0em}
\setlength{\cftsecindent}{0em}
\setlength{\cftsubsecindent}{0em}
\setlength{\cftsubsubsecindent}{0em}
% etc
请参阅手册(> texdoc tocloft
)以了解详细信息。
答案2
这是一个解决方案titletoc
:
\documentclass[12pt]{report}
\usepackage[showframe]{geometry}
%-> For bibliography
%\RequirePackage[num, overcite]{abntex2cite}
\usepackage{lipsum}
%-> Change section numbering style
\renewcommand{\thesection}{\arabic{section}}
%-> Add References to ToC
% \RequirePackage[nottoc, section]{tocbibind}
\usepackage{etoolbox}
% \apptocmd{\thebibliography}{\csname phantomsection\endcsname\addcontentsline{toc}{chapter}{\bibname}}{}{}
\usepackage[hang]{footmisc}
\usepackage{titletoc}
\titlecontents{subsection}
[1.5em] %
{\smallskip}
{\thecontentslabel\hspace{1.02em}}%\thecontentslabel
{\hspace*{2.32em}}
{\,\,\titlerule*[0.77pc]{.}\contentspage}
\begin{document}
\tableofcontents
\newpage
\section{Section one}
\subsection{Section one, subsection one}
\lipsum[1]
And here, in this paragraph, I need to cite someone~\cite{ClrT10ca}. This reference will appear in the bibliography area below. And here I will add a footnote%
\footnote{This is the desired footnote}
because I want to see how it is displayed.
\subsection{Section one, subsection two}
\lipsum[2]
\subsection*{An unnumbered subsection}
\addcontentsline{toc}{subsection}{An unnumbered subsection}
\section{Section two}
\lipsum[3]
\addcontentsline{toc}{section}{\protect\numberline{}\bibname}
\bibliographystyle{abntex2-num}
\bibliography{bib}
\end{document}