信头:如何将图像放置在左上角(重访)

信头:如何将图像放置在左上角(重访)

我正在尝试使用精确的模板,但我想在左上角放置一个矩形图像(如果您需要,我可以为您提供所述矩形的尺寸)。我不知道图形包本身是否有帮助。

相关信息:

*信件长度不会超过一页。

*插入图像的底部必须与文档中的黑线一样长。

*此图像的顶部必须与右上角的“John Smith”的顶部齐平。


编辑(1):

其实,不用管黑线标准,因为地址会改变,这意味着黑线长度也会改变。


编辑(2):

插入签名的方法如下

\closing{此致,\\ $\hspace{7cm}$\includegraphics{signature.png}}


编辑(3):

我还有最后一个问题:我怎样才能去掉下面有黑线的这个地址?它看起来是多余的。

答案1

要添加图像,您可以使用fromlogo插入:

\setkomavar{fromlogo}{<contents>}

要去除折叠痕迹,请更换

foldmarks=true

foldmarks=false

完整的示例(根据您的实际图像,您可能需要调整一些使用的长度):

% Original author:
% Micha Elmueller (http://micha.elmueller.net/)
\documentclass[
    pagenumber=false, % Removes page numbers from page 2 onwards
    parskip=half, % Separates paragraphs with some whitespace, use parskip=full for more space or comment out to return to default
    fromalign=right, % Aligns the from address to the right
    foldmarks=false, % If "true", prints small fold marks on the left of the page
    addrfield=true, % Set to false to hide the addressee section - you will then want to adjust the height of the body of the letter on the page by adding the following in this section: \makeatletter \@setplength{refvpos}{\useplength{toaddrvpos}} \makeatletter
fromlogo=true
    ]{scrlttr2}

\usepackage[english]{babel} % Explicitly load the babel package to stop an error occurring on some LaTeX installations

\renewcommand*{\raggedsignature}{\raggedright} % Stop the signature from indenting
\usepackage{graphicx}

%----------------------------------------------------------------------------------------
%   YOUR INFORMATION AND LETTER DATE
%----------------------------------------------------------------------------------------

\setkomavar{fromname}{John Smith} % Your name used in the from address
\setkomavar{fromaddress}{123 Broadway \\ City, State 12345} % Your address
\setkomavar{signature}{John Smith} % Your name used in the signature
\setkomavar{fromlogo}{\raisebox{-2pt}{\includegraphics[width=5.84cm,height=1.5cm]{example-image-a}}}

\date{\today} % Date of the letter

%----------------------------------------------------------------------------------------

\begin{document}
%----------------------------------------------------------------------------------------
%   ADDRESSEE
%----------------------------------------------------------------------------------------

\begin{letter}{Director \\ Corporation \\ 123 Pleasant Lane \\ City, State 12345} % Addressee name and address

%----------------------------------------------------------------------------------------
%   LETTER CONTENT
%----------------------------------------------------------------------------------------
%\includeimage[width=5cm,height=2cm]{example-image-a}

\opening{Dear Sir or Madam,}

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam aliquet tellus vel justo porta et semper libero rutrum. Duis vestibulum sagittis aliquam. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus ac velit eu dolor lobortis fringilla. Quisque imperdiet porta ante in pretium. Maecenas facilisis varius metus et blandit. Proin rhoncus arcu non ante elementum non vehicula sem varius. Morbi feugiat, elit eget tristique posuere, urna eros vestibulum nibh, at tempus neque justo nec enim.

Curabitur id est enim. Suspendisse potenti. Fusce eleifend sodales tortor, a interdum tortor sollicitudin vel. Morbi vel tellus enim, eget hendrerit ligula. Proin molestie suscipit erat, eget consectetur orci convallis at. Ut vestibulum, odio vitae blandit dignissim, dui magna auctor leo, at molestie augue magna sed nisi. Phasellus ipsum magna, fringilla id tempor id, tristique vitae mauris. Maecenas sed orci vel eros consectetur ultrices.

Mauris enim velit, feugiat at venenatis eu, scelerisque vitae mauris. Nullam accumsan facilisis mauris sagittis iaculis. Mauris condimentum dictum libero. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Nullam consequat malesuada feugiat. Vestibulum tempor commodo turpis id gravida.

\closing{Sincerely,}

\setkomavar*{enclseparator}{Attached} % Change the default "encl:" to "Attached:"
\encl{Copyright permission form} % Attached documents

%----------------------------------------------------------------------------------------

\end{letter}

\end{document}

在此处输入图片描述

要从“backadress”及其规则中删除发件人信息,请添加

backaddress=off

到类选项,如

\documentclass[
    pagenumber=false,
    parskip=half,
    fromalign=right,
    foldmarks=false,
    addrfield=true,
    fromlogo=true,
    backaddress=off
]{scrlttr2}

答案2

除了添加graphicx包之外,我还在字母环境的开头添加了几行。

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Full Size Formal Letter
% LaTeX Template
% Version 1.2 (8/2/13)
%
% This template has been downloaded from:
% http://www.LaTeXTemplates.com
%
% Original author:
% Micha Elmueller (http://micha.elmueller.net/)
%
% License:
% CC BY-NC-SA 3.0 (http://creativecommons.org/licenses/by-nc-sa/3.0/)
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%----------------------------------------------------------------------------------------
%   DOCUMENT CONFIGURATIONS
%----------------------------------------------------------------------------------------

\documentclass[
    pagenumber=false, % Removes page numbers from page 2 onwards
    parskip=half, % Separates paragraphs with some whitespace, use parskip=full for more space or comment out to return to default
    fromalign=right, % Aligns the from address to the right
    foldmarks=true, % Prints small fold marks on the left of the page
    addrfield=true % Set to false to hide the addressee section - you will then want to adjust the height of the body of the letter on the page by adding the following in this section: \makeatletter \@setplength{refvpos}{\useplength{toaddrvpos}} \makeatletter
    ]{scrlttr2}

\usepackage[english]{babel} % Explicitly load the babel package to stop an error occurring on some LaTeX installations
\usepackage{graphicx}

\renewcommand*{\raggedsignature}{\raggedright} % Stop the signature from indenting

%----------------------------------------------------------------------------------------
%   YOUR INFORMATION AND LETTER DATE
%----------------------------------------------------------------------------------------

\setkomavar{fromname}{John Smith} % Your name used in the from address
\setkomavar{fromaddress}{123 Broadway \\ City, State 12345} % Your address
\setkomavar{signature}{John Smith} % Your name used in the signature

\date{\today} % Date of the letter

%----------------------------------------------------------------------------------------

\begin{document}

%----------------------------------------------------------------------------------------
%   ADDRESSEE
%----------------------------------------------------------------------------------------

\begin{letter}{%
\rlap{\smash{\shortstack{
\includegraphics[scale=.2]{example-image}% <-IMAGE GOES HERE
\\\rule{0in}{1.in}}}}%  <- VERTICAL OFFSET GOES HERE
Director \\ Corporation \\ 123 Pleasant Lane \\ City, State 12345} % Addressee name and address

%----------------------------------------------------------------------------------------
%   LETTER CONTENT
%----------------------------------------------------------------------------------------

\opening{Dear Sir or Madam,}

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam aliquet tellus vel justo porta et semper libero rutrum. Duis vestibulum sagittis aliquam. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus ac velit eu dolor lobortis fringilla. Quisque imperdiet porta ante in pretium. Maecenas facilisis varius metus et blandit. Proin rhoncus arcu non ante elementum non vehicula sem varius. Morbi feugiat, elit eget tristique posuere, urna eros vestibulum nibh, at tempus neque justo nec enim.

Curabitur id est enim. Suspendisse potenti. Fusce eleifend sodales tortor, a interdum tortor sollicitudin vel. Morbi vel tellus enim, eget hendrerit ligula. Proin molestie suscipit erat, eget consectetur orci convallis at. Ut vestibulum, odio vitae blandit dignissim, dui magna auctor leo, at molestie augue magna sed nisi. Phasellus ipsum magna, fringilla id tempor id, tristique vitae mauris. Maecenas sed orci vel eros consectetur ultrices.

Mauris enim velit, feugiat at venenatis eu, scelerisque vitae mauris. Nullam accumsan facilisis mauris sagittis iaculis. Mauris condimentum dictum libero. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Nullam consequat malesuada feugiat. Vestibulum tempor commodo turpis id gravida.

\closing{Sincerely,}

\setkomavar*{enclseparator}{Attached} % Change the default "encl:" to "Attached:"
\encl{Copyright permission form} % Attached documents

%----------------------------------------------------------------------------------------

\end{letter}

\end{document}

在此处输入图片描述

相关内容