Minitoc 章节和标题位于同一行并居中。目录居中,

Minitoc 章节和标题位于同一行并居中。目录居中,

梅威瑟:

\documentclass[11pt,oneside]{book} % [text size]{document type}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{fancyhdr, blindtext} %for testing
\usepackage{minitoc} % Get chapter level TOC
\renewcommand{\mtctitle}{TABLE OF CONTENTS}
\dominitoc
\setcounter{parttocdepth}{4} % set minitoc sublevel
\setcounter{secnumdepth}{4} % to get X.X.X.X
\mtcsetrules{*}{off}

\begin{document}

\chapter{SAMPLE CHAPTER }\label{ch5}

\minitoc{\protect\thispagestyle{fancy}}

\section{My Section 1}
\subsection{My Section  1 Subsection 1}
\subsection{My Section  1 Subsection 2}
\subsection{My Section  1 Subsection 3}
\subsubsection{My Section  1 Subsection 3  Subsubsection 1}
\section{My Section 2}
\subsection{My Section  2 Subsection 1}
\subsection{My Section  2 Subsection 2}
\subsection{My Section  2 Subsection 3}
\subsubsection{My Section  2 Subsection 3  Subsubsection 1}

\end{document}

得出的结果为:

在此处输入图片描述

那么,如何让“第 1 章示例章节”在同一行并居中?我还需要将目录居中并调整垂直间距。谢谢,Matt

答案1

我没有完全解决这个问题。但我能够在同一行上获得章节编号和章节标题。这是它的 MWE:

\documentclass[11pt,oneside]{book} % [text size]{document type}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{fancyhdr, blindtext} %for testing
\usepackage{minitoc} % Get chapter level TOC
\usepackage{titlesec}
\renewcommand{\mtctitle}{TABLE OF CONTENTS}
\dominitoc
\setcounter{parttocdepth}{4} % set minitoc sublevel
\setcounter{secnumdepth}{4} % to get X.X.X.X
\mtcsetrules{*}{off}
\titleformat{\chapter} {\large\bfseries}{CHAPTER \thechapter}{0em}{---}
\titleformat{\section} {\normalfont\bfseries}{\thesection}{0em}{---}
\titleformat{\subsection} {\normalfont\bfseries}{\thesubsection}{0em}{---}
\titleformat{\subsubsection}{\normalfont\normalsize\bfseries}{\thesubsubsection}{0em}{---}
\begin{document}

\chapter{SAMPLE CHAPTER }\label{ch5}

\minitoc{\protect\thispagestyle{fancy}}

\newpage
\section{My Section 1}
\subsection{My Section  1 Subsection 1}
\subsection{My Section  1 Subsection 2}
\subsection{My Section  1 Subsection 3}
\subsubsection{My Section  1 Subsection 3  Subsubsection 1}
\section{My Section 2}
\subsection{My Section  2 Subsection 1}
\subsection{My Section  2 Subsection 2}
\subsection{My Section  2 Subsection 3}
\subsubsection{My Section  2 Subsection 3  Subsubsection 1}
\newpage


\chapter{Next CHAPTER }\label{ch6}

\minitoc{\protect\thispagestyle{fancy}}

\section{New Section 1}
\subsection{New Section  1 Subsection 1}
\subsection{New Section  1 Subsection 2}
\subsection{New Section  1 Subsection 3}
\subsubsection{New Section  1 Subsection 3  Subsubsection 1}
\section{New Section 2}
\subsection{New Section  2 Subsection 1}
\subsection{New Section  2 Subsection 2}
\subsection{New Section  2 Subsection 3}
\subsubsection{New Section  2 Subsection 3  Subsubsection 1}


\end{document}

这样就完成了: 在此处输入图片描述

相关内容