0

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:\usepackage{fancyhdr, lastpage}
    #+LATEX_HEADER:\usepackage{fontspec,xltxtra}
    #+LATEX_HEADER:\usepackage{polyglossia}
    #+LATEX_HEADER:\usepackage[Latin,Devanagari]{ucharclasses} 
    #+LATEX_HEADER:\setlength{\parindent}{0pt}
    #+LATEX_HEADER:\fancyhead{}
    #+LATEX_HEADER:\headsep= .51 cm
    #+LATEX_HEADER:\headheight= 1.5 cm
    #+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}
    #+LATEX_HEADER:\renewcommand{\headrulewidth}{0pt}
    #+LATEX_HEADER:\fancyhead[R]{\includegraphics[scale=0.15]{c:/gl.jpg}}
    #+LATEX_HEADER:\pagestyle{fancy}
    #+LATEX_HEADER: \setmainfont{Halant}

Kindly help

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

Vaibhav
  • 573
  • 3
  • 15
  • 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. – NickD 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 .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? – NickD Mar 16 '20 at 17:18

2 Answers2

1

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}
#+LATEX_HEADER: \pagestyle{fancy}
#+ATTR_LATEX:   \setlength\headheight{26pt}
#+LATEX_HEADER: \fancyhead[R]{\includegraphics[width=1cm]{fig1.png}}

And the result is this:

enter image description here

Ian
  • 1,321
  • 10
  • 12
  • While everything else work, only the includegraphic portion is not getting transferred to resulting intermediate tex file. It is sort of getting filtered – Vaibhav Mar 18 '20 at 04: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 08:10
0

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

Stefan
  • 26,154
  • 3
  • 46
  • 84
Vaibhav
  • 573
  • 3
  • 15