Quiere agregar un hipervínculo en ToC, LoF y LoT pero obtuvo un error al usar Hyperref

Quiere agregar un hipervínculo en ToC, LoF y LoT pero obtuvo un error al usar Hyperref

Quiero que se pueda hacer clic en el capítulo, sección y subsección de ToC, LoF y LoT. He leído algunos posibles duplicados, pero no estoy satisfecho y no responden a mi pregunta. No mencionan cómo hacer eso y el mío es un error cada vez que solo agrego \usepackage{hyperref}. Por cierto, los mensajes de error son:

Secuencia de control indefinida \tableofcontents

Secuencia de control indefinida \tableofcontents

Secuencia de control indefinida \tableofcontents

archivo toc antiguo detectado, no utilizado; ejecute LaTeX nuevamente.

Y quiero que cuando hago clic en la lista de figuras y tablas me dirija a figuras y tablas. Hasta ahora, no puedo encontrar nada sobre eso.

No sé cómo es posible, porque uso muchos personalizados en mi ToC.

De todos modos aquí está mi MWE. No es compilable ya que mi documento está separado en algunas partes y no es posible incluirlas todas aquí. Perdón por hacerte perder el tiempo, pero espero que puedas ayudarme. Gracias.

Editar : El archivo de registro decía \MakeUppercase UnsupportedInPdfStrings

\documentclass[a4paper,12pt,oneside,openany]{book}
\usepackage{pgf, tikz}
\usepackage[a4paper, inner=4cm, outer=3cm, top=4cm, bottom=3cm]{geometry}
\usepackage{geometry}
\usepackage[onehalfspacing]{setspace}
\usepackage{fancyhdr}
\usepackage{titlesec}
\usepackage{setspace}
\usepackage[titles]{tocloft}
\usepackage{tocbibind}
\usepackage{indentfirst}
\usepackage{blindtext}
\usepackage{tocloft}
\usepackage{etoolbox}
\usepackage[none]{hyphenat}
\sloppy
\usepackage{times}
\usepackage{enumitem}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amsthm}
\usepackage[utf8]{inputenc}
\usepackage{array}
\usepackage[column=O]{cellspace}
\usepackage{caption}
\usepackage{afterpage}
\usepackage{mathtools}
\usepackage{subcaption}
\usepackage{wrapfig}
\usepackage{cancel}
\usepackage{longtable}
\usepackage[indonesian]{babel}
\usepackage{lipsum}
\usepackage{pdflscape}
\usepackage{makecell} 
\usepackage{ragged2e}
\usepackage{natbib}
%\usepackage[]{hyperref}
%
%\hypersetup{
%   linktoc=all
%}

\newlist{ColEnum}{enumerate}{1}
\setlist[ColEnum,1]{label = \arabic*), left = 0pt, nosep, 
    before= {\begin{minipage}[t]{\hsize}\RaggedRight},
        after = {\end{minipage}}}

\DeclareMathOperator{\Res}{Res}
\numberwithin{equation}{section}

\setlength{\cellspacetoplimit}{5pt}
\setlength{\cellspacebottomlimit}{4pt}
\setlength\bibhang{25pt}

\theoremstyle{plain}
\newtheorem{thm}{Teorema}[section]
\newtheorem{cl}{Corollary}[section]
\newtheorem{lm}{Lemma}[section]

\theoremstyle{definition}
\newtheorem{defn}{Definisi}[section]
\newtheorem{exmp}{Contoh}
\renewcommand{\proofname}{\rm\bf{Bukti}}

\renewcommand\tablename{Tabel}
\renewcommand\figurename{Gambar}


\patchcmd{\section}{\bfseries}{\bfseries\boldmath}{}{}
\patchcmd{\tableofcontents}{\contentsname}{\MakeUppercase\contentsname}{}{}
\patchcmd{\listoffigures}{\listfigurename}{\MakeUppercase\listfigurename}{}{}
\patchcmd{\listoftables}{\listtablename}{\MakeUppercase\listtablename}{}{}
\setlength{\cftbeforesecskip}{10pt}
\setlength{\cftbeforesubsecskip}{10pt}

\fancyhf{}
\cfoot{\thepage}
\linespread{1.5}
\pagestyle{plain}
\renewcommand{\cftchapleader}{\cftdotfill{\cftdotsep}}
\renewcommand{\cftdotsep}{1}
\renewcommand\cftchapdotsep{\cftdotsep}
\renewcommand{\cftchapfont}{\bfseries}
\renewcommand{\cftsecfont}{\bfseries}
\renewcommand{\cftchappagefont}{}
\titleformat{\chapter}[block]
    {\normalfont\bfseries\centering}
    {}{0pt}{}
\titleformat{\section}
    {\normalfont\bfseries}
    {\thesection}{1em}{}
\titleformat{\subsection}
    {\normalfont\bfseries}
    {\thesubsection}{1em}{}
\titlespacing*{\chapter}{0pt}{0pt}{20pt}
\titlespacing*{\section}{0pt}{0pt}{0pt}
\titlespacing*{\subsection}{0pt}{0pt}{0pt}

\renewcommand{\contentsname}{DAFTAR ISI}
\renewcommand{\listtablename}{DAFTAR TABEL}
\renewcommand{\listfigurename}{DAFTAR GAMBAR}
\newcommand\dd{\mathop{}\!\mathrm{d}}

%\addtocontents{toc}{\protect\null\protect\hfill{Halaman}\protect\par}
\setlength\parindent{1.25cm} 

\addtocontents{toc}{~\hfill{Halaman}\par}
%\addtocontents{toc}{\protect\afterpage{~\hfill{Halaman}\par\medskip}}
\addtocontents{lot}{~\hfill{Halaman}\par}
\addtocontents{lof}{~\hfill{Halaman}\par}

\makeatletter
\def\ttl@mkchap@i#1#2#3#4#5#6#7{%
    \ttl@assign\@tempskipa#3\relax\beforetitleunit
    \vspace{\@tempskipa}%<<<<<< REMOVE THE * AFTER \vspace
    \global\@afterindenttrue
    \ifcase#5 \global\@afterindentfalse\fi
    \ttl@assign\@tempskipb#4\relax\aftertitleunit
    \ttl@topmode{\@tempskipb}{%
        \ttl@select{#6}{#1}{#2}{#7}}%
    \ttl@finmarks  % Outside the box!
    \@ifundefined{ttlp@#6}{}{\ttlp@write{#6}}}
\makeatother

\begin{document}

\clearpage
\thispagestyle{empty}
\include{cover1}
\frontmatter %

\pagestyle{fancy}   
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\bibname}{DAFTAR PUSTAKA}

\include{cover2}
\begin{spacing}{0.1}
    \tableofcontents
    
\end{spacing}
\begin{spacing}{1.5}
    \listoffigures
    \listoftables
\end{spacing}

\mainmatter 
\pagestyle{fancyplain}
\fancyhf{}
\fancyhead[R]{\thepage}
\renewcommand{\headrulewidth}{0pt}
\include{bab1}
\include{bab2}
\include{bab3}

\backmatter
\bibliography{dafpus}
\bibliographystyle{unejstyle}
\nocite{*}
\include{lampiran}


\end{document}

Respuesta1

\texorpdfstringfunciona para mi. Sólo necesito editar en mi\patchcmd

Entonces se convierte en:

\patchcmd{\tableofcontents}{\contentsname}{\texorpdfstring{\MakeUppercase\contentsname}{\contentsname}}{}{}
\patchcmd{\listoffigures}{\listfigurename}{\texorpdfstring{\MakeUppercase\listfigurename}{\listfigurename}}{}{}
\patchcmd{\listoftables}{\listtablename}{\texorpdfstring{\MakeUppercase\listtablename}{\listtablename}}{}{}

información relacionada