Page Layoutimage only on left headerside of right page !?

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
monstera
Posts: 3
Joined: Fri Oct 23, 2009 11:32 am

image only on left headerside of right page !?

Post by monstera »

Hi,

I'm trying to get images in the header. I succeeded in putting one on the left header side of the right page. But I'm unable to put it on the right header side of the left page.

I'm using fancyheaders and the working code for the right page is:

Code: Select all

\lhead[\textsc{\rightmark}]{
  \setlength{\unitlength}{1mm}
  \begin{picture}(0,0)
    \includegraphics[width=16mm,height=8mm]{header.png}
  \end{picture}}
Now I put the code in the curly brackets of the \lhead statement in the square brackets of the \rhead statement.

Code: Select all

\rhead[
  \setlength{\unitlength}{1mm}
  \begin{picture}(0,0)
    \includegraphics[width=16mm,height=8mm]{header.png}
  \end{picture}]{
  \textsc{\rightmark}}
This, I think, should work as usual an display the image on the right header side of the left page.

But it gives me some four hundred errors (distributed across the whole document) and the first one refers to the line \end{picture} in the \rhead statement.
Too many }'s \end{picture}

But the bracket count is correct.

Does someone know what causes this peculiar problem and how to solve it?

I'd be very happy.

Thanks in Advance!

monstera

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

image only on left headerside of right page !?

Post by localghost »

Build a small, complete and compilable example (MWE). Replace the concerned picture with a \rule command.


Best regards and welcome to the board
Thorsten¹
monstera
Posts: 3
Joined: Fri Oct 23, 2009 11:32 am

Re: image only on left headerside of right page !?

Post by monstera »

The \rule behaves well in every case and doesn't reproduce the error. So I'm not able to provide you with an MWE.

The problem occurs with the \lhead statement as well if I put the \picture statement in the square brackets istead of the curly brackets of the \lhead statement.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10323
Joined: Mon Mar 10, 2008 9:44 pm

image only on left headerside of right page !?

Post by Stefan Kottwitz »

Hi monstera,

square brackets cannot be nested this way, the square brackets of \includegraphics could cause a problem when used in an optional parameter. The problem can be fixed by using additional curly braces:

Code: Select all

\rhead[{
  \setlength{\unitlength}{1mm}
  \begin{picture}(0,0)
    \includegraphics[width=16mm,height=8mm]{header.png}
  \end{picture}}]{
  \textsc{\rightmark}}
Stefan
LaTeX.org admin
monstera
Posts: 3
Joined: Fri Oct 23, 2009 11:32 am

Re: image only on left headerside of right page !?

Post by monstera »

Hey Stefan,

The curly braces solved the problem.
Nasty nested stuff .. ;)

Thx a lot!
Post Reply