1

I am using this code:

\rhead{\textsc{\includegraphics[height=36pt]{my_pict}}}
\renewcommand{\headrulewidth}{0pt}
\setlength{\headheight}{40pt} 

to set a logo on the right hand of the header (I have also another one on the left).

It works nicely until I try to enlarge the text with

\usepackage[textwidth=17cm]{geometry}

the left logo seems still in a good position, while the right one get shifted towards the center.

How can I keep it bound to the right edge of the text?

here is the simplified version of the beginning of the file:

\documentclass[english]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{fancyhdr}

\pagestyle{fancy}
\fancyhf{}

\renewcommand{\headrulewidth}{0pt}
\setlength{\headheight}{40pt} 

\lhead{\textsc{\includegraphics[height=36pt]{SciData_logo.jpg}}}
\rhead{\textsc{\includegraphics[height=36pt]{./paper_figures/OF_logo.png}}}


\usepackage[textwidth=17cm]{geometry}

\begin{document}
text
\end{document}

Thanks for help

  • 1
    Hello and welcome to TexSE. Can you add a minimal working example: tex.meta.stackexchange.com/questions/228/… – Bobyandbob Mar 29 '17 at 13:01
  • does that help? you can put any other picture I guess - should I provide screenshots of the issue? – jjrr Mar 29 '17 at 15:08
  • Good. No. You can use example images with example-image or example-image-a... Hint: You forgot \end{document} – Bobyandbob Mar 29 '17 at 15:24
0

Use \usepackage[textwidth=17cm]{geometry} to specify page dimension above \pagestyle{fancy}. Since it is a package that changes a relatively large number of parameters within the document, it should be included as one of the last or last packages to ensure that the settings have not been overwritten by one of the following packages.

With \usepackage{showframe} you can make page margins visible.

enter image description here

MWE:

\documentclass[english]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{fancyhdr}
\usepackage[textwidth=17cm]{geometry}

\pagestyle{fancy}
\fancyhf{}

\renewcommand{\headrulewidth}{0pt}
\setlength{\headheight}{40pt} 

\lhead{\textsc{\includegraphics[height=36pt]{example-image-a}}}
\rhead{\textsc{\includegraphics[height=36pt]{example-image-b}}}


%\usepackage{showframe}
\usepackage{lipsum}
\begin{document}
\lipsum
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.