Text Formatting ⇒ fancy headline
fancy headline
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
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
-
- Posts: 133
- Joined: Sat Feb 25, 2012 6:12 pm
fancy headline

\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}
- Johannes_B
- Site Moderator
- Posts: 4182
- Joined: Thu Nov 01, 2012 4:08 pm
fancy headline
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 :-)
Re: fancy headline
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 558 times
-
- Posts: 133
- Joined: Sat Feb 25, 2012 6:12 pm
Re: fancy headline
Re: fancy headline
Nic
Re: fancy headline
Nic
-
- Posts: 133
- Joined: Sat Feb 25, 2012 6:12 pm
fancy headline
\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}
Re: fancy headline
Thanks for your help - really amazing!!
-
- Posts: 133
- Joined: Sat Feb 25, 2012 6:12 pm
fancy headline
\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}