ToC 样式,使用 ToCloft

ToC 样式,使用 ToCloft

我正在用 LYX 准备我的论文。之前我问过一个关于 article 类的问题,但后来我发现最好使用 report 类。我使用 tocloft 包,代码如下:

\documentclass[14pt]{extreport}
\renewcommand{\familydefault}{\rmdefault}
\usepackage[LGR,T1,T2A]{fontenc}
\usepackage[koi8-r]{inputenc}
\usepackage[a4paper]{geometry}
\geometry{verbose,tmargin=2cm,bmargin=2cm,lmargin=2.5cm,rmargin=1.1cm,headheight=17pt}
\usepackage{fancyhdr}
\pagestyle{fancy}
\setcounter{secnumdepth}{1}
\setcounter{tocdepth}{1}
\usepackage{float}
\usepackage{units}
\usepackage{textcomp}
\usepackage{amsmath}
\usepackage{stmaryrd}
\usepackage{graphicx}
\usepackage{setspace}
\usepackage{esint}
\usepackage{subscript}
\onehalfspacing

\makeatletter

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
\newcommand*\LyXZeroWidthSpace{\hspace{0pt}}
\DeclareRobustCommand{\greektext}{%
  \fontencoding{LGR}\selectfont\def\encodingdefault{LGR}}
\DeclareRobustCommand{\textgreek}[1]{\leavevmode{\greektext #1}}
\ProvideTextCommand{\~}{LGR}[1]{\char126#1}

\DeclareRobustCommand{\cyrtext}{%
  \fontencoding{T2A}\selectfont\def\encodingdefault{T2A}}
\DeclareRobustCommand{\textcyr}[1]{\leavevmode{\cyrtext #1}}

\newcommand{\lyxmathsym}[1]{\ifmmode\begingroup\def\b@ld{bold}
  \text{\ifx\math@version\b@ld\bfseries\fi#1}\endgroup\else#1\fi}

\ProvideTextCommandDefault{\guillemotleft}{%
  {\usefont{U}{lasy}{m}{n}\char'50\kern-.15em\char'50}%
\penalty10000\hskip0pt\relax%
}
\ProvideTextCommandDefault{\guillemotright}{%
  \penalty10000\hskip0pt%
  {\usefont{U}{lasy}{m}{n}\char'51\kern-.15em\char'51}%
}
\DeclareTextSymbolDefault{\textquotedbl}{T1}
%% Because html converters don't know tabularnewline
\providecommand{\tabularnewline}{\\}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage[koi8-r]{inputenc}
\usepackage{mathtext}
\usepackage{titlesec}
\usepackage[english, russian]{babel}
%\usepackage[T1,T2A]{fontenc}
\usepackage{tocloft}
\addcontentsline{toc}{chapter}{Введение}
\renewcommand{\cfttoctitlefont}{\hfil\Large\bfseries}
\renewcommand{\cftaftertoctitle}{\hfill}
\renewcommand{\cftchappresnum} {Глава }
\setlength{\cftchapnumwidth}{5em}
\setlength{\cftsecnumwidth}{3em}
\renewcommand{\headrulewidth}{0}

\makeatother

\usepackage[style=gost-numeric,bibencoding=utf8, sorting=none]{biblatex}

\addbibresource{0C__Users_1_Documents_My_diss_All_bib.bib}
\begin{document}

\lhead{}
\rhead{}
\chead{\thepage}
\cfoot{}
\begin{center}
{\large{}Титульная}\vspace{28pt}
\par\end{center}

\noindent \begin{center}
Специальность 01.04.11 -- физика магнитных явлений
\par\end{center}    

\newpage{}  

\tableofcontents 
\clearpage

\newpage{}

\chapter*{{\large{}Введение }}

\section*{{\normalsize{}Цели диссертационной работы}}

\section*{{\normalsize{}Апробация работы} }
  Основные результаты диссертационной..

\newpage{}

\chapter{{\large{}Литературный обзор}}

\vspace{42pt}

\section{{\normalsize{}Природа обменного взаимодействия}}

\section{{\normalsize{}Обменные взаимодействия в соединениях РЗМ с Fe, Ni,
Mn}}

\section{{\normalsize{}Кристаллическая структура...}}

\newpage{}

\chapter{{\large{}Технология приготовления и аттестация образцов }}

\vspace{42pt}

\section{{\normalsize{}Микроструктура }}

\section{{\normalsize{}Методика измерения магнитокалорического эффекта в малых
полях и больших полях}}

\section{{\normalsize{}Измерение магнитной восприимчивости}}

\newpage{}

\chapter{{\large{}Результаты}}

\vspace{42pt}

\section{{\normalsize{}Гигантская объёмная ...  }}

\vspace{42pt}

\section{{\normalsize{}Магнитные свойства...}}

\vspace{42pt}

\newpage{}

\chapter{{\large{}Выводы}}

\newpage{}

\chapter*{{\large{}Литература}}

\addcontentsline{toc}{chapter}{Литература}

\nocite{*}
\printbibliography

\end{document}

仍有 2 点看起来不太对劲。第一点 - ToC 的标题未居中。但是我使用了命令 \renewcommand{\cfttoctitlefont},该命令应该可以提供居中功能。

而且我需要章节('Глава')名称后面跟着点,就像章节名称一样。

我该如何编辑这些内容?

答案1

请用最小工作示例(MWE)简化故障排除。

首先,将目录标题居中的做法是正确的。将此命令添加到序言中应该会产生所需的输出。

\renewcommand{\cfttoctitlefont}{\hfill}
\renewcommand{\cftaftertoctitle}{\hfill}

其次,您可以在序言中添加以下命令,在目录中的章节条目后生成前导点。

\renewcommand{\cftchapdotsep}{\cftdotsep}

将所有内容放在一起形成 MWE。

\documentclass{extreport}
\usepackage{fancyhdr}
\pagestyle{fancy}
\setcounter{secnumdepth}{1}
\setcounter{tocdepth}{1}

\usepackage{tocloft}
\addtocontents{toc}{\protect\thispagestyle{fancy}}

% centre toc title
\renewcommand{\cfttoctitlefont}{\hfill\Large}
\renewcommand{\cftaftertoctitle}{\hfill}

% add leading dots to chapters in TOC
\renewcommand{\cftchapdotsep}{\cftdotsep}

\begin{document}

\tableofcontents

\chapter{First}
\section{Some Section}

\chapter{Second}
\section{Another Section}

\end{document}

在此处输入图片描述

相关内容