Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Shown in the following pic:

enter image description here

It seems the Roman page number for front-matter look too dark in ToC, so how to make it as normal font but not change the bold Arabic number for chapters?

share|improve this question
    
What \documentclass are you using? –  Werner Dec 29 '12 at 0:28
    
I am using book class for dissertation writing. And the title of front matter is like: \chapter{Abstract} ... etc. –  KOF Dec 29 '12 at 0:34
add comment

2 Answers

up vote 5 down vote accepted

Your global setting may differ slightly, but the following works:

enter image description here

\documentclass{book} 
\makeatletter
\def\@pnum@font{\bfseries}% Default is \bfseries
\renewcommand*\l@chapter[2]{% Taken from book.cls
  \ifnum \c@tocdepth >\m@ne
    \addpenalty{-\@highpenalty}%
    \vskip 1.0em \@plus\p@
    \setlength\@tempdima{1.5em}%
    \begingroup
      \parindent \z@ \rightskip \@pnumwidth
      \parfillskip -\@pnumwidth
      \leavevmode \bfseries
      \advance\leftskip\@tempdima
      \hskip -\leftskip
      #1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss\@pnum@font #2}\par
      \penalty\@highpenalty
    \endgroup
  \fi}
\g@addto@macro{\frontmatter}{\addtocontents{toc}{\protect\def\protect\@pnum@font{\normalfont}}}
\g@addto@macro{\mainmatter}{\addtocontents{toc}{\protect\def\protect\@pnum@font{\bfseries}}}
\makeatother
\begin{document}
\tableofcontents
\frontmatter
\chapter{Acknowledgements}
\chapter{Abstract}
\chapter{List of Figures}
\chapter{List of Tables}
\chapter{Nomenclature}
\mainmatter
\chapter{Introduction}
\section{Problem and motivation}
\section{Objectives}
\section{Research and methodology}
\subsection{Continuum}
%...
\end{document}

The macro responsibly for setting the \chapter titles in the ToC is \l@chapter. I've copied it from book.cls and inserted \@pnum@font where it sets the actual page number. By default, this has been defined to be \bfseries so that it prints in bold. Adding a \normalfont modification to \frontmatter and reversing it at \mainmatter (both using \g@addto@macro) causes a display that you're after.

Since writing to the ToC has to be done with care (to avoid expansion), using \protect is necessary.

share|improve this answer
    
The following is inspired by your code \let\l@ochapter\l@chapter \def\l@nchapter#1#2{\l@ochapter{#1}{\mdseries #2}} \g@addto@macro{\frontmatter}{\addtocontents{toc} {\string\bgroup\let\string\l@chapter\string\l@nchapter}} \g@addto@macro{\mainmatter}{\addtocontents{toc}{\string\egroup}} –  jfbu Dec 29 '12 at 8:29
add comment

It nearly works in my case. See. enter image description here

[XeLatex in Texlive 2012 Ubuntu]

The first front page number is bold and the chapter 1 number is normal.

I don't know why this happened, here is the tex code:

 \documentclass[a4paper,12pt]{book}
 \include{Setting/settings}    % <----- page layout, font, renewcommands etc.

 \begin{document}
 \include{Cover/cover}     % cover page
 \frontmatter              % book mode only

 \pagenumbering{Roman}   
 \include{Acknowledgement/acknowledgement}
 \include{Abstract/abstract}

 {\hypersetup{linkcolor=black}
 \tableofcontents }
 \listoffigures  
 \listoftables  
 \printnomenclature[1.6 cm]  
 \clearpage

 \mainmatter % book mode only
 \include{Introduction/introduction}
 \include{Chapter2/chapter2}
 \include{Chapter3/chapter3}
 \include{Chapter4/chapter4}
 \include{Conclusions/conclusions}

 ....

TOC content

\contentsline {chapter}{Acknowledgements}{i}{chapter*.1}
\def \@pnum@font {\normalfont }
\contentsline {chapter}{Abstract}{iii}{chapter*.2}
\contentsline {chapter}{List of Figures}{vii}{chapter*.4}
\contentsline {chapter}{List of Tables}{ix}{chapter*.5}
\contentsline {chapter}{Nomenclature}{xi}{chapter*.6}
\contentsline {chapter}{\numberline {1}Introduction}{1}{chapter.1}
\contentsline {section}{\numberline {1.1}Problem and motivation}{1}{section.1.1}
\contentsline {section}{\numberline {1.2}Objectives}{3}{section.1.2}
\contentsline {section}{\numberline {1.3}Research methodology}{4}{section.1.3}
\contentsline {subsection}{\numberline {1.3.1}Continuum}{4}{subsection.1.3.1}
\contentsline {subsection}{\numberline {1.3.2}Discontinuum}{4}{subsection.1.3.2}
\contentsline {section}{\numberline {1.4}Thesis outline}{6}{section.1.4}
\def \@pnum@font {\bfseries }
\contentsline {chapter}{References}{9}{chapter*.7}
\contentsline {chapter}{Appendix A}{11}{appendix*.8}
\contentsline {chapter}{Appendix B}{13}{appendix*.9}

\usepackage[nottoc]{tocbibind} is used to exclude 'Contents' in the list. Only Chapter 1 is included for test.

If I put \def \@pnum@font {\normalfont } on top and \def \@pnum@font {\bfseries } below Nomenclature in TOC, then recompile it, it works. But if run Bibtex, the orders will be of course disturbed again.

share|improve this answer
    
It's not likely to deduce what might be going on from just seeing an image of the output. Moreover, this does not constitute and answer to your question; it should rather be included as part of your original post. That's just how things work around here. –  Werner Dec 29 '12 at 9:28
    
That's okay. But there is no way to add pic in comment? –  KOF Dec 29 '12 at 9:30
    
Upload the image as part of an "answer" in order to get a link, and then post the link in the comment. It won't show, but clicking on it will reveal it. I'll check back tomorrow (off to bed now). –  Werner Dec 29 '12 at 9:30
    
I can't see anything wrong with your code. Have you compiled at least twice? –  Werner Dec 29 '12 at 15:53
    
Here is the commands: xelatex thesis ----> bibtex thesis ----> xelatex thesis. Problem still persists. –  KOF Dec 29 '12 at 16:12
show 7 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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