更改目录中内容的位置

更改目录中内容的位置

我需要将“内容”一词移到右边。我该怎么做?

桌子

\documentclass[11pt,a4paper,oneside,openright]{book}
\usepackage{hyperref}
\usepackage{xcolor}
\usepackage[titles]{tocloft}

\usepackage{minitoc}

\usepackage{theorem}

\newtheorem{theorem}{Theorem}

\hypersetup{
        colorlinks=true,
        linkcolor=blue,
        filecolor=blue,      
        urlcolor=blue,
        citecolor=red,
        linktoc=page
        %pdfpagemode=FullScreen,
    }

\begin{document}
\dominitoc

\frontmatter

\tableofcontents

\mainmatter
\chapter{This is the first chapter}

{\hypersetup{linkcolor=black}
\minitoc
}

\section{section}
This is a citation~\cite{ref1}. Theorem~\ref{thm1} provides some interesting information.
\begin{theorem}\label{thm1}
    Rain gets you wet.
\end{theorem}
\section{section}
\section{section}

\bibliographystyle{alpha}

\begin{thebibliography}{Smi19}

    \bibitem[Smi19]{ref1}
    John Smith.
    \newblock Citing in red.
    \newblock {\em Journal of Hyperlink Colors}, 2019.

\end{thebibliography}

\end{document}

答案1

使用tocloft不带[titles]选项的包:

\usepackage{tocloft}
\renewcommand*{\cfttoctitlefont}{\hfill\large\bfseries} % for ToC title
\renewcommand*{\cftloftitlefont}{\hfill\large\bfseries} % for LoF title
\renewcommand*{\cftlottitlefont}{\hfill\large\bfseries} % for LoT title

答案2

加载后minitoc,将以下代码添加到你的序言中:

\usepackage{etoolbox}

\makeatletter

\AtBeginDocument{
  \patchcmd{\mtc@sv@tableofcontents}% <cmd>
    {\contentsname}% <search>
    {\mbox{}\hfill\contentsname}% <replace>
    {}{}% <success><failure>
}
\makeatother

在此处输入图片描述

上述补丁更新\tableofcontentsminitoc\hfill在打印的标题前插入。minitoc完全删除了tocloft这里。

相关内容