如何删除子节和段落后面的最后一个点。这应该在目录中和文本的标题中。它应该看起来像这样:
1.
1.1
1.1.1
这是我的 MWE:
\documentclass[12pt,a4paper]{article}
\usepackage{tocloft}
\setcounter{tocdepth}{4}
\setcounter{secnumdepth}{4}
\let \savenumberline \numberline
\def \numberline#1{\savenumberline{#1.}}
\renewcommand{\cftsecleader}{\cftdotfill{\cftsecdotsep}}
\usepackage{titlesec}
\titlelabel{\thetitle.\quad}
\begin{document}
\tableofcontents
\section{Blablabla}
\subsection{blabla}
\subsubsection{haha}
\paragraph{HaHa} ~\\
\end{document}
也许有人可以帮忙。非常感谢 :-)
答案1
尝试这个:
% dotprob.tex SE 590548
\documentclass[12pt,a4paper]{article}
\usepackage{comment}
\usepackage{tocloft}
\setcounter{tocdepth}{4}
\setcounter{secnumdepth}{4}
\begin{comment}
\let \savenumberline \numberline
\def \numberline#1{\savenumberline{#1.}}
\renewcommand{\cftsecleader}{\cftdotfill{\cftsecdotsep}}
\usepackage{titlesec}
\titlelabel{\thetitle.\quad}
\end{comment}
\renewcommand{\thesection}{\arabic{section}.}
\renewcommand{\thesubsection}{\thesection\arabic{subsection}}
\begin{document}
\tableofcontents
\section{Blablabla}
\subsection{blabla}
\subsubsection{haha}
\paragraph{HaHa} ~\\
\end{document}
以上只是(重新)设置了分区数表示。
答案2
目录:
删除重新定义\numberline
并添加
\renewcommand{\cftsecaftersnum}{.}
表示章节编号后面的点。
正文标题:
例如替换\titlelabel{\thetitle.\quad}
为
\usepackage{scrextend}
\titlelabel{\thetitle\Ifstr{\thetitle}{\thesection}{.}{}\quad}
例子:
\documentclass[12pt,a4paper]{article}
\usepackage{tocloft}
\setcounter{tocdepth}{4}
\setcounter{secnumdepth}{4}
\renewcommand{\cftsecaftersnum}{.}% <- dot after section number in TOC
%\renewcommand{\cftsecleader}{\cftdotfill{\cftsecdotsep}}
\usepackage{titlesec}
\usepackage{scrextend}
\titlelabel{\thetitle\Ifstr{\thetitle}{\thesection}{.}{}\quad}% <- dot after section number in section header
\begin{document}
\tableofcontents
\section{Blablabla}\label{sec:Bla}
In section~\ref{sec:Bla} there is a dot after the number in the heading and the ToC but not in the reference.
\subsection{blabla}
\subsubsection{haha}
\paragraph{HaHa} ~\\
\end{document}