1

I have the following code to create my header

\documentclass[english]{scrreprt}

%%% PAGE DIMENSIONS
\usepackage{geometry} 
\geometry{verbose,a4paper,tmargin=3.5cm,bmargin=2.5cm,lmargin=2.6cm,rmargin=2.6cm,headheight=1.3cm,headsep=1cm}
\pagestyle{headings}

%%% PACKAGES
\usepackage{booktabs} 
\usepackage{array} 
\usepackage{paralist} 
\usepackage{verbatim}
\usepackage{subfig} 
\usepackage{amsmath, amsthm, amssymb, url}
\usepackage{enumitem}
\usepackage{mathrsfs}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{tabu,longtable,booktabs,caption}
\usepackage[pdftex]{graphicx,color}
\usepackage{scrpage2}

%%% OPTIONS
\setcounter{secnumdepth}{3}
\setlength{\parindent}{1em}
\setlist{nolistsep}
\tabulinesep=^1.5mm_1.5mm    

% Here the relevant code
\usepackage{scrpage2} \pagestyle{scrheadings}
\setkomafont{pagehead}{\sffamily\bfseries\small }
\clearscrheadfoot
\rohead{Line1 \\[2pt] Line2 \\[8pt] \normalfont\sffamily\footnotesize{Line3}\\[-37pt]}
\lohead{\rule{2cm}{2cm}\vspace{0.05cm}}
\setheadsepline{0.4pt}

\begin{document}
 Some text just to make a page
\end{document}

But at compile time I was having a conflict. Here I found out that I need to substitute \\ with \linebreak because I am using longtabu

Now my question: with the old code Line3 was below the line created with \setheadsepline, now it is above. Is there a way of restoring its position while retaining the \linebreak fix?

Edit: As suggested in the comments I have tried

\makeatletter
%%% HEADERS
\pagestyle{scrheadings}
\setkomafont{pagehead}{\sffamily\bfseries\small }
\clearscrheadfoot
\rohead{Line 1 \@normalcr[2pt] Line 3 \@normalcr[8pt] \normalfont\sffamily\footnotesize{Line 3}\@normalcr[-37pt]}
\lohead{\includegraphics[scale=0.4, trim= -0.0cm 0.05cm 0cm 0cm]{logo.pdf}\vspace{0.05cm}}
\setheadsepline{0.4pt}
\makeatother

but the text is aligned in the middle of the page, not on the right side. How can I fix the horizontal alignment?

Note1: I already tested inserting \hfill on each line, but it has effect only on the first line, the second and the third are still in the center of the page.

Note2: Tested \raggedleft, same result as \hfill

Edit2: SOLVED

I have no idea if this is the cleanest solution, but it does what I was looking for

\makeatletter
\pagestyle{scrheadings}
\setkomafont{pagehead}{\sffamily\bfseries\small }
\clearscrheadfoot
\lohead{\includegraphics[scale=0.4, trim= -0.0cm 0.05cm 0cm 0cm]{logo.pdf}\vspace{0.05cm}}
\rohead{Line1 \linebreak \@normalcr[-9pt] Line2 \linebreak\@normalcr[-2pt] \normalfont\sffamily\footnotesize{Line3 \linebreak\@normalcr[-49pt]}}
\setheadsepline{0.4pt}
\makeatother
12
  • 1
    \linebreak doesn't really work like \\ you probably want \newline or if you need the optional argument \@normalcr[-37pt in which case you want \makeatletter or put teh code in a local package/class file. Mar 12, 2013 at 16:31
  • I have tried \newline but instead of obtaining lines right-justified the lines were centered (and it was still in the \rohead argument). Any idea?
    – Federico
    Mar 12, 2013 at 16:38
  • Welcome to TeX.sx! Mar 12, 2013 at 16:43
  • Hi @PeterJansson, thank you for the welcome. I am not new to StackExchange, so I thought I knew how to ask a question; is there something not proper in my post?
    – Federico
    Mar 12, 2013 at 16:46
  • 1
    surround your definition with \makeatletter \makeatother if you use @ see tex.stackexchange.com/questions/8351/… Mar 12, 2013 at 17:35

0