Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want to get left border of the header, please see below, to the tip of the section title and the right border to the end of the text. I use fancyhdr package and the code is:

\documentclass[10pt]{article}
\usepackage{calc}
\usepackage{graphicx}
\usepackage{caption}

\makeatletter
\newlength{\bibhang}
\setlength{\bibhang}{1em}
\newlength{\bibsep}
 {\@listi \global\bibsep\itemsep \global\advance\bibsep by\parsep}
\newenvironment{bibsection}%
        {\vspace{-\baselineskip}\begin{list}{}{%
       \setlength{\leftmargin}{\bibhang}%
       \setlength{\itemindent}{-\leftmargin}%
       \setlength{\itemsep}{\bibsep}%
       \setlength{\parsep}{\z@}%
        \setlength{\partopsep}{0pt}%
        \setlength{\topsep}{0pt}}}
        {\end{list}\vspace{-.6\baselineskip}}
\makeatother

\reversemarginpar

\usepackage[paper=a4paper,
            %includefoot, % Uncomment to put page number above margin
            marginparwidth=25mm,    % Length of section titles
            marginparsep=1.5mm,       % Space between titles and text
            margin=25mm,              % 25mm margins
            includemp]{geometry}

\usepackage{paralist}
\setlength{\parindent}{0in}



\usepackage{fancyhdr,lastpage}
\pagestyle{fancy}
\fancyfootoffset{.2\textwidth}%\marginparsep+\marginparwidth
\fancyheadoffset{20pt}
\lhead{The Curiculum Vitae of Vahid Ebrahimzade}
\rhead{\thepage}
\chead{}
\fancyfoot{}

\usepackage{color,hyperref}
\definecolor{darkblue}{rgb}{0.0,0.0,0.3}
\hypersetup{colorlinks,breaklinks,
            linkcolor=blue,urlcolor=blue,
            anchorcolor=blue,citecolor=kblue}

\renewcommand{\section}[2]%
        {\pagebreak[2]\vspace{1.3\baselineskip}%
         \phantomsection\addcontentsline{toc}{section}{#1}%
         \hspace{0in}%
         \marginpar{
         \raggedright \scshape #1}#2}


\newenvironment{innerlist}[1][\enskip\textbullet]%
        {\begin{compactitem}[#1]}{\end{compactitem}}

\newcommand{\blankline}{\quad\pagebreak[2]}

\begin{document}

\section{Forschungs-\newline t\"atigkeit}
%\vspace{.5cm}
\begin{bibsection}
\item Modellreduktion Methoden
\item Surrogate Modellierung; Polynomfunktion Methoden, Radiale Basisfunktion Methoden
\end{bibsection}

\vspace{2cm}        

\end{document}      

Which leads to: enter image description here

Can anyone help me?

share|improve this question
    
\fancyfootoffset{\dimexpr\marginparsep+\marginparwidth}? –  egreg Sep 3 '13 at 21:54
add comment

1 Answer

up vote 1 down vote accepted

Your header needs an offset to the left equal to the width of the space reserved for marginal notes (\marginparwidth) plus the separation between marginal notes and the text body (\marginparsep), like so

\fancyheadoffset[L]{\dimexpr\marginparsep+\marginparwidth}

A complete example:

\documentclass[10pt]{article}
\usepackage{calc}
\usepackage{graphicx}
\usepackage{caption}

\makeatletter
\newlength{\bibhang}
\setlength{\bibhang}{1em}
\newlength{\bibsep}
 {\@listi \global\bibsep\itemsep \global\advance\bibsep by\parsep}
\newenvironment{bibsection}%
        {\vspace{-\baselineskip}\begin{list}{}{%
       \setlength{\leftmargin}{\bibhang}%
       \setlength{\itemindent}{-\leftmargin}%
       \setlength{\itemsep}{\bibsep}%
       \setlength{\parsep}{\z@}%
        \setlength{\partopsep}{0pt}%
        \setlength{\topsep}{0pt}}}
        {\end{list}\vspace{-.6\baselineskip}}
\makeatother

\reversemarginpar

\usepackage[paper=a4paper,
            %includefoot, % Uncomment to put page number above margin
            marginparwidth=25mm,    % Length of section titles
            marginparsep=1.5mm,       % Space between titles and text
            margin=25mm,              % 25mm margins
            includemp]{geometry}

\usepackage{paralist}
\setlength{\parindent}{0in}



\usepackage{fancyhdr,lastpage}
\pagestyle{fancy}
\fancyheadoffset[L]{\dimexpr\marginparsep+\marginparwidth}
\fancyfootoffset{.2\textwidth}%\marginparsep+\marginparwidth
\lhead{The Curiculum Vitae of Vahid Ebrahimzade}
\rhead{\thepage}
\chead{}
\fancyfoot{}

\usepackage{color,hyperref}
\definecolor{darkblue}{rgb}{0.0,0.0,0.3}
\hypersetup{colorlinks,breaklinks,
            linkcolor=blue,urlcolor=blue,
            anchorcolor=blue,citecolor=kblue}

\renewcommand{\section}[2]%
        {\pagebreak[2]\vspace{1.3\baselineskip}%
         \phantomsection\addcontentsline{toc}{section}{#1}%
         \hspace{0in}%
         \marginpar{
         \raggedright \scshape #1}#2}

\newenvironment{innerlist}[1][\enskip\textbullet]%
        {\begin{compactitem}[#1]}{\end{compactitem}}

\newcommand{\blankline}{\quad\pagebreak[2]}

\begin{document}

\section{Forschungs-\newline t\"atigkeit}
%\vspace{.5cm}
\begin{bibsection}
\item Modellreduktion Methoden
\item Surrogate Modellierung; Polynomfunktion Methoden, Radiale Basisfunktion Methoden
\end{bibsection}

\vspace{2cm}        

\end{document}

enter image description here

As a side note, the \newline command in the argument of \section will pose you problems (with the bookmark, an eventual ToC entry). Were you using \section with a redefinition allowing the optional argument, this could've been easily solved.

share|improve this answer
    
Thanks it worked. :) –  Vahid Sep 4 '13 at 18:17
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.