TransWikia.com

Problem with margins when placing an image in header using fancyheader

TeX - LaTeX Asked on July 26, 2021

I am trying to place an image in the header and spacing it 4.5mm from the top of the page and 4.5 mm from the right of the page.

In the TexWorks preview it looks like clearly less than 4.5 mm space:

enter image description here

But when printing it goes even wronger:

enter image description here

The top margin is 6mm and the right margin is 3mm.

The code that generates this is this:

In the .sty:

NeedsTeXFormat{LaTeX2e}
ProvidesPackage{exampleStyleSheet}[2020/06/28 Example style LaTeX package]

RequirePackage{tabularx}




%Logo
RequirePackage[a4paper, top=0.045cm,right=0.045cm, includehead,includefoot]{geometry}
RequirePackage{fancyhdr}
RequirePackage{showframe}
RequirePackage{layouts}
RequirePackage{xcolor}
RequirePackage{graphicx}
graphicspath{ {./logo/} }
newcommand{makelogo}{

pagestyle{fancy}
setlength{headsep}{1cm}
setlength{headheight}{2cm}
fboxrule=1pt%border thickness
rhead{fcolorbox{red}{yellow}{includegraphics[height=headheight]{../logo/BLLogoC.png}}}
hfill
}

And in the .tex file:

documentclass{article}


usepackage[utf8]{inputenc}
usepackage{graphicx}
usepackage{cancel}
usepackage{amsmath}


usepackage{./exampleStyleSheet}


begin{document}
makelogo
end{document}

Is there a way to fix this? Feeling frazzled as I’ve been trying to do this for hours.

Edit
My printer dialogue is auto-set to "shrink to fit" and when I select "actual size" it will be about a cm outside the page both at the top and at the right.

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP