Hello!
I'm LaTeX newbe and trying to make a document with some requirements.
Searching for similiar issues here and through whole internet gave me no result.
The point is to remove the long chapter name second (third, fourth...) line indent within the TOC.
What I do have now:
ToC_Screenshot.png (88.09 KiB) Viewed 5855 times
What I want to have:
ToC_Screenshot_wanted-result.png (88.06 KiB) Viewed 5855 times
Detailed explanation:
ToC_Screenshot_red-marks.png (100.33 KiB) Viewed 5855 times
\RequirePackage[l2tabu]{nag}
\documentclass[a4paper,14pt,twoside,openany]{memoir}
\setcounter{tocdepth}{2}
\begin{document}
\renewcommand{\contentsname}{Table of Contents}
\newcommand{\acronymsname}{This is a long, really long name for acronyms list to show how it looks within the Table of Contents}
\newcommand{\introductionname}{Introduction}
\tableofcontents
\chapter*{\acronymsname}
\addcontentsline{toc}{chapter}{\acronymsname}
\begin{itemize}
\item[\(E\)] --- E-letter
\item[\(j\)] --- j-letter
\item[\(k\)] --- k-letter
\end{itemize}
\chapter*{\introductionname}
\addcontentsline{toc}{chapter}{\introductionname}
Introduction text.
\chapter{First Chapter}
First Chapter text.
\section{Section One in the 1st Chapter}
...Some text...
\subsection{Subsection N1 within 1.1}
...New text...
\subsection{Subsection N2 within 1.1}
...Other text...
\section{Section Two in the 1st Chapter}
...More text...
\chapter{Second Chapter --- This Chapter Name is Really Long Too as Well as Acronyms List so it May Take at Least Two Strings}
Second Chapter text.
\section{Section One in the 2nd Chapter}
...Some text...
\section{Section Two in the 2nd Chapter}
...More text...
\end{document}
I assume the "tocloft" package may help me. Or not....?
Thanks for your help!
\RequirePackage[l2tabu]{nag}
\documentclass[emulatestandardclasses,% only to have a similar look
fontsize=14pt,english,openany]{scrbook}
\usepackage{babel}
\usepackage{xpatch}
\setcounter{tocdepth}{\subsectiontocdepth}
\renewcaptionname{english}{\contentsname}{Table of Contents}
\providecaptionname{english}{\acronymsname}{This is a long, really long name for acronyms list to show how it looks within the Table of Contents}
\providecaptionname{english}{\introductionname}{Introduction}
\DeclareTOCStyleEntry[level:=chapter,indent:=chapter,numwidth=0pt]{chapter}{nonumchapter}
\xpatchcmd{\addchaptertocentry}{%
\addtocentrydefault{chapter}{#1}{#2}% replace this
}{% by
\IfArgIsEmpty{#1}{%
\addtocentrydefault{nonumchapter}{#1}{#2}%
}{%
\addtocentrydefault{chapter}{#1}{#2}%
}%
}{}{\PatchFaiLure}
\begin{document}
\tableofcontents
\addchap{\acronymsname}
\begin{itemize}
\item[\(E\)] --- E-letter
\item[\(j\)] --- j-letter
\item[\(k\)] --- k-letter
\end{itemize}
\addchap{\introductionname}
Introduction text.
\chapter{First Chapter}
First Chapter text.
\section{Section One in the 1st Chapter}
...Some text...
\subsection{Subsection N1 within 1.1}
...New text...
\subsection{Subsection N2 within 1.1}
...Other text...
\section{Section Two in the 1st Chapter}
...More text...
\chapter{Second Chapter --- This Chapter Name is Really Long Too as Well as Acronyms List so it May Take at Least Two Strings}
Second Chapter text.
\section{Section One in the 2nd Chapter}
...Some text...
\section{Section Two in the 2nd Chapter}
...More text...
\end{document}
Sorry, but I can no longer participate here as the administrator is trampling on my wishes on one of his other platforms.
Ijon Tichy wrote:I don't know how to do it using memoir. But using a KOMA-Script class it is easy
Thank you!
Your way to solve my problem really works.
But it's essential for me to use the memoir class.
Does anybody have any ideas?
The duplicate of this question is here: https://stackoverflow.com/questions/711 ... in-the-toc
Probably it would be useful for you.
\RequirePackage[l2tabu]{nag}
\documentclass[a4paper,14pt,english,twoside,openany]{memoir}
\usepackage{babel}
\setcounter{tocdepth}{2}
% Read section 1.15 "Modifying a language" in the manual of the babel package
% to understand what's happening here.
\setlocalecaption{english}{contents}{Table of Contents}
\setlocalecaption{english}{acronyms}{This is a long, really long name
for acronyms list to show how it looks within the Table of Contents}
% The \cftchapternumwidth counter is defined and set by the memoir class
% without loading the tocloft package.
\newlength{\defaultChapternumwidth}
\setlength{\defaultChapternumwidth}{\cftchapternumwidth}
% Added after reading your comment in the other forum.
\renewcommand{\cftchapterdotsep}{\cftdotsep}
% In opposite to the KOMA-Script classes, memoir doesn't know any \addchap command.
\newcommand{\addchap}[1]{
\addtocontents{toc}{\setlength{\cftchapternumwidth}{0pt}}
\chapter*{#1}
\addcontentsline{toc}{chapter}{#1}
\addtocontents{toc}{\setlength{\cftchapternumwidth}{\defaultChapternumwidth}}
}
\begin{document}
\tableofcontents
\addchap{\acronymsname}
\begin{itemize}
\item[\(E\)] --- E-letter
\item[\(j\)] --- j-letter
\item[\(k\)] --- k-letter
\end{itemize}
\addchap{Introduction}
Introduction text.
\chapter{First Chapter}
First Chapter text.
\section{Section One in the 1st Chapter}
\dots{} Some text~\dots
\subsection{Subsection N1 within 1.1}
\dots{} New text~\dots
\subsection{Subsection N2 within 1.1}
\dots{} Other text~\dots
\section{Section Two in the 1st Chapter}
\dots{} More text~\dots
\chapter{Second Chapter --- This Chapter Name is Really Long Too as Well
as Acronyms List so it May Take at Least Two Strings}
Second Chapter text.
\section{Section One in the 2nd Chapter}
\dots{} Some text~\dots
\section{Section Two in the 2nd Chapter}
\dots{} More text~\dots
\end{document}