2

I have a thesis template I created during my studies. And for my master thesis, I want to add some "neat looking" design to it.

I'm going for figures in the margin, as well as side nodes. Simply accomplished with the geometry package. However, for my chapter styles, I am at a loss.

I would like my numbers to appear in the right margin (solved, using the titlesec package). I want the text of the chapter and the number to be separated by a rule of some sort. Basically, I would like something like this:

enter image description here

I am confident this style is created by using the \documentclass{scr(something)} Koma script I believe. I have never used this, and a bit "scared" to switch from my old comfy template to that.

I have come up with this:

\documentclass[10pt,twoside,a4paper,openright]{report}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{mathtools}
\usepackage{blindtext}
\usepackage[includemp,
paperwidth=20.90cm,
paperheight=29.7cm,
top=2.170cm,
bottom=2.510cm,
inner=2.1835cm,
outer=2.1835cm,
marginparwidth=4cm,
marginparsep=0.4cm]{geometry}

\usepackage{titlesec}
\newlength\mylen
\addtolength{\mylen}{\linewidth+70pt}

\titleformat{\chapter}[block]{\normalfont\huge\bfseries\scshape}
    {\makebox[0pt]{\makebox[\linewidth+\mylen][r]{\scalebox{2}{\vrule\itshape\thechapter}}}}{0pt}{}


\begin{document}
\chapter{Introduction which has a way to long title}
\blindtext
\end{document}

Yielding

Is there anything I can do, in report document class. To come closer to the aforementioned output, or do I need to consider switching class?

Thanks for your time.

2 Answers 2

1

Some box juggling:

\RequirePackage{fix-cm} % if you want to use Computer Modern
\documentclass[
  10pt,
  twoside,
  openright,
]{report}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{mathtools}
\usepackage{lipsum}
\usepackage[
  includemp,
  a4paper,
  top=2.170cm,
  bottom=2.510cm,
  inner=2.1835cm,
  outer=2.1835cm,
  heightrounded,
  marginparwidth=4cm,
  marginparsep=0.4cm,
]{geometry}

\usepackage{titlesec}

\newcommand{\skovmandchapternumber}{%
  \makebox[0pt][l]{%
    \hspace*{\textwidth}\hspace*{1em}%
    \raisebox{-0.5\height}{\fontsize{40}{0}\itshape\thechapter}%
  }%
}
\newsavebox\skovmandchapterbox
\newcommand{\skovmandchaptertitle}[1]{%
  \sbox\skovmandchapterbox{%
    \raisebox{-0.5\height}{\parbox[b]{0.8\textwidth}{\raggedleft#1}}%
  }%
  \hfill\usebox{\skovmandchapterbox}%
  \makebox[0pt][l]{%
    \hspace*{0.5em}%
    \ifdim\ht\skovmandchapterbox<15pt
      \vrule height 15pt depth 15pt width 1pt
    \else
      \vrule height \dimexpr\ht\skovmandchapterbox + 3pt\relax
             depth  \dimexpr\dp\skovmandchapterbox + 6pt\relax
             width 1pt
    \fi
  }%
}

\titleformat{\chapter}[block]
  {\normalfont\huge\scshape}
  {\skovmandchapternumber}
  {0pt}
  {\skovmandchaptertitle}


\begin{document}

\chapter{Introduction}

\lipsum[1]

\chapter{Chapter which has a way too long title}

\lipsum[1]

\end{document}

The fix-cm package is not needed if your document uses a freely scalable font. The idea is that the rule covers at least the number, but if the title gets longer, the rule extends a bit above and below it.

enter image description here

enter image description here

1
  • A beautiful solution to my problem. Really appreciated! So glad this was doable! Aug 13, 2018 at 13:17
0

Here is a solution which works, thanks to the explicit option of titlesec and the use of a tabularx. I added some colour (personal taste) but it's easy to remove. Also, don't forget to define \titleformat for unnumbered chapters (e.g. bibliography), as part of this code is meaningless for them.

\documentclass[10pt, twoside, a4paper, openright]{report}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{mathtools}
\usepackage{blindtext}
\usepackage[includemp,
paperwidth=20.90cm,
paperheight=29.7cm,
top=2.170cm,
bottom=2.510cm,
inner=2.1835cm,
outer=2.1835cm,
marginparwidth=4cm,
marginparsep=0.4cm]{geometry}
\usepackage[svgnames]{xcolor}
\usepackage{tabularx}
\usepackage[explicit]{titlesec}
\newlength\mylen
\addtolength{\mylen}{\linewidth+70pt}

\titleformat{\chapter}[block]{\filleft\normalfont\huge\bfseries\scshape}
{\rlap{\makebox[\mylen][r]{\scalebox{2}{\color{LightSlateGray!40}\itshape\thechapter}}}}{0pt}
{\begin{tabularx}{\dimexpr\linewidth + \marginparsep}{@{}>{\raggedleft}X!{\,\color{LightSlateGray!40}\vrule width 3pt}}#1\end{tabularx}}

\begin{document}

\chapter{Introduction which has a way to long title}

\blindtext

\end{document} 

enter image description here

1
  • Thanks a lot for your answer, I chose the answer given by @egreg, even though your answer does the trick as well. But I preferred the varying rule. You made me remember to fix the unnumbered style though! Aug 13, 2018 at 13:19

You must log in to answer this question.

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