[Tex/LaTex] The text instead of chapter number

page-numberingprogrammingtable of contents

I just get some code from Pretty Table of Contents and modify it for my purpose)).
But I need some variable text parameter or command for using instead of chapter number in the Table of Contents.
Something like new command for example:

\MyChapter{683(19)-021-15-T1}{The modernization of energetic system of someplace}

and this must create new chapter with number of "683(19)-021-15-T1" and name
"The modernization of energetic system of someplace" like

683(19)-021-15-T1

The modernisation of energetic system of someplace…………….15

or so.

Can you explain how can I do it?

There is "my" working code and a screenshot of created pdf file, but to my shame, I'm not too versed in the code of latex and didn't succeed in solving this problem((.
Can you explain how can I do it?
There is "my" working code, but to my shame, I'm not too versed in the code of latex and didn't succeed in solving this problem((.
enter image description here

\documentclass[a4paper,14pt]{extreport}
% debugging page breaks, but too short pageheight gives bad page breaks
% anyhow, despite my best efforts
%\usepackage[paperheight=12cm]{geometry}
\usepackage[table]{xcolor}
\usepackage{framed}
\usepackage{tikz}
\usepackage{lmodern}
\usepackage{etoc}
\usepackage[unicode,hidelinks]{hyperref}

%% THE FOLLOWING IS TAKEN (STOLEN) VERBATIM 
%% FROM GONZALO MEDINA'S ANSWER
% definition of some personal colors
\definecolor{myred}{RGB}{127,0,0}
\definecolor{myyellow}{RGB}{169,121,69}

% command for the circle for the number of part entries
\newcommand\Circle[1]{\tikz[overlay,remember picture] 
    \node[draw,circle, text width=18pt,line width=1pt,align=center] {#1};}

%% (jfbu) This defines an adjustable length, which gives the position of the
%% section and subsection from the left document margin.
\newlength{\tocmargin}
% Its value is set in the \etocsettocstyle command below, after \sffamily

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% USE OF framed package
\newenvironment{tocleftbar}
{\def\FrameCommand {\hspace{\dimexpr\tocmargin-4pt\relax}%
        {\color{myyellow}\vrule width 2.5pt depth 6pt}\hspace{10pt}%
        \hspace{-\tocmargin}}% 
    \MakeFramed {\leftskip\tocmargin\rightskip\tocmargin\FrameRestore}}
{\endMakeFramed}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\etocsetstyle{part}
{\nobreak\etocskipfirstprefix }
{\pagebreak[3]}% makes a page break before a Part favorable
{% debugging:
    \addvspace{1.15\baselineskip}%
    {\huge\centering
        \color{myyellow}\Circle{\makebox[0pt][c]{\etocnumber}}\\*[2.5ex]%
        \color{myred}{\Huge \etocname}\par}}
{}

\newif\ifintocleftbar

\etocsetstyle{chapter}
% don't break immediately after Part
{\nobreak\etocskipfirstprefix}
% but allow break after section or subsection
{\pagebreak[2]}
{% it seems that framed's code too easily allows a page break 
    % if some vertical glue is here, so let's use a \kern
    \kern\baselineskip
    \begin{tocleftbar}
        \intocleftbartrue
        \makebox[0pt][r]{\smash{\parbox{6em}%
                {\null\vspace*{5pt}\hfill\Huge\bfseries\color{myred}\etocpage
                    \hspace*{20pt}}}}%
        % use of \parbox, else framed.sty has a tendency to allow page breaks if
        % multi-line name
        \parbox[t]{\dimexpr\hsize-2\tocmargin\relax}
        {\large\textbf{\etoclink{Chapter~\etocthenumber}}%
            %\\* does not do what I want. \par\nobreak does.
            % But as we are now in \parbox, does not matter
            \par\etocname\rule[-\baselineskip]{0pt}{0pt}}%
        \par
        \normalsize\leftskip\dimexpr\leftskip+52pt\relax}
    {}

    \etocsetstyle {section}
    % avoid break after Chapter
    {\nopagebreak[3]\vspace{-5pt}\etocskipfirstprefix}
    % allow break after previous subsection or section
    {\vspace {1pt plus .2pt minus .2pt}}
    {\makebox[0pt][r]{\makebox[2.5em][l]{\etocnumber}}%
        \etocname
        \dotfill\nobreak{\itshape\color{myred}\etocpage}\par }
    {\end{tocleftbar}}

% IMPORTANT: this is ALSO executed if the last thing before the next chapter is a subsection

\etocsetstyle {subsection}
% avoid break immediately after section
{\nopagebreak[2]\vspace{1pt}\etocskipfirstprefix}
{\vspace {1pt plus .2pt minus .2pt}}%
{\makebox[0pt][r]{\makebox[2.5em][l]{\etocnumber}}\etocname
    \dotfill\nobreak{\itshape\color{myred}\etocpage}\par}
{}

\etocsettocstyle{\sffamily\setlength{\tocmargin}{4em}%
    {\Huge\bfseries\color{myred}\contentsname\par}%
    \leftskip 0pt\parindent 0pt }{}

\etocsetlevel {appendix}{0}


%=====================================================================================
%=====================================================================================
%=====================================================================================
%=====================================================================================
%=====================================================================================
%=====================================================================================
%=====================================================================================
%=====================================================================================
%=====================================================================================
%=====================================================================================
%=====================================================================================
%=====================================================================================
%=====================================================================================
%=====================================================================================
%=====================================================================================
\begin{document}
    % Use \tableofcontents* for memoir class, as the TOC itself should not
    % appear as a Chapter in the TOC. The * works also with book/report+etoc
    % but does nothing. 
    % With memoir and without *, the TOC defines a  not-very aesthetic
    % chapter entry in itself and one must un-comment the more complicated
    % etoc style for chapter above.
    % debugging
    % \hrule
\tableofcontents*

\part{Designing with \TeX\ and \LaTeX}

\localtableofcontents

\chapter{Beginning to learn design with \TeX}
\section{Another test section}
\section{Another test section}
\subsection{A test subsection}
\section{Another test section}
\subsection{A test subsection}
\subsection{A test subsection with a long title spanning more than one line in the table of contents}
\section{Another test section}
\section{Another test section}
\section{Another test section}
\subsection{A test subsection with a long title spanning more than one line in the table of contents}

% If this is un-commented the more sophisticated chapter style must be used.
%\chapter{A lone chapter without any sections}

\chapter{Beginning to learn design with \LaTeX}
\section{A test section with a long title spanning more than one line in the table of contents}
\subsection{A test subsection}
\subsection{Another test subsection}
\section{A test section}
\ifdefined\phantomsection\phantomsection\fi
\addcontentsline{toc}{section}{Test unnumbered section}
\section*{Test unnumbered section}
\subsection{A test subsection}
\section{Another test section}
\subsection{A test subsection}
\subsection{A test subsection}
\section{Another test section}
\section{Another test section}


\newpage\setcounter{page}{123}% just for the example

\part{Designing with HTML}

\localtableofcontents

\chapter{Beginning to learn design with HTML and some other text to span more than one line} 
\section{Another test section}
\section{Another test section}
\subsection{A test subsection}
\section{Another test section with a long title spanning more than one line in the table of contents}
\subsection{A test subsection}
\section{Another test section}
\section{Another test section}
\subsection{A test subsection}
\subsection{A test subsection}
\section{Another test section}
\section{Another test section}
\subsection{A test subsection}



\chapter{Beginning to learn design with HTML and some other text to span more than one line} 
\section{Another test section}
\section{Another test section}
\subsection{A test subsection}
\section{Another test section}
\section{Another test section}
\subsection{A test subsection with a long title spanning more than one line in the table of contents}
\section{Another test section}
\section{Another test section}
\subsection{A test subsection}
\section{Another test section}
\section{Another test section}
\subsection{A test subsection}
\subsection{A test subsection}
\section{Another test section}
\section{Another test section}
\subsection{A test subsection}
\section{Another test section}
\subsection{A test subsection}
\section{Another test section}
\section{Another test section}
\section{Another test section}
\subsection{A test subsection}

\part{Designing with HTML1}

\localtableofcontents

\chapter{Beginning to learn design with HTML and some other text to span more than one line} 
\section{Another test section}
\subsection{A test subsection}
\section{Another test section}
\subsection{A test subsection}
\section{Another test section}
\section{Another test section}
\section{Another test section}
\subsection{A test subsection}

\part{Designing with HTML2}

\localtableofcontents

\chapter{Beginning to learn design with HTML and some other text to span more than one line} 
\section{Another test section}
\subsection{A test subsection}
\section{Another test section}
\subsection{A test subsection}
\section{Another test section}
\section{Another test section}
\section{Another test section}
\subsection{A test subsection}

\part{Designing with HTML3}

\localtableofcontents

\chapter{Beginning to learn design with HTML and some other text to span more than one line} 
\section{Another test section}
\subsection{A test subsection}
\section{Another test section}
\subsection{A test subsection}
\section{Another test section}
\section{Another test section}
\section{Another test section}
\subsection{A test subsection}

\part{Designing with HTML4}

\localtableofcontents

\chapter{Beginning to learn design with HTML and some other text to span more than one line} 
\section{Another test section}
\subsection{A test subsection}
\section{Another test section}
\subsection{A test subsection}
\section{Another test section}
\section{Another test section}
\section{Another test section}
\subsection{A test subsection}

\appendix

\chapter{Test Appendix}
\section{Another test section}
\section{Another test section with a long title spanning more than one line in the table of contents}
\section{Another test section}
\subsection{A test subsection}
\section{Another test section}
\section{Another test section}


\end{document}

Best Answer

You have chosen a very sophisticated design, which does not help clarify what exactly you are aiming at.

Here is an approach. Look at the parts of the code near %%%%%% //////////// CHANGES FOR QUESTION. Look also at the way \chapter is input in the main text.

It would be simpler to explain were it not for the humongous macros before. I had to keep most of the preamble which is too complex to think about modifying at my age, but I killed most of the document body.

\documentclass[a4paper,14pt]{extreport}
\usepackage[table]{xcolor}
\usepackage{framed}
\usepackage{tikz}
\usepackage{lmodern}
\usepackage{etoc}
\usepackage[unicode,hidelinks]{hyperref}

\definecolor{myred}{RGB}{127,0,0}
\definecolor{myyellow}{RGB}{169,121,69}

\newcommand\Circle[1]{\tikz[overlay,remember picture] 
    \node[draw,circle, text width=18pt,line width=1pt,align=center] {#1};}

%% This defines an adjustable length, which gives the position of the
%% section and subsection from the left document margin.
\newlength{\tocmargin}
% Its value is set in the \etocsettocstyle command below, after \sffamily

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% USE OF framed package
\newenvironment{tocleftbar}
{\def\FrameCommand {\hspace{\dimexpr\tocmargin-4pt\relax}%
        {\color{myyellow}\vrule width 2.5pt depth 6pt}\hspace{10pt}%
        \hspace{-\tocmargin}}% 
    \MakeFramed {\leftskip\tocmargin\rightskip\tocmargin\FrameRestore}}
{\endMakeFramed}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\etocsetstyle{part}
{\nobreak\etocskipfirstprefix }
{\pagebreak[3]}% makes a page break before a Part favorable
{% debugging:
    \addvspace{1.15\baselineskip}%
    {\huge\centering
        \color{myyellow}\Circle{\makebox[0pt][c]{\etocnumber}}\\*[2.5ex]%
        \color{myred}{\Huge \etocname}\par}}
{}

\newif\ifintocleftbar

\etocsetstyle{chapter}
% don't break immediately after Part
{\nobreak\etocskipfirstprefix}
% but allow break after section or subsection
{\pagebreak[2]}
{% it seems that framed's code too easily allows a page break 
    % if some vertical glue is here, so let's use a \kern
    \kern\baselineskip
    \begin{tocleftbar}
        \intocleftbartrue
        \makebox[0pt][r]{\smash{\parbox{6em}%
                {\null\vspace*{5pt}\hfill\Huge\bfseries\color{myred}\etocpage
                    \hspace*{20pt}}}}%
        % use of \parbox, else framed.sty has a tendency to allow page breaks if
        % multi-line name
        \parbox[t]{\dimexpr\hsize-2\tocmargin\relax}
        {\large\textbf{\etoclink{Chapter~\etocthenumber}}%
            %\\* does not do what I want. \par\nobreak does.
            % But as we are now in \parbox, does not matter
            \par\etocname\rule[-\baselineskip]{0pt}{0pt}}%
        \par
        \normalsize\leftskip\dimexpr\leftskip+52pt\relax}
    {}

    \etocsetstyle {section}
    % avoid break after Chapter
    {\nopagebreak[3]\vspace{-5pt}\etocskipfirstprefix}
    % allow break after previous subsection or section
    {\vspace {1pt plus .2pt minus .2pt}}
    {\makebox[0pt][r]{\makebox[2.5em][l]{\etocnumber}}%
        \etocname
        \dotfill\nobreak{\itshape\color{myred}\etocpage}\par }
    {\end{tocleftbar}}

% IMPORTANT: this is ALSO executed if the last thing before the next chapter is a subsection

\etocsetstyle {subsection}
% avoid break immediately after section
{\nopagebreak[2]\vspace{1pt}\etocskipfirstprefix}
{\vspace {1pt plus .2pt minus .2pt}}%
{\makebox[0pt][r]{\makebox[2.5em][l]{\etocnumber}}\etocname
    \dotfill\nobreak{\itshape\color{myred}\etocpage}\par}
{}

\etocsetlevel {appendix}{0}



%%%%%% //////////// CHANGES FOR QUESTION:
%%%%%%         THE TEXT INSTEAD OF CHAPTER NUMBER
\etocsettocstyle
   {\sffamily\setlength{\tocmargin}{4em}%
         {\Huge\bfseries\color{myred}\contentsname\par}%
         \leftskip 0pt\parindent 0pt 
    \DeclareRobustCommand *{\Alex}[2]{##1\par ##2}%
    }
   {}


\DeclareRobustCommand *{\Alex}[2]{#2}
%%%%%%
%%%%%% //////////// SEE BELOW HOW \chapter ARE WRITTEN

\begin{document}
\tableofcontents*

\part{Designing with \TeX\ and \LaTeX}

\chapter{\Alex {683(19)-021-15-T1}{Beginning to learn design with \TeX}}
\section{Another test section}
\section{Another test section}
\subsection{A test subsection}
\section{Another test section}
\subsection{A test subsection}

\chapter{\Alex {305(53)-091-13-LY1}{Beginning to learn design with \LaTeX}}
\section{A test section with a long title spanning more than one line in the table of contents}
\subsection{A test subsection}
\subsection{Another test subsection}
\section{A test section}

\end{document}

Here is the TOC:

etoc funny toc

and to illustrate, one chapter in the body:

funny chapter