更新

更新

关于这个问题如何在每个部分自动添加[转至摘要] | [返回]?我学会了如何go to summary在文本的每个部分上创建一个。但是现在当我更改它时,出现了错误:

\documentclass[10pt,a5paper,twoside]{abntex2}

对此:

\documentclass[10pt,a5paper,twoside,chapter=TITLE,section=TITLE]{abntex2}

当我删除部分命令时,错误也得到了修复go to summary

这是一个有错误的例子,即使用chapter=TITLE,section=TITLE

\documentclass[10pt,a5paper,twoside,chapter=TITLE,section=TITLE]{abntex2}

% Incompatible color definition when using tikz with color package
% https://tex.stackexchange.com/questions/150369/incompatible-color-definition-when-using-tikz-with-color-package
\usepackage{xcolor}

\definecolor{darkblue}{RGB}{26,13,178}
\definecolor{darkgreen}{rgb}{0,0.6,0}
\hypersetup{colorlinks,linkcolor=darkblue,citecolor=darkgreen}

% How to automatically put a [Go To Summary] | [Go Back] on each section?
% https://tex.stackexchange.com/questions/367859/how-to-automatically-put-a-go-to-summary-go-back-on-each-section
\definecolor{ultramarine}{RGB}{0,32,96}

\makeatletter
\newcommand{\goToSummaryText}
{
    \hyperlink{summary} {\textcolor{ultramarine}{\small\mdseries [Go To Top]}}
    {\small\mdseries |}
    \Acrobatmenu{GoBack}{\textcolor{ultramarine}{\small\mdseries [Go Back]}}
}
\newcommand{\addGoToSummary}{\renewcommand{\Sectionformat}[2]{##1 \goToSummaryText}}
\newcommand{\removeGoToSummary}{\renewcommand{\Sectionformat}[2]{##1}}

\let\oldtableofcontents\tableofcontents
\renewcommand{\tableofcontents}
{
    % Insert internal document link
    \hypertarget{summary}
    \oldtableofcontents
}
\makeatother
\begin{document}

\tableofcontents*
\addGoToSummary

\chapter[Nullam]{Nullam elementum}
Nullam elementum

\section[Some encoding tests]{showfont}
\end{document}

仅通过一个命令运行这个简单示例,\section我就得到了几个错误:

! Undefined control sequence.
\hyper@@link ->\let \Hy@reserved@a 
                                   \relax \@ifnextchar [{\hyper@link@ }{\hyp...
l.41 \section[Some encoding tests]{showfont}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Use of \hyper@link@ doesn't match its definition.
<argument> \def 

l.41 \section[Some encoding tests]{showfont}

If you say, e.g., `\def\a1{...}', then you must always
put `1' after `\a', since control sequence names are
made up of letters only. The macro here has not been
followed by the required stuff, so I'm ignoring it.

! Undefined control sequence.
\@calc@post@scan ...st@scan \else \def \calc@next 
                                                  {\calc@error #1}\fi \fi \f...
l.41 \section[Some encoding tests]{showfont}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\@calc@post@scan ...fi \fi \fi \fi \fi \calc@next 

l.41 \section[Some encoding tests]{showfont}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\GTS@RemoveLeft ...{}{}\GTS@Nil }\edef \GTS@Token 
                                                  {\the \toks@ }\GTS@Predefi...
l.41 \section[Some encoding tests]{showfont}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\GTS@TestLeft #1#2->\def \GTS@temp 
                                   {#1}\ifx \GTS@temp \GTS@Token \toks@ \exp...
l.41 \section[Some encoding tests]{showfont}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
<argument> \Hy@phantomsection 

l.41 \section[Some encoding tests]{showfont}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\GTS@RemoveLeft ...{}{}\GTS@Nil }\edef \GTS@Token 
                                                  {\the \toks@ }\GTS@Predefi...
l.41 \section[Some encoding tests]{showfont}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\GTS@TestLeft #1#2->\def \GTS@temp 
                                   {#1}\ifx \GTS@temp \GTS@Token \toks@ \exp...
l.41 \section[Some encoding tests]{showfont}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
<argument> \Hy@phantomsection 

l.41 \section[Some encoding tests]{showfont}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\GTS@RemoveLeft ...{}{}\GTS@Nil }\edef \GTS@Token 
                                                  {\the \toks@ }\GTS@Predefi...
l.41 \section[Some encoding tests]{showfont}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\GTS@TestLeft #1#2->\def \GTS@temp 
                                   {#1}\ifx \GTS@temp \GTS@Token \toks@ \exp...
l.41 \section[Some encoding tests]{showfont}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
<argument> \Hy@phantomsection 

l.41 \section[Some encoding tests]{showfont}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\GTS@RemoveLeft ...{}{}\GTS@Nil }\edef \GTS@Token 
                                                  {\the \toks@ }\GTS@Predefi...
l.41 \section[Some encoding tests]{showfont}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\GTS@TestLeft #1#2->\def \GTS@temp 
                                   {#1}\ifx \GTS@temp \GTS@Token \toks@ \exp...
l.41 \section[Some encoding tests]{showfont}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
<argument> \Hy@phantomsection 

l.41 \section[Some encoding tests]{showfont}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\GTS@RemoveLeft ...{}{}\GTS@Nil }\edef \GTS@Token 
                                                  {\the \toks@ }\GTS@Predefi...
l.41 \section[Some encoding tests]{showfont}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\GTS@TestLeft #1#2->\def \GTS@temp 
                                   {#1}\ifx \GTS@temp \GTS@Token \toks@ \exp...
l.41 \section[Some encoding tests]{showfont}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
<argument> \Hy@phantomsection 

l.41 \section[Some encoding tests]{showfont}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\GTS@RemoveLeft ...{}{}\GTS@Nil }\edef \GTS@Token 
                                                  {\the \toks@ }\GTS@Predefi...
l.41 \section[Some encoding tests]{showfont}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\GTS@TestLeft #1#2->\def \GTS@temp 
                                   {#1}\ifx \GTS@temp \GTS@Token \toks@ \exp...
l.41 \section[Some encoding tests]{showfont}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
<argument> \Hy@phantomsection 

l.41 \section[Some encoding tests]{showfont}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\GTS@RemoveLeft ...{}{}\GTS@Nil }\edef \GTS@Token 
                                                  {\the \toks@ }\GTS@Predefi...
l.41 \section[Some encoding tests]{showfont}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\GTS@TestLeft #1#2->\def \GTS@temp 
                                   {#1}\ifx \GTS@temp \GTS@Token \toks@ \exp...
l.41 \section[Some encoding tests]{showfont}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
<argument> \Hy@phantomsection 

l.41 \section[Some encoding tests]{showfont}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\GTS@RemoveLeft ...{}{}\GTS@Nil }\edef \GTS@Token 
                                                  {\the \toks@ }\GTS@Predefi...
l.41 \section[Some encoding tests]{showfont}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\GTS@TestLeft #1#2->\def \GTS@temp 
                                   {#1}\ifx \GTS@temp \GTS@Token \toks@ \exp...
l.41 \section[Some encoding tests]{showfont}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
<argument> \Hy@phantomsection 

l.41 \section[Some encoding tests]{showfont}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\GTS@RemoveLeft ...{}{}\GTS@Nil }\edef \GTS@Token 
                                                  {\the \toks@ }\GTS@Predefi...
l.41 \section[Some encoding tests]{showfont}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\GTS@TestLeft #1#2->\def \GTS@temp 
                                   {#1}\ifx \GTS@temp \GTS@Token \toks@ \exp...
l.41 \section[Some encoding tests]{showfont}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
<argument> \Hy@phantomsection 

l.41 \section[Some encoding tests]{showfont}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\GTS@RemoveLeft ...{}{}\GTS@Nil }\edef \GTS@Token 
                                                  {\the \toks@ }\GTS@Predefi...
l.41 \section[Some encoding tests]{showfont}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\GTS@TestLeft #1#2->\def \GTS@temp 
                                   {#1}\ifx \GTS@temp \GTS@Token \toks@ \exp...
l.41 \section[Some encoding tests]{showfont}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
<argument> \Hy@phantomsection 

l.41 \section[Some encoding tests]{showfont}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\GTS@RemoveLeft ...{}{}\GTS@Nil }\edef \GTS@Token 
                                                  {\the \toks@ }\GTS@Predefi...
l.41 \section[Some encoding tests]{showfont}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\GTS@TestLeft #1#2->\def \GTS@temp 
                                   {#1}\ifx \GTS@temp \GTS@Token \toks@ \exp...
l.41 \section[Some encoding tests]{showfont}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
<argument> \Hy@phantomsection 

l.41 \section[Some encoding tests]{showfont}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\GTS@RemoveLeft ...{}{}\GTS@Nil }\edef \GTS@Token 
                                                  {\the \toks@ }\GTS@Predefi...
l.41 \section[Some encoding tests]{showfont}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\GTS@TestLeft #1#2->\def \GTS@temp 
                                   {#1}\ifx \GTS@temp \GTS@Token \toks@ \exp...
l.41 \section[Some encoding tests]{showfont}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
<argument> \Hy@phantomsection 

l.41 \section[Some encoding tests]{showfont}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\GTS@RemoveLeft ...{}{}\GTS@Nil }\edef \GTS@Token 
                                                  {\the \toks@ }\GTS@Predefi...
l.41 \section[Some encoding tests]{showfont}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\GTS@TestLeft #1#2->\def \GTS@temp 
                                   {#1}\ifx \GTS@temp \GTS@Token \toks@ \exp...
l.41 \section[Some encoding tests]{showfont}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
<argument> \Hy@phantomsection 

l.41 \section[Some encoding tests]{showfont}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\GTS@RemoveLeft ...{}{}\GTS@Nil }\edef \GTS@Token 
                                                  {\the \toks@ }\GTS@Predefi...
l.41 \section[Some encoding tests]{showfont}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\GTS@TestLeft #1#2->\def \GTS@temp 
                                   {#1}\ifx \GTS@temp \GTS@Token \toks@ \exp...
l.41 \section[Some encoding tests]{showfont}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

运行上面的示例,chapter=TITLE,section=TITLE正​​确删除将生成如下文档:

在此处输入图片描述 在此处输入图片描述

如何go to summary修复它以避免chapter=TITLE,section=TITLE抛出所有这些错误?


更新

在发布此问题之前,我没有创建一个最小示例。现在我要深入研究我的主要文档,以找出如何正确重现此问题。

我已经解决了存在真正错误/问题的问题。

答案1

\documentclass[10pt,a5paper,twoside,chapter=TITLE,section=TITLE]{abntex2}
% https://tex.stackexchange.com/questions/150369/incompatible-color-definition-when-using-tikz-with-color-package
\usepackage{xcolor}
\definecolor{darkblue}{RGB}{26,13,178}
\definecolor{darkgreen}{rgb}{0,0.6,0}
\hypersetup{colorlinks,linkcolor=darkblue,citecolor=darkgreen}
% https://tex.stackexchange.com/questions/367859/how-to-automatically-put-a-go-to-summary-go-back-on-each-section
\definecolor{ultramarine}{RGB}{0,32,96}
\newcommand{\goToSummaryText}
{%
  \small\mdseries%
  \hyperlink{summary} { \textcolor{ultramarine}{[Go To Top]}}%
  |%
  \Acrobatmenu{GoBack}{ \textcolor{ultramarine}{[Go Back]}}%
}
\newcommand{\addGoToSummary}{\renewcommand{\Sectionformat}[2]{##1 \protect\goToSummaryText}}
\newcommand{\removeGoToSummary}{\renewcommand{\Sectionformat}[2]{##1}}
\let\oldtableofcontents\tableofcontents
\renewcommand{\tableofcontents}
{%
    \hypertarget{summary}%
    \oldtableofcontents
}
\begin{document}
\tableofcontents*
\addGoToSummary
\chapter[Nullam]{Nullam elementum}
Nullam elementum
\section[Some encoding tests]{showfont}
\end{document}

我不知道所有的箭都射向了哪里,但我没有看到它们。

答案2

这是我修复的最小示例@cfr帮助另一个答案,但分别用箭头和替换文本[Go To Top]和:[Go Back]$\leftleftarrows$$\leftarrow$

\documentclass[10pt,a5paper,twoside,chapter=TITLE,section=TITLE]{abntex2}

% Incompatible color definition when using tikz with color package
% https://tex.stackexchange.com/questions/150369/incompatible-color-definition
\usepackage{xcolor}

\definecolor{darkblue}{RGB}{26,13,178}
\definecolor{darkgreen}{rgb}{0,0.6,0}
\hypersetup{colorlinks,linkcolor=darkblue,citecolor=darkgreen}

% How to automatically put a [Go To Summary] on each section?
% https://tex.stackexchange.com/questions/367859/how-to-automatically-put-a-go-to
\definecolor{ultramarine}{RGB}{0,32,96}
\RequirePackage{xpatch}

% The Comprehensive LATEX Symbol List
% http://tug.ctan.org/info/symbols/comprehensive/symbols-a4.pdf
\RequirePackage{MnSymbol}
\RequirePackage{hyperref}
\newcommand{\goToSummaryText}{{%
    \small\mdseries
    \hyperlink{summary}{\textcolor{ultramarine}{$\leftleftarrows$}}
    {$|$}
    \Acrobatmenu{GoBack}{\textcolor{ultramarine}{$\leftarrow$}}
}}
\makeatletter
    \newif\ifismemoirloaded\ismemoirloadedfalse
    \newif\ifisabntexloaded\isabntexloadedfalse
    \@ifclassloaded{memoir}{%
        \ismemoirloadedtrue%
    }{}
    \@ifclassloaded{abntex2}{%
        \isabntexloadedtrue%
    }{}
    \newcommand{\addGoToSummary}
    {%
        \@ifundefined{printparttitle}{\message{printparttitle patch for addGoToSummary could NOT
                    be applied because there is no printparttitle command available!^^J}}{%
            \let\oldAddGoToprintparttitle\printparttitle
            \xapptocmd{\printparttitle}{~\protect\goToSummaryText}{}{}
        }
        \@ifundefined{Sectionformat}{\message{Sectionformat patch for addGoToSummary could NOT
                    be applied because there is no Sectionformat command available!^^J}}{%
            \let\oldAddGoToSectionformat\Sectionformat
            \xapptocmd{\Sectionformat}{~\protect\goToSummaryText}{}{}
        }
        \ifismemoirloaded
            \ifisabntexloaded
                \let\oldAddGoToABNTEXchapterupperifneeded\ABNTEXchapterupperifneeded
                \xapptocmd{\ABNTEXchapterupperifneeded}{~\protect\goToSummaryText}{}{}
            \else
                \let\oldAddGoToprintchaptertitle\printchaptertitle
                \xapptocmd{\printchaptertitle}{~\protect\goToSummaryText}{}{}
            \fi
        \else
            \@ifundefined{Chapterformat}{\message{Chapterformat patch for addGoToSummary could NOT
                        be applied because there is no Chapterformat command available!^^J}}{%
                \let\oldAddGoToChapterformat\Chapterformat
                \xapptocmd{\Chapterformat}{~\protect\goToSummaryText}{}{}
            }
        \fi
    }
    \newcommand{\removeGoToSummary}
    {%
        \@ifundefined{oldAddGoToprintparttitle}{}{\let\printparttitle\oldAddGoToprintparttitle}
        \@ifundefined{oldAddGoToSectionformat}{}{\let\Sectionformat\oldAddGoToSectionformat}
        \ifismemoirloaded
            \ifisabntexloaded
                \@ifundefined{oldAddGoToABNTEXchapterupperifneeded}{}{\let\ABNTEXchapterupperifneeded\oldAddGoToABNTEXchapterupperifneeded}
            \else
                \@ifundefined{oldAddGoToprintchaptertitle}{}{\let\printchaptertitle\oldAddGoToprintchaptertitle}
            \fi
        \else
            \@ifundefined{oldAddGoToChapterformat}{}{\let\Chapterformat\oldAddGoToChapterformat}
        \fi
    }
\makeatother
\let\oldAddGoTotableofcontents\tableofcontents
% Insert internal document link
\renewcommand{\tableofcontents}{%
    \hypertarget{summary}%
    \oldAddGoTotableofcontents%
}

\begin{document}

\tableofcontents*
\addGoToSummary

\chapter[Nullam]{Nullam elementum}
Nullam elementum

\section[Some encoding tests]{showfont}
\end{document}

在此处输入图片描述 在此处输入图片描述


与所用修复方法相关的问题\protect

  1. 最小 \protected@edef 示例
  2. \protect 的用途是什么?
  3. 脆弱命令和坚固命令之间有什么区别?

相关问题:

  1. 为什么 abntex2 类在章节标题后插入新行?
  2. 如何在每个部分自动添加[转至摘要] | [返回]?
  3. 如何修复转到摘要以便 \section[Some]{Some more} 不会抛出所有这些错误?
  4. 回忆录类中的“\Sectionformat”与“\Chapterformat”等效的是什么?
  5. 为什么 xapptocmd 要减少 \partname 和 \parttile 之间的垂直空间?

相关内容