0

There are two contents in my TeX: 'toc'(system-defined) and 'toch'(user-defined) as what I show in the below example.

\documentclass{article}

\makeatletter
\def\chcontentsname{CONTENTS}
\newcommand\tableofchcontents{
   \section*{\chcontentsname}
   \@starttoc{toch}
   }
\makeatother

\newcommand{\BiSection}[2]
{   \section{#1}
    \addcontentsline{toch}{section}{\protect\numberline{\csname thesection\endcsname}#2}
}

\begin{document}
\tableofcontents
\tableofchcontents

\BiSection{S1}{SECTION1}
\BiSection{S2}{SECTION2}


\end{document}

Here is the situation: I want to to make the title of sections coincides with the user-defined content(toch) while it auto coincides with system-defined content(toc) now.

Is there any way to control the process of '\addcontentsline{toc}' in command '\section' artificially? Like to make some '\renewcommand' to prevent the autogeneration of 'toc'?

  • 1
    Welcome. Could you please add a minimal example? – user156344 Mar 26 at 12:37
  • 1
    I really don't understand what you want to achieve. Would you please clarify? – Andreas Storvik Strauman Mar 27 at 6:38
  • Do you want to change the behavior of \addcontentsline command to your \tableofchcontents? – subham soni Mar 27 at 7:42
  • Yes, but I also need to change the behavior of \addcontentsline command of \section. In conclusion, I want to exchange the content of toc and toch. – 尹海安 Mar 27 at 7:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.