Text Formatting ⇒ fancy headline
fancy headline
Hi everybody
I need some help with the fancy package. What I want to do is to extend the line of the header to start at the margin of the page. The Headline in the header should still flush with the main text. Any ideas how to do this.
thx Nic
I need some help with the fancy package. What I want to do is to extend the line of the header to start at the margin of the page. The Headline in the header should still flush with the main text. Any ideas how to do this.
thx Nic
NEW: TikZ book now 40% off at Amazon.com for a short time.

-
- Posts: 133
- Joined: Sat Feb 25, 2012 6:12 pm
fancy headline
Could you please provide a MWE to show what you already have? Especially since you mention a non-existent package
I guess it should be fancyhdr, with

\pagestyle{fancy}
, in that case you probably could do something like this:Code: Select all
\documentclass[twoside]{scrartcl}
\usepackage{fancyhdr,calc}
\pagestyle{fancy}
\newlength{\margintotal}% Save total margin width
\setlength{\margintotal}{\marginparsep+\marginparwidth}
\fancyheadoffset[LE,RO]{\margintotal} % Extend header into margin
\fancyhead[RO]{\thepage\hspace{\margintotal}} % add whitespace after pagenumber to skip back to textwidth
\fancyhead[LE]{\hspace{\margintotal}\thepage} % add whitespace before pagenumber to skip back to textwidth
% You probably have to add whitespace around centered text as well
%% Other possibility, without extending the header, this will raise overfull hbox warnings on every page
%\renewcommand{\headrule}{{\hrule width1.1\headwidth height\headrulewidth \vskip-\headrulewidth}}
\usepackage{blindtext}
\begin{document}
\blinddocument
\end{document}
Ubuntu 13.10 + Tex Live 2013 + Texmaker / Windows 7 Pro + MikTex 2.9 + TexnicCenter / Android 4.3 + TexPortal + DroidEdit
- Johannes_B
- Site Moderator
- Posts: 4182
- Joined: Thu Nov 01, 2012 4:08 pm
fancy headline
Depends, what documentclass are you using? If it is a KOMA class, consider scrlayer-scrpage.
For a standard class, fancyhdr is more common, but scrlayer-scrpage also works.
Maybe prepare a minimal working example, to demonstrate what you want.
Oh, Hugo was faster :-)
For a standard class, fancyhdr is more common, but scrlayer-scrpage also works.
Maybe prepare a minimal working example, to demonstrate what you want.
Oh, Hugo was faster :-)
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Re: fancy headline
hey everybody,
looks already quite good but its unfortunately not exactly what i want. I have added a pdf file with the pattern i would like. Thanks a lot for your help.
Nic
looks already quite good but its unfortunately not exactly what i want. I have added a pdf file with the pattern i would like. Thanks a lot for your help.
Nic
- Attachments
-
- pattern.pdf
- (59.57 KiB) Downloaded 548 times
-
- Posts: 133
- Joined: Sat Feb 25, 2012 6:12 pm
Re: fancy headline
Is it just a coincidence the line ends at the end of the section/chapter title in the header? Or would you want that line to always extend to the inner end of the text?
Ubuntu 13.10 + Tex Live 2013 + Texmaker / Windows 7 Pro + MikTex 2.9 + TexnicCenter / Android 4.3 + TexPortal + DroidEdit
Re: fancy headline
I would prefer that the line always extends to the end of the chapter title. Is this an issue?
Nic
Nic
Re: fancy headline
nobody any idea how to realize this?
Nic
Nic
-
- Posts: 133
- Joined: Sat Feb 25, 2012 6:12 pm
fancy headline
I'm sorry, I did try some things but I could not get it to work as you would like to. The best I could do was to make the line always go to half the page, and make the header text not go over the middle of the page, but I don't think that is what you're after. However, I did not succeed in making the
If you're interested, my code is included below:
\fancyheadoffset
dynamic.If you're interested, my code is included below:
Code: Select all
\documentclass[twoside]{scrreprt}
\usepackage{fancyhdr,calc}
\pagestyle{fancy}
\newlength{\outermargintotal}% Save total margin width
\setlength{\outermargintotal}{\marginparwidth}
\setlength{\headheight}{36pt}
\fancyhf{}
\fancyheadoffset[LE,RO]{\outermargintotal} % Extend header into margin
\fancyheadoffset[LO]{-0.5\textwidth}
\fancyheadoffset[RE]{-0.5\textwidth}
\fancyfoot[C]{\thepage}
\fancyhead[LO]{\parbox{0.5\textwidth}{\flushright \rightmark}}
\fancyhead[RE]{\parbox{0.5\textwidth}{\flushleft \leftmark}}
\usepackage{blindtext}
\begin{document}
\chapter{This is a very long chapter title}
\section{First section}
\blindtext[3]
\blindmathpaper
\blindtext[4]
\section{Test section}
\blindtext[12]
\blindmathpaper
\blinddocument
\end{document}
Ubuntu 13.10 + Tex Live 2013 + Texmaker / Windows 7 Pro + MikTex 2.9 + TexnicCenter / Android 4.3 + TexPortal + DroidEdit
Re: fancy headline
hey actually this is quite good. Is it also possible to make the line longer (some centimeters). And can I increase the distance between the line of the headline and the chapter in the headline?
Thanks for your help - really amazing!!
Thanks for your help - really amazing!!
-
- Posts: 133
- Joined: Sat Feb 25, 2012 6:12 pm
fancy headline
To make the line go a little further over the text you should decrease the
\fancyheadoffset
, to make it all a little easier I updated my code so you only set the extendovertext
once and the boxes and lines are updated accordingly. I also renamed the outermargintotal
to extendinmargin
for clarity.Code: Select all
\documentclass[twoside]{scrreprt}
\usepackage{fancyhdr,calc}
\pagestyle{fancy}
\newlength{\extendinmargin}
\newlength{\extendovertext}
\setlength{\extendinmargin}{\marginparwidth} % Set how far line extends in margin here
\setlength{\extendovertext}{0.75\textwidth} % Set width of header text here
\setlength{\headheight}{36pt}
\fancyhf{}
\fancyheadoffset[LE,RO]{\extendinmargin} % Extend header into margin
\fancyheadoffset[LO,RE]{\extendovertext-\textwidth}
\fancyfoot[C]{\thepage}
\fancyhead[LO]{\parbox[b][2ex]{\extendovertext}{\flushright \rightmark}}
\fancyhead[RE]{\parbox[b][2ex]{\extendovertext}{\flushleft \leftmark}}
\usepackage{blindtext}
\begin{document}
\chapter{This is a very very very long chapter title}
\section{First section}
\blindtext[3]
\blindmathpaper
\blindtext[4]
\section{Test section}
\blindtext[12]
\blindmathpaper
\blinddocument
\end{document}
Ubuntu 13.10 + Tex Live 2013 + Texmaker / Windows 7 Pro + MikTex 2.9 + TexnicCenter / Android 4.3 + TexPortal + DroidEdit