latex书签目录表示

latex书签目录表示

以下代码为我提供了书签的格式,有没有办法将其显示为“正常”?没有 1ex[b] 分别到.44em(见图片)

\documentclass[10pt,final]{scrbook}

\usepackage{titletoc} % modify toc title
\usepackage{lipsum} % dummy text
\usepackage{anyfontsize} % change fontsize
\usepackage{tocloft} % design toc
\usepackage{framed, xcolor}
\usepackage[english,ngerman]{babel}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{times}
\usepackage{helvet}
\usepackage{endnotes}
\usepackage{titlesec}
\usepackage[hyphens]{url}
\usepackage{multicol}
\usepackage[colorlinks=false, pdfborder={0 0 0}]{hyperref}
\urlstyle{same}


%%% Change the title of toc
\addto\captionsngerman{\renewcommand{\contentsname}{\normalfont{Contents}}}

% section itshape
\titleformat*{\section}{\itshape}
\titleformat*{\subsection}{\itshape}
%\titleformat*{\tableofcontents}{\itshape}

% Spacing between section and text
% Syntax: \titlespacing*{<command>}{<left>}{<before-sep>}{<after-sep>}
\titlespacing*{\subsection}{0cm}{0.84cm}{0.42cm}


\titlespacing*{\section}{0cm}{0.84cm}{0.42cm}

% Spacing between chapter and author
\titlespacing*{\chapter}{0cm}{0.84cm}{0.42cm}

% Spacing between chapterAndAuthor and section (?)
%\titlespacing*{\chapterAndAuthor}{0cm}{1.5cm}{1cm}

%%% Chapter style
\titleformat{\chapter}[display]
  {\normalfont}{\chaptertitlename\ \thechapter}{12pt}{\Large}

% Display chapters in the Table of Contents
\titlecontents{chapter}
  [0pt]% Left margin, optional
  {}% Code insertet above
  {\mdseries}% Numbered-entryformat
  {\mdseries}% Numberless-format
  {\contentspage\vskip1.5ex} % add dotfill and pagenumber, and some vertical space between entries

% Custom command to keep the author on the same page of chaptertitle, and above it.
\newcommand{\chapterAndAuthor} [2]{
 % #1: Author
 % #2: Chaptertitle
\clearpage%
    % Minipage to keep the author and chaptertitle on same page
    \noindent\begin{minipage}{\textwidth}
        % Set the author style
        {\selectfont\fontsize{12}{14} \itshape{#1}}
        % Bring the chaptertitle closer to the authortitle
        \vspace{-3\baselineskip}
        % Add an entry to the Table of Contents, with the name of the author in emph and the chapter title
        \addcontentsline{toc}{chapter}{{\normalfont\itshape #1}\vspace{1ex}\newline
        % For long chapter titles using a \parbox
        \hspace*{1em}\protect\parbox[b]{\textwidth}{#2 \dotfill}}
        % Print the chapter
        \chapter*{#2}
    \end{minipage}
    }


% space between table of contents
\setlength\cftparskip{0.21cm}
\setlength\cftbeforesecskip{10pt}
\setlength\cftaftertoctitleskip{10pt}



\usepackage[paperheight=21.0cm,paperwidth=13.5cm,twoside,textwidth=10.3cm,textheight=16.3cm,nohead,pdftex]{geometry}

\setlength{\parindent}{0.5cm} 
\setlength{\parskip}{0pt} 

\pagestyle{plain}





\begin{document}
\tableofcontents

\clearpage

\chapterAndAuthor{The name of the first author, The name of second author and The name of the third author}{Test Chapter One Test Chapter One Test Chapter One Test Chapter One Test Chapter One Test Chapter One Test Chapter One}
\lipsum[1-4]


\vspace{0.84cm}
\subsection*{Subheading1}
\lipsum[1-4]
\subsection*{Subheading2 }
\lipsum[1-2]

\subsection*{Subheading3}
\lipsum[1-2]


\chapterAndAuthor{The name of the second author}{Test Chapter Two}


\end{document}

在此处输入图片描述

答案1

这并不能解决这里由于使用底部对齐而导致的间距问题parbox

您需要一个\texorpdfstring{tex content}{pdf content}开关,即, 允许的内容TeX必须被pdf和过滤bookmarks。请参阅\chapterandAuthor命令。

\documentclass[10pt,final]{scrbook}

\usepackage{titletoc} % modify toc title
\usepackage{lipsum} % dummy text
\usepackage{anyfontsize} % change fontsize
\usepackage{tocloft} % design toc
\usepackage{framed, xcolor}
\usepackage[english,ngerman]{babel}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{times}
\usepackage{helvet}
\usepackage{endnotes}
\usepackage{titlesec}
\usepackage[hyphens]{url}
\usepackage{multicol}
\usepackage[colorlinks=false, pdfborder={0 0 0}]{hyperref}
\urlstyle{same}


%%% Change the title of toc
\addto\captionsngerman{\renewcommand{\contentsname}{\normalfont{Contents}}}

% section itshape
\titleformat*{\section}{\itshape}
\titleformat*{\subsection}{\itshape}
%\titleformat*{\tableofcontents}{\itshape}

% Spacing between section and text
% Syntax: \titlespacing*{<command>}{<left>}{<before-sep>}{<after-sep>}
\titlespacing*{\subsection}{0cm}{0.84cm}{0.42cm}


\titlespacing*{\section}{0cm}{0.84cm}{0.42cm}

% Spacing between chapter and author
\titlespacing*{\chapter}{0cm}{0.84cm}{0.42cm}

% Spacing between chapterAndAuthor and section (?)
%\titlespacing*{\chapterAndAuthor}{0cm}{1.5cm}{1cm}

%%% Chapter style
\titleformat{\chapter}[display]
  {\normalfont}{\chaptertitlename\ \thechapter}{12pt}{\Large}

% Display chapters in the Table of Contents
\titlecontents{chapter}
  [0pt]% Left margin, optional
  {}% Code insertet above
  {\mdseries}% Numbered-entryformat
  {\mdseries}% Numberless-format
  {\contentspage\vskip1.5ex} % add dotfill and pagenumber, and some vertical space between entries

% Custom command to keep the author on the same page of chaptertitle, and above it.
\newcommand{\chapterAndAuthor}[2]{%
 % #1: Author
 % #2: Chaptertitle
\clearpage%
    % Minipage to keep the author and chaptertitle on same page
\noindent\begin{minipage}{\textwidth}
  % Set the author style
  {\selectfont\fontsize{12}{14} \itshape{#1}}
  % Bring the chaptertitle closer to the authortitle
  \vspace{-3\baselineskip}
  % Add an entry to the Table of Contents, with the name of the author in emph and the chapter title
  \addcontentsline{toc}{chapter}{\texorpdfstring{\normalfont\itshape #1\vspace{1ex}\newline
    % For long chapter titles using a \parbox
    \hspace*{1em}\protect\parbox[b]{\textwidth}{#2 \dotfill}}{#2}}
  % Print the chapter
  \chapter*{#2}
\end{minipage}
}


% space between table of contents
\setlength\cftparskip{0.21cm}
\setlength\cftbeforesecskip{10pt}
\setlength\cftaftertoctitleskip{10pt}



\usepackage[paperheight=21.0cm,paperwidth=13.5cm,twoside,textwidth=10.3cm,textheight=16.3cm,nohead,pdftex]{geometry}

\setlength{\parindent}{0.5cm} 
\setlength{\parskip}{0pt} 

\pagestyle{plain}





\begin{document}
\tableofcontents

\clearpage

\chapterAndAuthor{The name of the first author, The name of second author and The name of the third author}{Test Chapter One Test Chapter One Test Chapter One Test Chapter One Test Chapter One Test Chapter One Test Chapter One}
\lipsum[1-4]


\vspace{0.84cm}
\subsection*{Subheading1}
\lipsum[1-4]
\subsection*{Subheading2 }
\lipsum[1-2]

\subsection*{Subheading3}
\lipsum[1-2]


\chapterAndAuthor{The name of the second author}{Test Chapter Two}


\end{document}

相关内容