如何在目录中获取长标题并在页眉中获取短标题?

如何在目录中获取长标题并在页眉中获取短标题?

通常,当我想减小页眉中某些标题的大小时,我会使用 [括号中的短标题]。但是,这次,我想在目录中使用长标题,但页眉必须很短。我该如何实现这一点?这是我的 MWE:

\documentclass[hidelinks,12pt,twoside,openright,a4paper]{book}
\setlength{\headheight}{14.49998pt}
\addtolength{\topmargin}{-2.49998pt}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\usepackage{setspace}
 \linespread{1.1}

\usepackage[left=5.5cm,right=5.5cm,top=6.5cm,bottom=6.5cm]{geometry}

\usepackage{lipsum}

\usepackage[french]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{mathptmx}

\usepackage{titlesec}
\usepackage{titling}
\titleformat*{\section}{\normalsize\itshape}
\titleformat*{\subsection}{\normalsize\itshape}
\titleformat*{\subsubsection}{\normalsize\itshape}


\usepackage{tocloft}
\setlength{\cftbeforechapskip}{3pt}%espace entre chapitres
\renewcommand{\cftchapleader}{\cftdotfill{\cftdotsep}} % for chapters


\usepackage{hyperref}
\usepackage[numberedbib,nosectionbib]{apacite}
\usepackage[makeindex]{imakeidx}
\makeindex[name=npr, title=Index des noms] 
\makeindex[name=mat, title=Index des matières]

\usepackage{fancyhdr}
\pagestyle{fancy}
% We don't want chapter and section numbers
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\headrulewidth}{0pt}
\fancyhf{} % sets both header and footer to nothing
\fancyfoot{}
\fancyhead[LE,RO]{\thepage}
\fancyhead[CE]{\textit{A name}} % even pages: chapter title
\fancyhead[CO]{\textit\leftmark} % odd pages: book title


%%%%%%%%%%%%Pas de N° de chapitres%%%%%%%%%%%%%%%%%%%%

\usepackage{titlesec}
\titleformat{\chapter}[display]%
    {\centering\Large\bfseries}% format of chapter
    {\large\normalfont\MakeUppercase{\chaptertitlename}\enskip\thechapter}% format of the label
    {.5\baselineskip}{} % space between the two
\titlespacing*{\chapter}{0pt}{25pt}{35pt} % spaces around \chapter{}, {left}{before}{after}
 
%\titleformat{\chapter}[display]
  %{\normalfont\bfseries}{}{0pt}{\Huge}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%épigraphe%%%%%%%%%%%%
\makeatletter
\renewcommand{\@chapapp}{}% Not necessary...
\newenvironment{chapquote}[2][2em]
  {\setlength{\@tempdima}{#1}%
   \def\chapquote@author{#2}%
   \parshape 1 \@tempdima \dimexpr\textwidth-2\@tempdima\relax%
   \itshape}
  {\par\normalfont\hfill---\ 
 \chapquote@author\hspace{\@tempdima}\par\bigskip\par\bigskip}
\makeatother

%%%%%%%%%%%%%Numérotation en chiffres arabes%%%%%%%%%%%%%%%%%%%
\makeatletter
\renewcommand\frontmatter{%
  \cleardoublepage
  \@mainmatterfalse
  %\pagenumbering{roman}% Don't reset
}
\renewcommand\mainmatter{%
  \cleardoublepage
  \@mainmattertrue
  %\pagenumbering{arabic}% Don't reset
}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setcounter{tocdepth}{3}
\setcounter{secnumdepth}{3}

\begin{document}
\title{A title}
\author{A name}
\date{}
\maketitle


\renewcommand{\contentsname}{Sommaire}
\tableofcontents
\frontmatter

\mainmatter


\chapter[A chapter whose the title is short]{A chapter which has a very very very long title as you can see}
\lipsum
\chapter{A section which has also a very very very long title as you can see}
\lipsum


\backmatter
\chapter{Conclusion}

\end{document}

答案1

类( 、 、...memoir的超集)有两个可选的部门标题参数。例如:bookreport

\section[toc-title][head-title]{title}

其中toc-title放在目录中,head-title放在页眉中,title是文档正文中章节的标题。

\chapter从到的所有除法宏都\subparagraph具有相同的功能。

相关内容