以下是 MWE:
\documentclass[11pt]{book}
\renewcommand\thesubsection{\hspace{10mm}\arabic{subsection}.}
\usepackage{titlesec}
\titleformat{\subsection}[runin]{\normalfont\large\bfseries}{\thesubsection}{1mm}{}{}
\usepackage[hyperfootnotes=false]{hyperref}%
\usepackage{cleveref}%
\begin{document}
\chapter{One}\label{1-0-0}
\section{one}\label{1-1-0}
\subsection{Title}\label{1-1-1}
for this text. text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
References:
\Cref{1-0-0} \nameref{1-0-0}
\Cref{1-1-0} \nameref{1-1-0}
\Cref{1-1-1} \nameref{1-1-1}
\end{document}
有两个问题:
- 提述本款1. 标题被称为
Section
而不是Subsection
。 - 参考文献中的数字是我想要在文中显示的号码,
1.
但在参考文献中我想要完整的号码,1.1.1
。
答案1
\thesubsection
如果外观只应在子部分标题中更改,则不要重新定义。请\titleformat
改用:
\titleformat{\subsection}[runin]{\normalfont\large\bfseries}{\hspace{10mm}\arabic{subsection}.}{1mm}{}{}
要更改打印的子部分的名称参考名称,请\Cref
使用:
\Crefname{subsection}{Subsection}{Subsections}
代码:
\documentclass[11pt]{book}
\usepackage{titlesec}
\titleformat{\subsection}[runin]{\normalfont\large\bfseries}{\hspace{10mm}\arabic{subsection}.}{1mm}{}{}
\usepackage[hyperfootnotes=false]{hyperref}%
\usepackage{cleveref}%
\Crefname{subsection}{Subsection}{Subsections}
\begin{document}
\chapter{One}\label{1-0-0}
\section{one}\label{1-1-0}
\subsection{Title}\label{1-1-1}
for this text. text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
References:
\Cref{1-0-0} \nameref{1-0-0}
\Cref{1-1-0} \nameref{1-1-0}
\Cref{1-1-1} \nameref{1-1-1}
\end{document}