1

I'm a beginner at LaTeX and I want to write a letter where I can also include an image in the header and an image that represents the address. I found in tex.stackexchange how to include the image in the header, but I couldn't include an image as an adress and couldn't find how anywhere. Could you please help me? Here's the code:

\documentclass{letter}
\usepackage{blindtext}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[francais]{babel}
\usepackage{graphicx}
\usepackage{fancyhdr}
\usepackage{geometry}

\geometry{headheight = 1.2in}
\fancypagestyle{firstpage}{\fancyhf{}\fancyhead[C]{\includegraphics[height=0.7in, keepaspectratio=true]{UCA_logo.jpg}}}
\fancypagestyle{plain}{\fancyhf{}\fancyhead[C]{\includegraphics[height=0.7in, keepaspectratio=true]{UCA_logo.jpg}}}
\pagestyle{plain}
\date{5 mars 2015}
\begin{document}
    \begin{letter}{Lettre à tout lecteur\\ qu'il soit lecteur ou\\ non-lecteur en bonne santé}
        \opening{Dear Some Name,}
        \blindtext
\closing{Cordialement, (formule de politesse)}
    \end{letter}
\end{document}

Here's what I get. I also showed where I'd like to have my second image, which is in the address position (The date will of course go down a bit).

enter image description here

Scientifica
  • 115
  • 1
  • 7

3 Answers3

2

you can add

\hfill\includegraphics[height=0.7in, keepaspectratio=true]{myfoto}\par

or

\hfill\includegraphics[height=0.7in, keepaspectratio=true]{myfoto}\\

just befor

\opening{Dear Some Name,}
touhami
  • 19,520
  • Thank you for your answer! What you suggested worked! I looked for \hfill description but I couldn't understand how did it make the image there. Could you please explain to me? – Scientifica Mar 07 '15 at 13:29
2

Abuse \date command:

\date{\includegraphics[width=2cm]{example-image-a}\\5 mars 2015}

Your code:

\documentclass{letter}
\usepackage{blindtext}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[francais]{babel}
\usepackage{graphicx}
\usepackage{fancyhdr}
\usepackage{geometry}

\geometry{headheight = 1.2in}
\fancypagestyle{firstpage}{\fancyhf{}\fancyhead[C]{\includegraphics[height=0.7in, keepaspectratio=true]{logo}}}
\fancypagestyle{plain}{\fancyhf{}\fancyhead[C]{\includegraphics[height=0.7in, keepaspectratio=true]{logo}}}
\pagestyle{plain}
\date{\includegraphics[width=2cm]{example-image-a}\\5 mars 2015}
\begin{document}
    \begin{letter}{Lettre à tout lecteur\\ qu'il soit lecteur ou\\ non-lecteur en bonne santé}
        \opening{Dear Some Name,}
        \blindtext
\closing{Cordialement, (formule de politesse)}
    \end{letter}
\end{document}

enter image description here

1

See using a PDF image in the background of the page as one possible solution. I suggest it in particular if you have multiple graphical elements that need to be aligned. If you need just one image in the top right the other suggestions in that thread could work well, too.

  • Thank you for your answer! I tried using what you said, using \documentclass{dinbrief} but I got the error: "! LaTeX Error: Command \up already defined. Or name \end... illegal, see p.192 of the manual." What I did is changing the class and inserting the code you put from line 5 to line 15 into my code putting it just after \date{5 mars 2015}. Could you please tell me what's wrong? – Scientifica Mar 07 '15 at 13:28