I'm using the "Bjornstrup" style from the fncychap package for fancy chapter headings. Everything is OK so far. It's just the chapter number goes out of margins. The attachment shows what I mean. I tried few things but they don't work. I want the chapter number inside margin (see attachment).
Thanks
Text Formatting ⇒ Chapter Headings protrude into Margin
Chapter Headings protrude into Margin
- Attachments
-
- Screen Shot 2013-06-11 at 2.36.05 PM.png (42.81 KiB) Viewed 5646 times
NEW: TikZ book now 40% off at Amazon.com for a short time.

- Johannes_B
- Site Moderator
- Posts: 4182
- Joined: Thu Nov 01, 2012 4:08 pm
Chapter Headings protrude into Margin
Would you be so kind to provide your code (for your exaample above) in form of a Minimal Working Example using the code button? Right now we all could just guess.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Chapter Headings protrude into Margin
The code for the "Bjornstrup" style (as for any other provided style) can be found in the sources of the package (*.sty). The macro
Click on "Open in writeLaTeX" in the head of the above code box to see the result instantly. Next time please do your homework and prepare a self-contained and minimal example.
Thorsten
\DOCH
is responsible for the main formatting of the chapter heading. Copying its definition and commenting the relevant line yields the desired result.
Code: Select all
\documentclass[11pt]{report}
\usepackage[T1]{fontenc}
\usepackage{geometry}
\usepackage[Bjornstrup]{fncychap}
\usepackage{blindtext}
\renewcommand{\DOCH}{%
\settowidth{\py}{\CNoV\thechapter}
% \addtolength{\py}{-10pt} % Amount of space by which the
% % number is shifted right
\fboxsep=0pt%
\colorbox[gray]{.85}{\rule{0pt}{40pt}\parbox[b]{\textwidth}{\hfill}}%
\kern-\py\raise20pt%
\hbox{\color[gray]{.5}\CNoV\thechapter}\\%
}
\begin{document}
\blinddocument
\end{document}
Thorsten
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10