0

Assume I have a long chapter title \chapter{one two three four five six seven eight nine ten} that appears in the table of contents like this:

  1. one two three four five six se-

ven eight nine ten

This seems ugly to me. I would like to have it like:

  1. one two three four five six

seven eight nine ten

But if I use \chapter{one two three four five six \mbox{seven} eight nine ten} the line in the table of contents will be too long, so is there an alternative to have a linebreak in the table of contents without hyphenation and without having a line that is too long?

  • 1
    Welcome to TeX.SX. With index, you mean the table of contents? – Johannes_B Nov 13 '19 at 16:00
  • 1
    Which documentclass are you using? – Johannes_B Nov 13 '19 at 16:01
  • arrange that your chapter headings are set \raggedright then tex won't hyphenate them. – David Carlisle Nov 13 '19 at 17:22
  • 1
    by the way you mean Table of Contents not Index (Index in English means the alphabetical list, usually at the end of the book) – David Carlisle Nov 13 '19 at 17:23
  • Have you tried the \hyphenpenalty option? It is intended for that, you can set it to \hyphenpenalty=10000 to prevent most hyphens. And modify it before and after including the index. – Salatiel Garcia Nov 14 '19 at 04:47
  • yeah i mean toc, documentclass is scrreprt. The problem is that I want Latex to hyphenate in the toc, but not for this special chapter, so it wouldn't help to use the hyphenpenalty option for the whole toc.. – Horstfuchs Nov 14 '19 at 13:39
  • the \raggedright{one two three four five six seven eight nine ten} option seems to have no consequence for the toc – Horstfuchs Nov 14 '19 at 13:43

1 Answers1

0

If you want to disable hyphenation for all entries in ToC, LoF and LoT:

(Remember to compile code twice)

enter image description here

\documentclass[b5paper,12pt,twoside]{book}
\usepackage[pdfspacing]{classicthesis}
\usepackage{arsclassica}
\usepackage[inner=2.2cm,outer=1.8cm,bottom=2.7cm,top=2.5cm]{geometry}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc} 
\usepackage{lipsum}
\usepackage[english]{babel}

\titleformat{\section}
{\raggedright}{\textsc{\MakeTextLowercase{\thesection}}}{1em}{\spacedlowsmallcaps}

\makeatletter
\renewcommand{\@tocrmarg}{2.55em plus1fil}
\makeatother

\begin{document}
\frontmatter
\tableofcontents
\cleardoublepage
\mainmatter
\chapter{Test Chapter}
\section{The Separation Axioms and Continuous Real-Valued Functions}
\lipsum
\end{document}

Taken from--https://tex.stackexchange.com/a/430273/197451

js bibra
  • 21,280