示例.org

示例.org

使用 emacs org-mode 和 koma 字母脚本,如何设置垂直地址位置?

1手册第 484 页很好地概述了位置可能性。然而,这两行都没有达到预期的结果:

#+LATEX_HEADER: \setplength{toaddrvpos}{5cm}

#+LATEX_HEADER: \@setplength{toaddrvpos}{5cm}

示例.org

#+LATEX_CLASS: default-koma-letter
#+LATEX_HEADER: \setkomavar{signature}{\includegraphics[height=1cm]{signature.png}\\\usekomavar{fromname}}
#+LCO: SN
#+LANGUAGE: en
#+LATEX_HEADER: \setplength{toaddrvpos}{5cm}

#+AUTHOR: Bugs Bunny
#+TO_ADDRESS: Batman
#+SUBJECT: My subject
#+OPENING: My opening
#+CLOSING: My closing
#+FROM: From me

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec hendrerit tempor
tellus. Donec pretium posuere tellus. Proin quam nisl, tincidunt et, mattis
eget, convallis nec, purus. Cum sociis natoque penatibus et magnis dis
parturient montes, nascetur ridiculus mus. Nulla posuere. Donec vitae dolor.
Nullam tristique diam non turpis. Cras placerat accumsan nulla. Nullam rutrum.
Nam vestibulum accumsan nisl.

脚注

1 http://texdoc.net/texmf-dist/doc/latex/koma-script/scrguien.pdf

2 图片

答案1

定义一个自己的lco文件(推荐的解决方案):

\ProvidesFile{mySN.lco}[2019/04/13 letter-class-option]
\LoadLetterOption{SN}
\let\raggedsignature=\raggedright
\setplength{toaddrvpos}{10cm}
\endinput

然后

\documentclass[foldmarks,backaddress=false]{scrlttr2}
\usepackage{lipsum}% only for dummy text

\LoadLetterOption{visualize}% can be used only in preamble
\showfields{address}% visualize the position of the address field

\usepackage{graphicx}
\LoadLetterOption{mySN}% load the user defined lco file
\setkomavar{fromname}{Bugs Bunny}
\setkomavar{subject}{My Subject}
\setkomavar{signature}{\includegraphics[height=1cm]{example-image}\\\usekomavar{fromname}}

\begin{document}
\begin{letter}{Batman}
\opening{My opening}
\lipsum[1]
\closing{My closing}
\end{letter}
\end{document}

结果是

截屏

对于旧版 KOMA-Script(3.25 或更早版本),您必须在文件\setplength中用替换。\@setplengthlco


使用\AtBeginLetterSN.lco

\documentclass[foldmarks,backaddress=false]{scrlttr2}
\usepackage{lipsum}% only for dummy text

\LoadLetterOption{visualize}% can be used only in preamble
\showfields{address}% visualize the position of the address field

\usepackage{graphicx}
\AtBeginLetter{%
  \renewcommand{\raggedsignature}{\raggedright}%
  \setplength{toaddrvpos}{10cm}%
}
\LoadLetterOption{SN}
\setkomavar{fromname}{Bugs Bunny}
\setkomavar{subject}{My Subject}
\setkomavar{signature}{\includegraphics[height=1cm]{example-image}\\\usekomavar{fromname}}

\begin{document}
\begin{letter}{Batman}
\opening{My opening}
\lipsum[1]
\closing{My closing}
\end{letter}
\end{document}

结果和上面一样。

注意:对于较旧的 KOMA-Script 版本(3.25 或更早版本)和此解决方案,您必须替换

\setplength{toaddrvpos}{10cm}%

经过

\makeatletter\@setplength{toaddrvpos}{10cm}\makeatother

因为\AtBeginLetter在文档的序言中使用了。

相关内容