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
Federico
  • 873
  • 1
  • 7
  • 21
  • 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. – David Carlisle Mar 12 '13 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 '13 at 16:38
  • 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 '13 at 16:46
  • Hi, no problem at all. All first posts are subject to a review and we always leave a "Welcome" to "new" (in the sense of a first post) users. – Peter Jansson Mar 12 '13 at 16:51
  • @DavidCarlisle my apologies, I included the full list of packages that I have to use. The logo is 2cm by 2cm. – Federico Mar 12 '13 at 16:58
  • @Federico I edited the example so it runs, it isn't clear what you want to change: If you change \\[-37pt to \\[-55pt] then line3 comes below the line.... – David Carlisle Mar 12 '13 at 17:06
  • @DavidCarlisle what have you used? \linebreak or \newline? I will try to make that change as soon as possible, thanks. Also, \\ must be removed: it conflicts with longtabu (not included in the snippet because not relevant now) – Federico Mar 12 '13 at 17:11
  • I just used your example as posted, using \\ As I said in the initial comment you can use \@normalcr if you need to access the original definition of \\ – David Carlisle Mar 12 '13 at 17:16
  • @DavidCarlisle, sorry, I did not understood what you meant there, this aspect of LaTeX is quite new to me. I will try with that command. – Federico Mar 12 '13 at 17:31
  • 1
    surround your definition with \makeatletter \makeatother if you use @ see http://tex.stackexchange.com/questions/8351/what-do-makeatletter-and-makeatother-do – David Carlisle Mar 12 '13 at 17:35
  • @DavidCarlisle the output is not what I was expecting, have I done something wrong? – Federico Mar 15 '13 at 07:51

0 Answers0