MWE:
\documentclass{book}
\usepackage{a4wide}
\usepackage{fancyhdr}
\usepackage{graphicx}
\usepackage{polyglossia}
\setmainlanguage[spelling=new,babelshorthands=true]{german}
\usepackage[autostyle]{csquotes}
\usepackage{lipsum}
\usepackage[style=authortitle-icomp,backref=true,backrefstyle=two+,hyperref=true,isbn=false,backend=biber,citereset=chapter,bibencoding=utf8]{biblatex}
\pagestyle{fancyplain}
\renewcommand{\chaptermark}[1]%
{\markboth{\thechapter.\ #1}{}}
\renewcommand{\sectionmark}[1]%
{\markright{\thesection\ #1}}
\lhead[\fancyplain{}{\bfseries\thepage}]%
{\fancyplain{}{\bfseries\rightmark}}
\rhead[\fancyplain{}{\bfseries\leftmark}]%
{\fancyplain{}{\bfseries\thepage}}
\cfoot{}
\renewcommand\thechapter{\Alph{chapter}}
\begin{document}
\frontmatter
\tableofcontents
\chapter{First Chapter}
\mainmatter
\chapter{Second Chapter}
\section{first section}
\section{second section}
\end{document}
目录如下:
我想从所有section
、subsection
及更低的条目中删除章节编号(即从 A.1 中删除 A. 等等)。
这应该只会影响目录,因此不允许重新定义\thesection
。我认为使用 titlesec 是最佳选择,但我不知道该怎么做。
例如替换适当的内容
\titlecontents{section}
[3.8em] % ie, 1.5em (chapter) + 2.3em
{}
{\contentslabel{2.3em}}
{\hspace*{-2.3em}}
{\titlerule*[1pc]{.}\contentspage}
谢谢您的帮助!
答案1
您可以使用本地titlesec
更改标题内的以获得节的编号和小节的的编号。\thesection
\thesubsection
\titleformat
A.1
A,2
A.1.1
A.1.2
并定义 \thesection
,\thesubsection
对于目录中的所有文档,也使用:
\renewcommand{\thesection}{\arabic{section}.}
\renewcommand{\thesubsection}{\thesection\arabic{subsection}}
\documentclass{book}
\usepackage{a4wide}
\usepackage{fancyhdr}
\usepackage{graphicx}
\usepackage{polyglossia}
\setmainlanguage[spelling=new,babelshorthands=true]{german}
\usepackage[autostyle]{csquotes}
\usepackage{lipsum}
\usepackage{titlesec}
\usepackage[style=authortitle-icomp,backref=true,backrefstyle=two+,hyperref=true,isbn=false,backend=biber,citereset=chapter,bibencoding=utf8]{biblatex}
\pagestyle{fancyplain}
\renewcommand{\chaptermark}[1]%
{\markboth{\thechapter.\ #1}{}}
\renewcommand{\sectionmark}[1]%
{\markright{\thesection\ #1}}
\lhead[\fancyplain{}{\bfseries\thepage}]%
{\fancyplain{}{\bfseries\rightmark}}
\rhead[\fancyplain{}{\bfseries\leftmark}]%
{\fancyplain{}{\bfseries\thepage}}
\cfoot{}
\renewcommand\thechapter{\Alph{chapter}}
\renewcommand{\thesection}{\arabic{section}.}
\renewcommand{\thesubsection}{\thesection\arabic{subsection}}
\titleformat{\section}
{\Large\bfseries} {\renewcommand{\thesection}{\thechapter.\arabic{section}}\thesection}{1em}{}
\titleformat{\subsection}
{\large\bfseries} {\renewcommand{\thesubsection}{\thechapter.\thesection\arabic{subsection}}\thesubsection}{1em}{}
\begin{document}
\frontmatter
\tableofcontents
\chapter{First Chapter}
\mainmatter
\chapter{Second Chapter}
\section{first section}
\section{second section}
\subsection{first subsection}
\end{document}
Result