Sectioning – How to Position Chapter Numbers in Margin Notes with Titlesec and Tufte

chapterspositioningsectioningtitlesectufte

How can I fix the position of my chapter number? I would like to put it right in the middle of the space for the notes, and aligned with the first line of text of the chapter. I am undecided for the case where the chapter start with a section if align the chapter number with the title of the section or, again, with first line of the text.

I would be sure that there are not modifications at the original positioning of the chapter title and of course of the vertical spacing of it, provided by tufte class. My code below modify that position.

Goals

  1. I would like to center the chapter number right in the middle of the space for the notes.
  2. I would like to align the chapter number with the first line of text of the chapter.
  3. I would be sure that there are not modifications at the original positioning of the chapter title and of course of the vertical spacing of it.

You can see from the picture that my numbers are not aligned with the first line of text and also that they are not centered in the space for the notes. If you have some advices to find a better positioning of the chapter number, please, feel free to give me your tips. In fact my positioning is not based on calculations, but only on some visual approximations…

I have also seen, that with the variation of the chapter number, the vertical space of the page change, I think that this happen because the different numbers have different measures. Ideally, I would to put the chapter number as a margin note fixed at the first line of text.
enter image description here

\documentclass[a4paper,twoside,nofonts]{tufte-book}

\RequirePackage[%
               nomath,%
               nott,%
%              nosf,%
               noamsmath,%
               notextcomp,%
               oldstylenums%
               ]{kpfonts}


\usepackage{lipsum}

\usepackage[pdftex]{graphicx}

\setcounter{secnumdepth}{0}

\titleformat{\chapter}%
  [display]% shape
  {\relax\ifthenelse{\NOT\boolean{@tufte@symmetric}}{\begin{fullwidth}}{}}% format applied to label+text
  {\itshape\vspace*{30pt}\color{black!10}\hfill\rlap{\resizebox{!}{5cm}{\thechapter}}\hspace*{150pt}}% label
  {-200pt}% horizontal separation between label and title body
  {\huge\rmfamily\itshape}% before the title body
  [\ifthenelse{\NOT\boolean{@tufte@symmetric}}{\end{fullwidth}}{}]% after the title body


\geometry{showframe}

\begin{document}

\chapter{Implementation}

\lipsum

\chapter{Implementation}

\section{Valence Shell Electron Pair Repulsion theory}

\lipsum

\end{document}

enter image description here

Best Answer

Hers's one possible solution; I used the tikzpagenodes package to place the chapter number at the desired exact location; the draw=gray option for the \node was only used for visualization purposes to show that the box associated to the number glyph is really centered in the marginpar area; the number itself might look not centered, but this is due to the spaces associated to the glyph in the particular font (remove that option on your actual code):

\documentclass[a4paper,twoside,nofonts]{tufte-book}
\usepackage[%
               nomath,%
               nott,%
%              nosf,%
               noamsmath,%
               notextcomp,%
               oldstylenums%
               ]{kpfonts}
\usepackage{graphicx}
\usepackage{tikzpagenodes}
\usepackage{lineno}
\usepackage{lipsum}

\setcounter{secnumdepth}{0}

\titleformat{\chapter}[block]%
  {\relax\ifthenelse{\NOT\boolean{@tufte@symmetric}}{\begin{fullwidth}}{}}% format applied to label+text
  {\begin{tikzpicture}[remember picture,overlay]
  \node[anchor=north,inner sep=0pt,draw=gray,font=\itshape,text=black!10] at ([yshift=-147pt]current page marginpar area.north) {\resizebox{!}{5cm}{\thechapter}};
  \end{tikzpicture}}% label
  {0pt}% horizontal separation between label and title body
  {\huge\rmfamily\itshape}% before the title body
  [\ifthenelse{\NOT\boolean{@tufte@symmetric}}{\end{fullwidth}}{}]% after the title body
\titleformat{name=\chapter,numberless}[block]%
  {\relax\ifthenelse{\NOT\boolean{@tufte@symmetric}}{\begin{fullwidth}}{}}% format applied to label+text
  {}% label
  {0pt}% horizontal separation between label and title body
  {\huge\rmfamily\itshape}% before the title body
  [\ifthenelse{\NOT\boolean{@tufte@symmetric}}{\end{fullwidth}}{}]% after the title body

\geometry{showframe}

\begin{document}
\linenumbers
\chapter{Implementation}
\lipsum
\chapter{Implementation}
\section{Valence Shell Electron Pair Repulsion theory}
\lipsum

\end{document}

enter image description here

Related Question