# Chapters number moves out of margin

i'm new to LaTeX and got a problem. The picture says it all... When my number of chapters exceeds 9, the second digit moves out of the margin....

I have copied the following layout, for the chapters from the web to my preamble:

\documentclass[a4paper,11pt,twoside,openright]{memoir}

\usepackage{xcolor}

\definecolor{numbercolor}{gray}{0.7}
\newif\ifchapternonum

\makechapterstyle{jenor}{
\renewcommand\printchaptername{}
\renewcommand\printchapternum{}
\renewcommand\printchapternonum{\chapternonumtrue}
\renewcommand\chaptitlefont{\fontfamily{pbk}\fontseries{db}\fontshape{n}\fontsize{25}{35}\selectfont\raggedleft}
\renewcommand\chapnumfont{\fontfamily{pbk}\fontseries{m}\fontshape{n}\fontsize{1in}{0in}\selectfont\color{numbercolor}}
\renewcommand\printchaptertitle[1]{%
\noindent
\ifchapternonum
\begin{tabularx}{\textwidth}{X}
{\let\\\newline\chaptitlefont ##1\par}
\end{tabularx}
\par\vskip-2.5mm\hrule
\else
\begin{tabularx}{\textwidth}{Xl}
{\parbox[b]{\linewidth}{\chaptitlefont ##1}} & \raisebox{-15pt}{\chapnumfont \thechapter}
\end{tabularx}
\par\vskip2mm\hrule
\fi
}
}

\chapterstyle{jenor}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\usepackage{pdfsync}
\setlrmarginsandblock{5.5cm}{2.5cm}{*}
\setulmarginsandblock{2.5cm}{3.0cm}{*}
\checkandfixthelayout

\begin{document}

\setcounter{chapter}{9}

\chapter{diskussion}
Test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test
\end{document}


Does anyone have a solution or suggestion on what i should do?? If so, i would be grateful!

• (1) Please provide a full minimal example, for example it might not be clear to people that this is a memoir question. (2) What should it do if the number it longer than 9 (in the MWE you can simulate 9 chapters via \setcounter{chapter}{9} placed before \chapter{Diskussion}. – daleif Dec 16 '14 at 13:33
• (3) BTW, that version of jenor does not grow into the margin, so again please post a full minimal example. – daleif Dec 16 '14 at 13:35
• Sorry, but i do not know how to make a full minimal example. I'm sorry for being a rookie, but i'm trying hard to understand most of the features in LaTeX.. – Rasmus Dec 16 '14 at 13:48
• (1) Why is the inner margin so large? It is traditionally the outer margin that is the largest. (2) Do you really need the pdfsync package? No-one is using that any more because of the build in synctex features. – daleif Dec 16 '14 at 15:39
• If you drop pdfsync it no longer sits in the margin as intended. – daleif Dec 16 '14 at 15:42

This is just a longer comment. This MWE does not show up as in the picture, thus copy this and add to it so it shows your problem

\documentclass[a4paper]{memoir}
\usepackage{xcolor}

\definecolor{numbercolor}{gray}{0.7}
\newif\ifchapternonum

\makechapterstyle{jenor}{
\renewcommand\printchaptername{}
\renewcommand\printchapternum{}
\renewcommand\printchapternonum{\chapternonumtrue}
\renewcommand\chaptitlefont{\fontfamily{pbk}\fontseries{db}\fontshape{n}\fontsize{25}{35}\selectfont\raggedleft}
\renewcommand\chapnumfont{\fontfamily{pbk}\fontseries{m}\fontshape{n}\fontsize{1in}{0in}\selectfont\color{numbercolor}}
\renewcommand\printchaptertitle[1]{%
\noindent
\ifchapternonum
\begin{tabularx}{\textwidth}{X}
{\let\\\newline\chaptitlefont ##1\par}
\end{tabularx}
\par\vskip-2.5mm\hrule
\else
\begin{tabularx}{\textwidth}{Xl}
{\parbox[b]{\linewidth}{\chaptitlefont ##1}} & \raisebox{-15pt}{\chapnumfont \thechapter}
\end{tabularx}
\par\vskip2mm\hrule
\fi
}
}

\chapterstyle{jenor}

\begin{document}

\setcounter{chapter}{9}

\chapter{diskussion}

\end{document}


Note how this image using the posted code, does not end up as in the original image. So something else is going on.

\documentclass[a4paper,11pt,twoside,openright]{memoir}

\usepackage{xcolor,kantlipsum}

\setlrmarginsandblock{5.5cm}{2.5cm}{*}
\setulmarginsandblock{2.5cm}{3.0cm}{*}
\checkandfixthelayout

\definecolor{numbercolor}{gray}{0.7}
\newif\ifchapternonum

\newlength\chapnumwidth

\makechapterstyle{jenor}{
\renewcommand\printchaptername{}
\renewcommand\printchapternum{}
\renewcommand\printchapternonum{\chapternonumtrue}
\renewcommand\chaptitlefont{\fontfamily{pbk}\fontseries{db}\fontshape{n}\fontsize{25}{35}\selectfont\raggedleft}
\renewcommand\chapnumfont{\fontfamily{pbk}\fontseries{m}\fontshape{n}\fontsize{1in}{0in}\selectfont\color{numbercolor}}
\settowidth\chapnumwidth{\chapnumfont 99}
\renewcommand\printchaptertitle[1]{%
\noindent
% design only good for chapters in right hand pages
\ifchapternonum
% use this if the un-numbered placement should match 100%
% \begin{tabularx}{\linewidth}{Xp{\chapnumwidth}}
%   {\parbox[b]{\linewidth}{\chaptitlefont ##1}} &
%   \raisebox{-15pt}{\phantom{\chapnumfont 99}}
\begin{tabularx}{\textwidth}{@{}X@{}}
{\parbox[b]{\linewidth}{\chaptitlefont ##1}}
\\
\cmidrule{1-1}
\end{tabularx}
\else
\begin{tabularx}{\linewidth}{@{}Xp{\chapnumwidth}@{}}
{\parbox[b]{\linewidth}{\chaptitlefont ##1}} &
\raisebox{-15pt}{\chapnumfont \thechapter}
\\
\cmidrule{1-1}
\end{tabularx}
\fi
}
}

\chapterstyle{jenor}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}

\chapter*{diskussion}

\kant[3]

\setcounter{chapter}{8}

\chapter{diskussion}

\kant[3]

\setcounter{chapter}{9}

\chapter{diskussion}

\kant[3]

\end{document}


• I have edited the the question and made a minimal example. The Error is in the codes: \usepackage{pdfsync} \setlrmarginsandblock{5.5cm}{2.5cm}{} \setulmarginsandblock{2.5cm}{3.0cm}{} \checkandfixthelayout - If i delete the package the digits move in, but i want them to be closer to the margin. Is that posible, without moving the margins for the text? – Rasmus Dec 16 '14 at 15:12
• @Rasmus, see my comments to the original question. It is pdfsync that is messing with something that it shouldn't. – daleif Dec 16 '14 at 15:43