GeneralPlacing figure in header with text using the fancyhdr packag

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
N00bDaan
Posts: 14
Joined: Tue Feb 27, 2007 4:44 pm

Placing figure in header with text using the fancyhdr packag

Post by N00bDaan »

So here is the deal. I would like to have a figure in my header with to some text beside it.
I got the fancyhdr package and I have just this one last problem. With the following code, I can produce the header (see figure)

Code: Select all

\usepackage{fancydhr}
...
...
...
\newpage
\pagestyle{fancy} \pagenumbering{arabic} \setcounter{page}{1}
\addtolength{\headheight}{\baselineskip}
\newcommand{\ffont}{\fontsize{9}{9}\selectfont}
\lhead{}
\chead{}
\rhead{\bfseries\ffont Blablabla \\Blabalblalalblal \includegraphics[width=20pt]{ULB.jpg}}
\renewcommand{\headrulewidth}{0.4pt}
Image

As you can see the figure is to large to be on one line so LaTeX uses some extra space for the figure, which results in bumping the other text up. I've tried several things but I can not get the figure overlapping two lines, with the two lines of text beside it. I think I should force LaTeX into doing something with the text, or is there a way to manipulate the figure placement? Anyone with a bit of help?

Grtz.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
ssintay
Posts: 2
Joined: Tue Mar 20, 2007 1:52 pm

Placing figure in header with text using the fancyhdr packag

Post by ssintay »

Perhaps you can insert an array or table into the header. This might allow text into one column of the array and the figure in the next

Something like

Code: Select all

$\begin{array}{cc}
Some text here &
\includegraphics[height=.25in,width=.25in,angle=0]{./oim/axial_g2_cube2}
\end{array}$ 
Just an idea. I have never attempted what you suggest.
N00bDaan
Posts: 14
Joined: Tue Feb 27, 2007 4:44 pm

Placing figure in header with text using the fancyhdr packag

Post by N00bDaan »

ssintay wrote: Perhaps you can insert an array or table into the header. This might allow text into one column of the array and the figure in the next

Something like

Code: Select all

$\begin{array}{cc}
Some text here &
\includegraphics[height=.25in,width=.25in,angle=0]{./oim/axial_g2_cube2}
\end{array}$ 
Just an idea. I have never attempted what you suggest.


Nope, I don't get it working... Ofcourse it will allign properly horizontal because the array format, but it still messes around with the vertical alignment. This is propably because the figure extends the linewidth... Tricky. :)

Thanks for your help!
User avatar
localghost
Site Moderator
Posts: 9201
Joined: Fri Feb 02, 2007 12:06 pm

Placing figure in header with text using the fancyhdr packag

Post by localghost »

I would suggest to use a box around the text in the header.

Code: Select all

...
\rhead{\parbox{5cm}{\bfseries\ffont Blablabla\\Blabalblalalblal} \includegraphics[width=20pt]{ULB.jpg}}
...
You can specify the width of the parbox on your own. There is no warranty, because this is untested. You may use the \raggedleft command at the right place to get the text aligned.
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes[/size]

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1
N00bDaan
Posts: 14
Joined: Tue Feb 27, 2007 4:44 pm

Placing figure in header with text using the fancyhdr packag

Post by N00bDaan »

That works indeed.

Code: Select all

\rhead{\parbox[b]{10cm}{\raggedleft \bfseries\ffont Blabla\\Blabla2}  \includegraphics[width=21pt]{ULB.jpg}}
Post Reply