I have the following code to create my header



\usepackage{amsmath, amsthm, amssymb, url}


% Here the relevant code
\usepackage{scrpage2} \pagestyle{scrheadings}
\setkomafont{pagehead}{\sffamily\bfseries\small }
\rohead{Line1 \\[2pt] Line2 \\[8pt] \normalfont\sffamily\footnotesize{Line3}\\[-37pt]}

 Some text just to make a page

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

\setkomafont{pagehead}{\sffamily\bfseries\small }
\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}}

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


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

\setkomafont{pagehead}{\sffamily\bfseries\small }
\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]}}
  • 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