[Tex/LaTex] How to set this content into the header properly, when ihead & markright did not work well / at all

header-footer

After creating my headline here How to arrange / align / place pictures and text, to form a given headline? I guessed, I would just place it into the header with \ihead and \thispagestyle{scrheadings} – but NO.

Problem is, the following text is placed uppon my header. And when I try to use markright I get eighter compile errors or no header at all.

I read some infos about using \protect, but it did not help eighter. I am guessing, that my constuct itself is simply not that easy to migrate into a header. I hope I can solve this on my own, but maybe someone else seeks a challange too 🙂

Here is the code, the images to it are available through the link before:

\documentclass[
    pdftex,
    a4paper,
    11pt,
    DIV15,
    BCOR20mm,
    parskip,
    numbers=noenddot]{scrbook}
    \usepackage{graphics} 
    \usepackage[pdftex]{graphicx}
    \usepackage{scrpage2}
    \usepackage{setspace} 
\begin{document}
\thispagestyle{scrheadings}
        \noindent
       \ihead{
        \textsf{
        \begin{singlespace}
             \raisebox{-0.5\height}{\rlap{\includegraphics[scale=0.5]{left_demo.png}}}
            \hfill
            %\includegraphics[height=60px]{center_demo.png}
            %\hfill
            \raisebox{-0.15\height}{\llap{
            \scriptsize %
            \begin{tabular}[c]{@{}r@{}}
                  somedemo txt abcdefghij,\\
                  texttextte txt texttexttextetscter\\
                  \\
                  demodemode demodemode
            \end{tabular}}}
            \raisebox{-0.525\height}{\includegraphics[height=45px]{right_demo.png}}
        \end{singlespace}}}
        \huge{text}
\end{document}

I do really appreciate any help on this, thanks!

Edit:

Here is what's wrong:

enter image description here

the text in the red circle should not be that high (used ihead here)

Best Answer

The problem is that your images take more vertical spacing than the default vertical space reserved for the header. When you process your code you will get a warning like this:

Overfull \vbox (57.3689pt too high) has occurred while \output is active

(the actual value for the overfull box will depend on the actual images). The value for \headheight has to be increased accordingly to prevent the warning and you can do this using headlines= or headheight= (this probably implies a change in the page layout).

Here's a little example. From the comments it's clear that the intent is to change the page style for the titlepage; one possibility to achieve this is to define a new page style and to use the geometry package to temporarily change the headheight value without modifications to the page layout made as class options through DIV and BCORR (adjust the length according to your needs); since the contents of the footer for this style was not specified I used some dummy options in the definition of the new page style:

\documentclass[pdftex,a4paper,11pt,DIV15,BCOR20mm,parskip,numbers=noenddot]{scrbook}
\usepackage{graphicx}
\usepackage{scrpage2}
\usepackage{geometry}
\usepackage{setspace} 
\usepackage{lipsum} 

\defpagestyle{mystyle}{%
\ihead{\sffamily%
  \raisebox{-0.5\height}{\rlap{\includegraphics[scale=0.5]{cat}}}\hfill
            %\includegraphics[height=60px]{center_demo.png}
            %\hfill
 \raisebox{-0.15\height}{\llap{%
    \scriptsize %
    \begin{tabular}[c]{@{}r@{}}
    somedemo txt abcdefghij,\\
    texttextte txt texttexttextetscter\\
    \\
    demodemode demodemode
    \end{tabular}}}
  \raisebox{-0.525\height}{\includegraphics[height=45px]{cat}}
 }
}{\ifoot{inside}\cfoot{center}\ofoot{outside}}

\begin{document}

\begin{titlepage}
\pagestyle{scrheadings}
\thispagestyle{mystyle}
\newgeometry{headheight=45pt}
{\huge text} 
\lipsum[1-3]
\end{titlepage}

\clearpage
\restoregeometry

\lipsum[1-4]

\end{document}

enter image description here

Not relevant to the problem mentioned, but the font size switches (\Huge, \huge, \LARGE, etc.) are declarations that do not have arguments, so instead of \huge{text}, you should use {\huge text} (to keep the change local and possibly using \par inside the group if required).

Related Question