When writing the TeX-codes we often use the 6-symbols \ldots command. It should be more comfortable to type merely three dots … instead. Just the same as for TeX-parsing the minus symbols – or — or —. So I wonder, is it possible reprogram internal TeX understanding the triple … into the \ldots-command. Of course the single/double dots . and .. should be of the standard meaning.
[Tex/LaTex] Three dots instead of \ldots
programming
Related Solutions
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:
and to illustrate, one chapter in the body:
Best Answer
It is pointless to define
\def\...
: if you want to redefine\.
just use\renewcommand\.{\ldots}
or some such. (so the use is just two characters\.
) As noted in comments this will break any use of the dot accent. Using an alternative form for dot accent isn't really possible asinputenc
uses\.
in its definition of accented characters, so if you want to redefine\.
without breaking the accent you would have to change the encoding definition for every encoding that includes characters with that accent.By far the best course is to use the existing
\ldots
or\dots
commands, or use utf8 encoding and use the ellipsis character…
(U+2026 ) directly.