在信件中添加图片作为地址

在信件中添加图片作为地址

我是 LaTeX 的初学者,我想写一封信,信中还可以包含一个标题中的图像和一个代表地址的图像。我在 tex.stackexchange 中找到了如何在标题中包含图像的方法,但我无法将图像作为地址包含在内,也找不到如何做到这一点的方法。你能帮帮我吗?代码如下:

\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}

这是我得到的。我还显示了我想要放置第二张图片的位置,即地址位置(日期当然会稍微往下移一点)。

在此处输入图片描述

答案1

滥用 \date命令:

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

您的代码:

\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}

在此处输入图片描述

答案2

你可以加

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

或者

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

就在之前

\opening{Dear Some Name,}

答案3

在页面背景中使用 PDF 图像作为一种可能的解决方案。如果您有多个需要对齐的图形元素,我特别建议您这样做。如果您只需要右上角的一个图像,该线程中的其他建议也可以很好地工作。

相关内容