2

I am using book class with XeLaTeX. I want to change the toc counter 'I' (as shown here), 1

with a bullet but redefining the Roman alphabets will also change the alphabets in the main document (as shown in here)

2

which will then probably look like 'Part (bullet)' which makes no sense. Hence I want to separate the toc counter from the part definition.

MWE -

\documentclass[11pt]{book}
\raggedright
\usepackage[hidelinks]{hyperref}

\begin{document}
    \frontmatter
    \tableofcontents
    \mainmatter
    \part{The Part}
    \chapter{The Chapter}
    \section{The Section}
\end{document}

This is just an additional thought and not the main issue, but as I am also using hyperref and it automatically creates the outline for the pdf. As of now I am seeing the same entity which is in the part definition in the outline also.

enter image description here

This means if we replace the counter with a bullet it will be changed in the outline too, therefore I'll prefer a unicode-based bullet. Is it possible?

4
  • If you look in the aux file, you will see \numberline{I} The Part which was created by \part using \addcontentsline. You will have to modify \part to not do that. See tex.stackexchange.com/questions/490987/… Commented May 17, 2019 at 19:11
  • But if I change \part, won't it also change the part name in the document? eg. I'm getting I. Part in the toc, which I don't want, but because of the same definition I'm also getting Part I in the document. I don't want to loose it. So is there any way to separate these two?
    – Niranjan
    Commented May 18, 2019 at 4:03
  • @JohnKormylo please check the screenshots attached.
    – Niranjan
    Commented May 18, 2019 at 4:04
  • The link was to show an example of replacing \part, not to implement your particular modifications. Commented May 18, 2019 at 15:09

1 Answer 1

3

in book the formatting of the part entry in the toc is quite hard-coded. So you need to redefine an internal command (before loading hyperref). This will change both the toc and the bookmarks:

\documentclass[11pt]{book}
\usepackage{etoolbox}
\makeatletter
\patchcmd\@part{\thepart}{\textbullet}{}{\fail}
\makeatother
\raggedright
\usepackage[hidelinks]{hyperref}


\begin{document}
    \frontmatter
    \tableofcontents
    \mainmatter
    \part{The Part}
    \chapter{The Chapter}
    \section{The Section}
\end{document}

enter image description here

enter image description here

5
  • Thank you so much man! Great job
    – Niranjan
    Commented May 19, 2019 at 12:42
  • 1
    I'm not a man, I'm a woman. Commented May 19, 2019 at 12:43
  • Lol. I'm sorry for that, but thanks a ton.
    – Niranjan
    Commented May 19, 2019 at 12:47
  • What if one wants to change the toc and not the outline? Is there any way to redefine toc separately and outline separately?
    – Niranjan
    Commented May 26, 2019 at 7:06
  • If you have a new question ask a new question don't ping only me for support. Commented May 26, 2019 at 7:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .