0

In my current LaTeX project, I want to have a wide margin next to my text to add notes there. But the problem is that the chapter heading looks a bit "too short". Especially with long headlines it looks strange if a line break has to be made so early. Is it possible to extend the width so that the title is also above the margin notes?

Chapter title is a bit too short

I am using titlesec and marginnote.

MWE:

\documentclass[12pt,a4paper]{book}
\usepackage{titlesec}
\usepackage[left=3.5cm,right=6.5cm,top=4cm,bottom=4cm,headheight=15mm, footskip=15mm,marginparwidth=3.5cm,marginparsep=0.5cm,asymmetric]{geometry}

\usepackage{marginnote}

\titleformat{\chapter}%
  {\sffamily\bfseries\Huge}{\thechapter.}{10pt}{}

\usepackage{lipsum}

\begin{document}

\chapter{This is a long chapter title}

\marginnote{\lipsum}
\lipsum

\end{document}

2 Answers 2

2

The following allows the chapter titles to cover the entire width of your text block and margin paragraph by using a \parbox of that width and letting it silently overprinting the text block using \rlap.

I'd also suggest to allow ragged section titles as generally justification works poor for short paragraphs (which headings effectively are).

\documentclass[12pt,a4paper]{book}
\usepackage[explicit]{titlesec}
\usepackage[left=3.5cm,right=6.5cm,top=4cm,bottom=4cm,headheight=15mm, footskip=15mm,marginparwidth=3.5cm,marginparsep=0.5cm,asymmetric]{geometry}

\usepackage{marginnote}

\titleformat{\chapter}%
{\sffamily\bfseries\Huge}{\rlap{\parbox{\dimexpr\linewidth+\marginparwidth+\marginparsep\relax}{\raggedright\thechapter.\
#1}}}{10pt}{}

\usepackage{lipsum}

\begin{document}

\chapter{This is a long chapter title that grows longer and longer and longer}

\marginnote{\lipsum}
\lipsum

\end{document}

enter image description here

4
  • Thanks! This works with my MWE, but unfortunately, it breaks my actual LaTeX Project. I think, the [explicit] may be the cause for that. Is it possible to only change this for chapter?
    – Jim Ye
    Commented Jul 15, 2023 at 8:35
  • @JimYe I'm afraid not, afaik, you can only activate that globally... But let me dig a bit.
    – Skillmon
    Commented Jul 15, 2023 at 9:02
  • The alternative is that you just put a #1 after your before code for your setups of \section and so on.
    – Skillmon
    Commented Jul 15, 2023 at 9:15
  • If you want to retain the hanging indent of the sectioning numbers I can provide that as well.
    – Skillmon
    Commented Jul 15, 2023 at 9:26
0

Although it is not the same as your output,have a look to the following approach:

\documentclass[12pt,a4paper]{book}
\usepackage{titlesec}
\usepackage[left=3.5cm,right=6.5cm,top=4cm,bottom=4cm,headheight=15mm, footskip=15mm,marginparwidth=3.5cm,marginparsep=0.5cm,asymmetric]{geometry}
\usepackage{marginnote}

\titleformat{\chapter}%
  {\sffamily\bfseries\Huge}{\makebox[0pt][r]{\thechapter.\hspace{10pt}}}{0pt}{\Huge\bfseries}

\usepackage{lipsum}

\begin{document}

\chapter{This is a long chapter title}

\marginnote{\lipsum}
\lipsum

\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .