1

I have the problem that my chapter title is too wide, because it has the same width like the line below. How can I change the width from the title? For example, when you uncomment the \geometry{...} lines, it works but not much enough. AND why are the two lines not directly among each other (e.g. the two left "T"'s)?

MWE:

\documentclass[paper=a4, fontsize=12pt]{scrreprt}

\usepackage{classicthesis}

\usepackage{geometry}
\geometry{
    a4paper,
    top=3cm,
    bottom=3cm,
    left=3cm,
    right=3cm
}

\titleformat{\chapter}[display]%
{\relax}{\vspace*{-3\baselineskip}\makebox[\linewidth][r]{\color{halfgray}\chapterNumber\thechapter}}{10pt}%
{\raggedright\spacedallcaps}[\normalsize\vspace*{.8\baselineskip}\titlerule]%


\begin{document}
    \chapter{Test title Test title Test title Test title Test title Test title }
\end{document}

Title:

enter image description here

I wan't this, but with variable/more space between chapter title and right end (result by uncomment the geometry, but that is not the solution because I need it)

enter image description here

5
  • I'm not sure if this is what you're looking for, but are you aware that you can have \chapter[short]{long long long}?
    – Teepeemm
    Oct 18, 2022 at 20:02
  • 1
    No, this results only changing the chapter title in TOC, if I'm right with this command. Oct 18, 2022 at 20:29
  • 1
    What do you mean by "variable/more space"? You could put the actual title in a minipage, of say 0.9\linewidth like this \titleformat{\chapter}[display]{\relax}{\vspace*{-3\baselineskip}\makebox[\linewidth][r]{\color{halfgray}\chapterNumber\thechapter}}{10pt}{\begin{minipage}{0.9\linewidth}\raggedright\spacedallcaps}[\end{minipage}\linebreak\normalsize\vspace*{.8\baselineskip}\titlerule] Or do you want where it wraps to depend on the width of the number?
    – frabjous
    Oct 18, 2022 at 20:45
  • No, that is what I want. But now the horizontal line is too close to the title. The baselineskip command doesn't work anymore. Oct 18, 2022 at 20:58
  • Sorry, it's ok so. Problem solved! Oct 19, 2022 at 6:20

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.