LuaLaTeX KOMA scrlttr2 不含电子邮件:

LuaLaTeX KOMA scrlttr2 不含电子邮件:

我用 KOMA 脚本制作了一封信scrlttr2并激活了它fromemail=on,但它会在电子邮件的行中显示预先的电子邮件:如下所示:。E-Mail: [email protected]

现在我不喜欢那里的预置E-Mail:。能以某种方式将其取消吗?

答案1

目前还不清楚您是否希望那里没有电子邮件或只是一个符号。不过,以下 MWE 向您展示了如何更改文本:

\documentclass[
  fontsize=11pt,
  paper=a4,
  parskip=half,
  enlargefirstpage=on,    % More space on first page
  fromalign=right,        % PLacement of name in letter head
  fromphone=on,           % Turn on phone number of sender
  fromrule=aftername,     % Rule after sender name in letter head
  fromemail=true,         % <===========================================
  addrfield=on,           % Adress field for envelope with window
  backaddress=on,         % Sender address in this window
  subject=beforeopening,  % Placement of subject
  locfield=narrow,        % Additional field for sender
  foldmarks=on,           % Print foldmarks
]{scrlttr2}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{blindtext}

\setkomafont{fromname}{\sffamily \LARGE}
\setkomafont{fromaddress}{\sffamily}%% statt \small
\setkomafont{pagenumber}{\sffamily}
\setkomafont{subject}{\bfseries}
\setkomafont{backaddress}{\mdseries}

\LoadLetterOption{DIN}
\setkomavar{fromname}{Max Musterfrau}
\setkomavar{fromaddress}{Musterstrasse 9,\\12345 Ort}
\setkomavar{fromphone}{+49\,12\,34\,56\,789}
\setkomavar{fromemail}{[email protected]} 
\setkomavar{signature}{(Max Musterfrau)}
\setkomavar{place}{Ort}
\setkomavar{date}{\today}
\usepackage{marvosym} % <================================================

\begin{document}
\renewcaptionname{english}\emailname{\Email} % <=========================
\renewcaptionname{english}\phonename{\Telefon} % <=======================
\begin{letter}{To: Claire Laterfield}
\setkomavar{subject}{Greetings}
\opening{Dear Claire,}
I am writing this letter because I have nothing better to do.

\closing{Sincerely,}
\end{letter}
\end{document}

代码中标有 的行很重要% <===========

marvosym加载电子邮件等的符号。\renewcaptionname您可以建议 KOMA-Script 使用给定的符号而不是文本。

得到的pdf是:

在此处输入图片描述

如果没有用于电子邮件等的符号或文本,您必须按以下方式更改代码:将文本/符号更改为~(空白),将分隔符~也更改为:\setkomavar{emailseparator}{~}

使用以下 MWE

\documentclass[
  fontsize=11pt,
  paper=a4,
  parskip=half,
  enlargefirstpage=on,    % More space on first page
  fromalign=right,        % PLacement of name in letter head
  fromphone=on,           % Turn on phone number of sender
  fromrule=aftername,     % Rule after sender name in letter head
  fromemail=true,         % <===========================================
  addrfield=on,           % Adress field for envelope with window
  backaddress=on,         % Sender address in this window
  subject=beforeopening,  % Placement of subject
  locfield=narrow,        % Additional field for sender
  foldmarks=on,           % Print foldmarks
]{scrlttr2}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{blindtext}

\setkomafont{fromname}{\sffamily \LARGE}
\setkomafont{fromaddress}{\sffamily}%% statt \small
\setkomafont{pagenumber}{\sffamily}
\setkomafont{subject}{\bfseries}
\setkomafont{backaddress}{\mdseries}

\LoadLetterOption{DIN}
\setkomavar{fromname}{Max Musterfrau}
\setkomavar{fromaddress}{Musterstrasse 9\\12345 Ort}
\setkomavar{fromphone}{+49\,12\,34\,56\,789}
\setkomavar{fromemail}{[email protected]} 
\setkomavar{signature}{(Max Musterfrau)}
\setkomavar{place}{Ort}
\setkomavar{date}{\today}
%\usepackage{marvosym} % <================================================
\setkomavar{phoneseparator}{~} % <========================================
\setkomavar{emailseparator}{~} % <========================================

\begin{document}
\renewcaptionname{english}\emailname{~} % <=========================
\renewcaptionname{english}\phonename{~} % <=======================
\begin{letter}{To: Claire Laterfield}
\setkomavar{subject}{Greetings}
\opening{Dear Claire,}
I am writing this letter because I have nothing better to do.

\closing{Sincerely,}
\end{letter}
\end{document}

你得到了想要的结果:

在此处输入图片描述

答案2

事实证明这实际上相当容易,无需篡改emailseparator或重新定义即可实现\emailname

正如您在文档表 4.7 中看到的,fromemail变量的默认描述是\usekomavar*{emailseparator}\usekomavar{emailseparator}。该描述编译为您看到的“电子邮件:”。

更改此描述的最简单方法是在设置 koma 变量时提供 on。因此,您只需编写\setkomavar{fromemail}{[email protected]}\setkomavar{fromemail}[]{[email protected]}

相关内容