# Positioning of the chapter number in the margin note space

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.

\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}


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}


• If you try to comment your code you will see that tufte-book class leave a little chapter number over the chapter title, to put that number the tufte book class push all the page down by a bit of space, I have tried to remove that space putting before \begin{tikzpicture} this code {\huge\vspace*{-\baselineskip}}. Is there a more stylish way to achive this? In order to get the same vertical space of the tufte class without chapter numbers. – Aurelius Jun 15 '13 at 13:01
• Also if you try to use the package lineno tu put a number on every line of text you will see that lineno put a number over the chapter title also if there is not a line of text – Aurelius Jun 15 '13 at 13:05
• I've also added a picture at my question to explain this, please, check it out :) – Aurelius Jun 15 '13 at 16:35
• @FormlessCloud please see my updated answer. – Gonzalo Medina Jun 15 '13 at 20:53
• How did you calculated yshift=-147pt? – Aurelius Jul 6 '14 at 12:58