I tried following the same as in How to automatically put a [Go To Summary] | [Go Back] on each section?:
\documentclass{memoir}
\usepackage{etoolbox}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc} % fix utf8 encoding problems
\usepackage{newtxtext,newtxmath} % updated times new roman font
\usepackage{xcolor}
\definecolor{link_color}{RGB}{26,13,178}
\definecolor{ultramarine}{RGB}{0,32,96}
\usepackage[backref,colorlinks,linkcolor=link_color]{hyperref}
\newcommand{\goToSummaryText}
{
\small\mdseries
\hyperlink{summary} {\textcolor{ultramarine}{{ } [Go To Top]}}
{{ }|}
\Acrobatmenu{GoBack}{\textcolor{ultramarine}{{ } [Go Back]}}
}
% How can the go to summary be fixed so does not throw all these errors?
% https://tex.stackexchange.com/questions/388045/how-can-the-go-to-summary-be-fixed
\makeatletter
\newcommand{\addGoToSummary}
{%
\renewcommand{\Sectionformat}[2]{##1 \protect\goToSummaryText}
\renewcommand{\Chapterformat}[2]{##1 \protect\goToSummaryText}
}
\newcommand{\removeGoToSummary}
{
\renewcommand{\Sectionformat}[2]{##1}
\renewcommand{\Chapterformat}[2]{##1}
}
\makeatother
\let\oldtableofcontents\tableofcontents
\renewcommand{\tableofcontents}
{
% Insert internal document link
\hypertarget{summary}
\oldtableofcontents
}
\begin{document}
\addGoToSummary
\tableofcontents
\chapter*{Foreword}
\addcontentsline{toc}{chapter}{Foreword}
\chapter*{Abstract}
\addcontentsline{toc}{chapter}{Abstract}
\chapter{Chapter One}
\section{Section One One}
\section{Section One Two}
\section{Section One Three}
\section{Section One Four}
\end{document}
But it stopped working completely:
It should be something like this bellow, I mounted it with paint. I am not sure how exactly it could be, but should follow something like is fine:
Update
I had forgot to call \addGoToSummary, now I fixed the main code but now I got the error:
test2.tex:48: LaTeX Error: \Chapterformat undefined.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help
TeX STOPPED: fatal errors occurred. Check the TeX log file for details
The question is actually what is the equivalent to \Sectionformat on memoir class.









