It seems like a simple problem but it is not clear how to fix it.
Consider this
\renewcommand{\thesection}{\arabic{section} ABCXYZ}
...
\tableofcontents
\section{The title of the section}
will produce an overlap between the number "1" and "The title of the section" and ABCXYZ.
The distance between the number and the title is fixed by table of contents. It is not variable. You cannot put anything there. It is of course the same issue as when the section number is too is long compared to the fixed distance: \setcounter{section}{1000}
The following solution
\makeatletter\renewcommand*\l@section{\@dottedtocline{1}{...}{...}}\makeatother
works more or less.
However it seems to reset some of the normal toc parameters.
At least it visibly resets section numbers and section titles being bold while subsection tiles and subsubsection titles are not bold. The page numbers for sections also cease to be bold. Become like subsections page numbers in the toc.
That is bad.
Wrapping in
\textbf{arabic{section}}
inside \renewcommand{\thesection}
does work. But ... it cannot reach the section title.
\section{\textbf{TITLE IS HERE}}
is less than ideal for various reasons.
Q: How do we get the rest of ordinary boldface and formatting in the default toc back after renewing *l@section?
Without any packages please.
A subquestion is this: I define a length and set width of it to be the length of the ```\arabic{section} ABCXYZ'' and now, having set the section toc distance pretty large, I wish to substract this variable distance.
The result would be that section number being small does not have a large space between it and the title. It seems that \renewcommand{\thesection}{...}
is the wrong place to put it. It would not affect the spacing of the section title.
Q: What else needs to be renewed and where is the correct place to paste an hspace{\correction} object to affect the section title as it appears in the table of contents.
Probably this is exactly the same place as where default formatting can also be reconstructed.