2

the following code give me formattings in the bookmarks, is there a way to show it "normal"? without 1ex[b] respectively to.44em (see img)

\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}

enter image description here

mvp285286
  • 289
  • 1
    KOMA, titlesec and titletoc -- oh my ;-) What do you expect \vspace{1ex} will do in a bookmark content?\ –  Jun 20 '16 at 11:50
  • ok, I do not need the \vspace{1ex}:-) Anyway the "[b]" and the "to.44em" are still in the bookmarks – mvp285286 Jun 20 '16 at 13:05
  • @Christian Hupfer: Do I have to open a new question? Or do you still working on a solution? – mvp285286 Jun 26 '16 at 03:55
  • @christian Hupfer: I open a new question: http://tex.stackexchange.com/questions/316669/texorpdfstring-with-two-arguments – mvp285286 Jun 26 '16 at 08:11

1 Answers1

3

This does not solve the problem with the spacings due to the bottom alignment of the parbox usage here!

You need a \texorpdfstring{tex content}{pdf content} switch,i.e. content which is allowed for TeX must be filtered for pdf and bookmarks. See the \chapterandAuthor command.

\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}
  • with the command "texorpdfstring" I lost format settings. All settings after "texorpdfstring" will get lost. Any idea how to handle it? – mvp285286 Jun 24 '16 at 06:57
  • @mvp285286: Well, not that's the PDF issue: You can't use any formatting in the Bookmarks –  Jun 24 '16 at 08:46
  • Thx for your response. Without "texorpdfstring" the space between chapter and author is the same. With the command "texorpdfstring" the space is different (see the img above). It is not about the formatting in the bookmarks – mvp285286 Jun 24 '16 at 11:32
  • @mvp285286: Please unaccept the solution –  Jun 25 '16 at 17:57