First of all sorry for my bad English. I am designing a book and I have problems with the bookmark when I compile the file.tex in file.pdf. The chapters appear twice. In my code I don't want to list the chapters, but I want them to appear in the tableofcontents so I had to use \addcontentsline{toc}{chapter}{chapter name} to add them to the index, but this causes re-add the chapters in the bookmark

Additionally I'm using the package bookmark to link the chapters in the page that I desire. What can I do to display the chapters in the tableofcontents and in the bookmark of file.pdf once?

This is my code:



\chapter*{Presentación}   % Presentation of the book


\chapter*{Aspectos téncicos} % From here they appear in the index 
\bookmark[page=4,level=0]{Aspectos téncicos}
\addcontentsline{toc}{chapter}{Aspectos téncicos}

  • 1
    I'm new to this, modify the code. Do not know if it still is too much? – lbautista May 13 '13 at 17:51

You don't need to append bookmark instructions for all chapters, nor \addcontentsline:




\titleformat{\chapter}[display]{\Huge\bfseries}{\chaptertitlename\ \thechapter}{0pt}{}
\titlespacing*{\section}{0pt}{28pt plus 1pt minus 2pt}{14pt plus 2pt}
\titlespacing*{\subsection}{0pt}{14pt plus 1pt minus 2pt}{14pt plus 2pt}
\titlespacing*{\subsubsection}{0pt}{14pt plus 1pt minus 2pt}{14pt plus 2pt}

% Change \frontmatter and \mainmatter not to reset the numbering
  \pagestyle{empty}% no printed page numbers
  \pagestyle{headings}% change to suit


%\input{./portada.tex}   % Bookcover
{\Huge COVER}\clearpage %%%% <--- I don't have your file

%%% This doesn't go in the TOC, so a \bookmark is necessary   
\chapter*{Presentación}   % Presentation of the book



\chapter{Aspectos técnicos}   %First chapter from here I wish to appear in the tableofcontents


I modified the \frontmatter and \mainmatter commands in order not to reset the numbering. Using \pagenumbering{gobble} doesn't work when hyperref is involved, but it's sufficient to kill the normal page style and reset it at \mainmatter.

(I have also omitted the inessential packages, fill them as you prefer.)

  • Thanks @egreg . When compiling, does not show twice the chapters in the bookmark, but I put chapter* because I don't wish to show me the numbers and the word "chapter" in the chapters. How do I get these conditions? – lbautista May 13 '13 at 20:11
  • @lbautista I don't see why you don't want the chapter number; however you can get rid of it by simply acting on the \titleformat and \titlespacing commands relative to \chapter. For instance, \titleformat{\chapter}[display]{\Huge\bfseries}{}{0pt}{} – egreg May 13 '13 at 20:19
  • I understand, but I wanted to avoid having to modify the \titleformat and \titlespacing because I'm new at this; why choose to put chapter*. I will try and tell him. Thanks – lbautista May 13 '13 at 20:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.