I'm trying to produce a document using the memoir class and the hyperref package. Unfortunately, I get a lot of errors when I try to use the linktocpage option of the hyperref package with \renewcommand{\cftchapterpagefont}{\textrm}.
I guess the solution will be on the lines of this answer to a similar problem, but I haven't been able to figure it out. Here is a minimal working example:
\documentclass[openany,oneside,11pt]{memoir}
\NeedsTeXFormat{LaTeX2e}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Turkish character and language support
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[turkish,shorthands=:!]{babel}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Required packages
\RequirePackage{amssymb,amsmath,hyperref,multicol,ifthen,graphicx,pifont,rotating,xcolor}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The TOC
\cftsetindents{part}{0em}{3.0em}% Indendation and numwidth for part titles in the TOC
\cftsetindents{chapter}{1em}{2.0em}% Indendation and numwidth for chapter titles in the TOC
\setlength{\cftbeforechapterskip}{0pt}% No gap between chapter titles in the TOC
\renewcommand{\cftchapterfont}{\textrm}% Chapter title font in the TOC
\renewcommand{\cftchapterpagefont}{\textrm}% Clashes with the "linktocpage" option of the hyperref package
\renewcommand{\cftpartafterpnum}{\par % Thanks to https://tex.stackexchange.com/a/42500
\vspace{-2\baselineskip} \hskip -\memRTLleftskip\protect\mbox{}\protect\hrulefill\par%
\vspace{0.5\baselineskip} \hskip -\memRTLleftskip\protect\mbox{}\protect\hrulefill\par}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% hyperref setup
\hypersetup{%
unicode={true}, %
bookmarks={true}, %
colorlinks={true}, %
allcolors={kmavi},%
linktocpage={true}, % In TOC, links and colors for page numbers only.
pdfdisplaydoctitle={true}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The colors
\definecolor{kmavi}{RGB}{0,80,117}
\definecolor{mavi}{RGB}{0,115,168}
\begin{document}
\currentpdfbookmark{Table of Contents}{name}
\tableofcontents*
\part{My First Part}
\chapter{My First Chapter}
\chapter{My Second Chapter}
\end{document}
\renewcommand{\cftchapterpagefont}{\textrm}does not look really healthy there. Try\renewcommand{\cftchapterpagefont}{\rmfamily}instead – Jun 08 '17 at 23:52hyperrefat the end of the preamble almost always, not somewhere in between. – Jun 09 '17 at 00:03