latex-export image using fancyhdr

I use following preamble in org file to export my regular documents. I want to add logo to right header, but for some reason, the \includegraphics command is not getting exported.

Here is the code

#+OPTIONS: num:nil; p:t
#+OPTIONS: toc:nil
#+LATEX_HEADER:\usepackage{geometry} % See geometry.pdf to learn the layout options. There are lots.
#+LATEX_HEADER:\geometry{a4paper} % or letterpaper (US) or a5paper or....
#+LATEX_HEADER:\usepackage{graphicx} % support the \includegraphics command and options
#+LATEX_HEADER:\fancyhead[L] {{\huge \bfseries My hospital,} \\ 4th floor, My Building \\ My City square, City  }
#+LATEX_HEADER:\fancyfoot [L]{{\Large \bfseries Dr My Name} \\{\small  MD (Med), DNB(Med), DM (Specialty)}\\ Reg No 123 }
#+LATEX_HEADER:\fancyfoot [R]{{\Large \bfseries Dr Other Name}\\{ \small MBBS DOMS} \\  Reg No  0001}


Kindly help

In short, how can I use \rhead{\includegraphics[width=1cm]{example-image-a}} in org mode

• Have you looked at the .tex file that is produced? That might give you a clue about what's going wrong. If that looks OK, then process the tex file directly from the command line and see if that works. Mar 16 '20 at 16:44
• What is the error? FWIW, I produce a .tex file with C-c C-e l l and process it with latexmk -xelatex --shell-escape <file>.tex and it works fine. The reason I break the processing into two pieces is that my org-latex-pdf-process variable is set to (texi2dvi --pdf %f) which cannot deal with fontspec and xelatex apparently. What is the setting of your org-latex-pdf-process variable? Mar 16 '20 at 17:18

I think you read this .tex question - and your question is really how to transfer it to org-mode. Try/modify your headers according to the below code:

#+LaTeX_HEADER: \usepackage{fancyhdr}


And the result is this:

• While everything else work, only the includegraphic portion is not getting transferred to resulting intermediate tex file. It is sort of getting filtered Mar 18 '20 at 4:02
• Do you have the package wrapfig declared in your variable org-latex-default-packages-alist ? That one is responsible for figure placement.
– Ian
Mar 18 '20 at 8:10

When I replace [scale=0.15] with [width = 2cm], everything work fine .

• If you read my code posted, it is exactly as you do here.
– Ian
Mar 19 '20 at 14:35