LuaLaTeX scrlttr2 信体缩进文本

LuaLaTeX scrlttr2 信体缩进文本

letterbody我在手册中找到了描述的部分,但没有关于如何水平定位该部分的建议。

问题在于解决方法为了使文本“Betreff:”或“E-Mail:”显示出来,我插入了一些空格,现在这些空格与 不对齐letterbody。因此,缩进letterbody或水平对齐subject部分会有所帮助,但我找不到这两种方法。

我的信现在已经有 175 行了,所以我就不发了……这是一个 pastebin 链接

答案1

您需要 - 如果我理解正确的话 - 将主题分隔符从空白更改为无符号,例如使用以下命令:\setkomavar{subjectseparator}{}

然后主题将不会缩进。请参阅以下编译 MWE(代码更改标有<=========):

%%Brief-Vorlage, v1.03
%%kompiliert mit LuaTeX
\documentclass[%
    fontsize=12pt,          % fontsize
    paper=a4,               % page size a4
    firsthead=on,           % display header on first page
    headsepline=false,
    fromalign=right,         % placement of name in letter head | centered,
    fromrule=false,  % separate the address with a line in letter head, false or aftername, afteraddress
    fromemail=on,          % turn on email of sender
    fromurl=off,            % print URL of sender
    fromphone=false,          % turn on phone of sender
    fromlogo=on,           % turn on logo of sender    
    fromfax=false,
    backaddress=off,
    subject=afteropening,        %beforeopening <===============================
    %subject=underlined,
    subject=titled,         % untitled
    subject=left,               % centered
    locfield=wide,          % wide, narrow
    refline=wide,               % narrow
    parskip=half,           % Use indent instead of skip, half, false
    enlargefirstpage=on,    % more space on first page
    addrfield=on,           % address field for envelope with window, on or true
    subject=titled,         % placement of subject, beforeopening or titled
    foldmarks=on,          % print foldmarks
    numericaldate=off,      % display date in numbers only
    footsepline=false,  
    firstfoot=on,           % display footer on first page
    pagenumber=botleft,         % position of the page number | botcenter,        
    draft=false
 ]{scrlttr2}

\usepackage{polyglossia}
\setdefaultlanguage[variant = swiss]{german}
\setotherlanguage[variant = british]{english}
\usepackage{unicode-math}
\usepackage{url}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{fontspec}

\usepackage{showframe} % <==============================================

% Fontspec
%-------------------------------------------------------------------
\defaultfontfeatures{Ligatures=TeX}
%%\setmainfont{Gill Sans Light}
%%\setsansfont{Gill Sans Light}[Scale=MatchLowercase]
%%\setmonofont{Inconsolata}[Scale=MatchLowercase]
%%\setmathfont{XITS-Math}[]
%\setmathsf{}[]
%\setmathtt{}[]
%\setboldmathrm{}[]
\definecolor{grau}{rgb}{0.20,0.40,0.65}

% Development helpers
%-------------------------------------------------------------------
\LoadLetterOption{SNleft} %% oder: DINmtext, SN, SNleft, KOMAold.
%\LoadLetterOption{visualize}\showfields{address,foot,head,location,refline}    % loads visualize.lco to visualize boxes
\fboxrule=0pt                                           %border thickness der fboxes zum bearbeiten auf 1 setzten

% KOMA blockgrössen
%-------------------------------------------------------------------
\makeatletter
  \@setplength{firstheadhpos}{1.0cm}                            % horizontal position of the header
  \@setplength{firstheadvpos}{1.2cm}                            % vertical position of the header
  \@setplength{firstheadwidth}{17.4cm}                          % width of the header    
  \@setplength{backaddrheight}{0pt}                         % because backaddress=off
  \@setplength{toaddrhpos}{3cm}                             %distance from left
\@setplength{toaddrindent}{0.0cm}                               %distance from top
  \@setplength{toaddrhpos}{2.7cm}                               %distance from left page edge  
 %\@setplength{toaddrheight}{3.5cm}                         %height of the addressbox toaddrhpos
 \@setplength{toaddrwidth}{7cm}                             % width of the addressbox
 %\@setplength{subjectvpos}{8cm}                                % 10cm = Betreff auf höhe Datum   
 \@setplength{subjectbeforevskip}{1cm}
\@setplength{subjectaftervskip}{1cm}
\@setplength{sigbeforevskip}{0.2cm}
\makeatother

% KOMA variabeln
%-------------------------------------------------------------------
%\setkomavar{title}{sometitle}
\setkomavar{place}{{aplace}\setkomavar{date}{\today}}       % Datum auf linker Seite des Blattes
%\setkomavar{location}{1.Dezember 2155}                     % Datum in der locationbox (rechts)

\setkomavar{subject}{\textcolor{grau}{\bfseries Bewerbung als XY ÄÖÜ}}
\setkomavar{subjectseparator}{} % <=====================================
\renewcaptionname{german}{\subjectname}{}
\renewcaptionname{english}{\subjectname}{}

%Absenderaddresse
\setkomavar{fromname}{somebodys name}
\setkomavar{fromaddress}{address \\ CH-5855 Place}
\setkomavar{fromemail}{[email protected]}
%\setkomavar{emailseparator}{~}                               %zwischen E-Mail x und [email protected]
%\renewcaptionname{german}\emailname{~}
%\renewcaptionname{english}\emailname{~}
\setkomavar{fromlogo}{\includegraphics[scale=0.15]{1.png}}
%Empfängeraddresse
\setkomavar{toname}{joe publicitas}
\setkomavar{toaddress}{gehweg \\ CH-6000 Aaarau}
%Singatur
\setkomavar{signature}{\includegraphics[scale=0.10]{signature.png}}
\renewcommand*{\raggedsignature}{\raggedright}
\newcommand*{\raggedsection}{\raggedright}
\newcommand*{\raggedchapter}{\raggedright}
\newcommand*{\raggedpart}{\raggedright}


% KOMA Head with 4 sections
%-------------------------------------------------------------------
\setkomavar{firsthead}{%
\fbox{
\begin{minipage}[b][2.5cm][t]{6cm} %{minipage}[ÄUSSERE POSITION][HÖHE][INNERE POSITION(inhalt)]{BREITE} b,c,t
    \begin{flushleft}
        \usekomavar{fromlogo}
    \end{flushleft}
\end{minipage}
}
\fbox{
\begin{minipage}[b][2.5cm][t]{6cm}
    \begin{flushright}
        \begin{large}  
        \usekomavar{fromname}\\
        \end{large}    
    \end{flushright}
\end{minipage}
}
\fbox{
\begin{minipage}[b][2,55cm][t]{0.01cm}
    \centering
    \begin{tikzpicture}[step=.5cm,black,thick] %ultra thin, very thin, thin, semithick, thick, very thick, ultra thick. gray,
        \draw
        (0,2) -- ++(0,2);
    \end{tikzpicture}
    \centering
\end{minipage}
}
\fbox{
\begin{minipage}[b][2.5cm][t]{3.5cm}
    \begin{flushleft}
        \begin{large}  
        \usekomavar{fromaddress}\\
            \usekomavar{fromemail}\\
        \end{large}    
    \end{flushleft}
\end{minipage}
}
}

\begin{document}

% KOMA letter 2
%-------------------------------------------------------------------
\begin{letter}{}

\opening{Sehr gegehrte Damen und Herren}

Your tenancy is due to come to an end on \today. I would like to arrange an inspection at the property before the tenancy ends to identify anything that may lead me to retain some of your deposit if not addressed by the time I retake possession.

Carrying out this inspection prior to the tenancy ending will give you the opportunity to tackle anything raised and ensure I can return the maximum amount of deposit to you when the tenancy ends

I would like to carry out the inspection on \{\{date\}\} at \{\{time\}\}. It would be best if you were present then if anything is identified we can discuss this and be clear on what would be required to rectify it. Please can you contact me as soon as possible to confirm whether or not this is convenient.

If you do not wish to be present I have a set of keys to access the property and will send you the results of the inspection. Please let me know either way at your earliest convenience.

\closing{Freundliche Grüsse}
\vspace{0.0cm}
\usekomavar{fromname}

\end{letter}

\end{document}

结果:

在此处输入图片描述

答案2

您无需重新定义subjectseparatorand/or \subjectname,只需subject=titledsubject=untitled或删除选项替换选项即可获得默认值(请参阅手册有关选项的更多信息subject):

%%Brief-Vorlage, v1.03
%%kompiliert mit LuaTeX
\documentclass[%
    fontsize=12pt,          % fontsize
    paper=a4,               % page size a4
    firsthead=on,           % display header on first page
    headsepline=false,
    fromalign=right,         % placement of name in letter head | centered,
    fromrule=false,  % separate the address with a line in letter head, false or aftername, afteraddress
    fromemail=on,          % turn on email of sender
    fromurl=off,            % print URL of sender
    fromphone=false,          % turn on phone of sender
    fromlogo=on,           % turn on logo of sender    
    fromfax=false,
    backaddress=off,
    subject=afteropening,        %beforeopening <===============================
    %subject=underlined,
    subject=untitled,         % titled
    subject=left,               % centered
    locfield=wide,          % wide, narrow
    refline=wide,               % narrow
    parskip=half,           % Use indent instead of skip, half, false
    enlargefirstpage=on,    % more space on first page
    addrfield=on,           % address field for envelope with window, on or true
    foldmarks=on,          % print foldmarks
    numericaldate=off,      % display date in numbers only
    footsepline=false,  
    firstfoot=on,           % display footer on first page
    pagenumber=botleft,         % position of the page number | botcenter,        
    draft=false
 ]{scrlttr2}

\usepackage{polyglossia}
\setdefaultlanguage[variant = swiss]{german}
\setotherlanguage[variant = british]{english}
\usepackage{unicode-math}
\usepackage{url}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{fontspec}

% Fontspec
%-------------------------------------------------------------------
\defaultfontfeatures{Ligatures=TeX}
%%\setmainfont{Gill Sans Light}
%%\setsansfont{Gill Sans Light}[Scale=MatchLowercase]
%%\setmonofont{Inconsolata}[Scale=MatchLowercase]
%%\setmathfont{XITS-Math}[]
%\setmathsf{}[]
%\setmathtt{}[]
%\setboldmathrm{}[]
\definecolor{grau}{rgb}{0.20,0.40,0.65}

% Development helpers
%-------------------------------------------------------------------
\LoadLetterOption{SNleft} %% oder: DINmtext, SN, SNleft, KOMAold.
%\LoadLetterOption{visualize}\showfields{address,foot,head,location,refline}    % loads visualize.lco to visualize boxes
\fboxrule=0pt                                           %border thickness der fboxes zum bearbeiten auf 1 setzten

% KOMA blockgrössen
%-------------------------------------------------------------------
\makeatletter
  \@setplength{firstheadhpos}{1.0cm}                            % horizontal position of the header
  \@setplength{firstheadvpos}{1.2cm}                            % vertical position of the header
  \@setplength{firstheadwidth}{17.4cm}                          % width of the header    
  \@setplength{backaddrheight}{0pt}                         % because backaddress=off
  \@setplength{toaddrhpos}{3cm}                             %distance from left
\@setplength{toaddrindent}{0.0cm}                               %distance from top
  \@setplength{toaddrhpos}{2.7cm}                               %distance from left page edge  
 %\@setplength{toaddrheight}{3.5cm}                         %height of the addressbox toaddrhpos
 \@setplength{toaddrwidth}{7cm}                             % width of the addressbox
 %\@setplength{subjectvpos}{8cm}                                % 10cm = Betreff auf höhe Datum   
 \@setplength{subjectbeforevskip}{1cm}
\@setplength{subjectaftervskip}{1cm}
\@setplength{sigbeforevskip}{0.2cm}
\makeatother

% KOMA variabeln
%-------------------------------------------------------------------
%\setkomavar{title}{sometitle}
\setkomavar{place}{{aplace}\setkomavar{date}{\today}}       % Datum auf linker Seite des Blattes
%\setkomavar{location}{1.Dezember 2155}                     % Datum in der locationbox (rechts)
\addtokomafont{subject}{\color{grau}\bfseries}% color+font of the subject
\setkomavar{subject}{Bewerbung als XY ÄÖÜ}% subject variable

%Absenderaddresse
\setkomavar{fromname}{somebodys name}
\setkomavar{fromaddress}{address \\ CH-5855 Place}
\setkomavar{fromemail}{[email protected]}
%\setkomavar{emailseparator}{~}                               %zwischen E-Mail x und [email protected]
%\renewcaptionname{german}\emailname{~}
%\renewcaptionname{english}\emailname{~}
\setkomavar{fromlogo}{\includegraphics[scale=0.15]{example-image}}% We do not
                                % have 1.png
%Empfängeraddresse
\setkomavar{toname}{joe publicitas}
\setkomavar{toaddress}{gehweg \\ CH-6000 Aaarau}
%Singatur
\setkomavar{signature}{\includegraphics[scale=0.10]{example-image}\\% we do not
                                % have signature.png
  \usekomavar{fromname}}
\renewcommand*{\raggedsignature}{\raggedright}
\newcommand*{\raggedsection}{\raggedright}% nonsense for letters
\newcommand*{\raggedchapter}{\raggedright}% nonsense for letters
\newcommand*{\raggedpart}{\raggedright}% nonsense for letters


% KOMA Head with 4 sections
%-------------------------------------------------------------------
\setkomavar{firsthead}{%
\fbox{
\begin{minipage}[b][2.5cm][t]{6cm} %{minipage}[ÄUSSERE POSITION][HÖHE][INNERE POSITION(inhalt)]{BREITE} b,c,t
    \begin{flushleft}
        \usekomavar{fromlogo}
    \end{flushleft}
\end{minipage}
}
\fbox{
\begin{minipage}[b][2.5cm][t]{6cm}
    \begin{flushright}
        \begin{large}  
        \usekomavar{fromname}\\
        \end{large}    
    \end{flushright}
\end{minipage}
}
\fbox{
\begin{minipage}[b][2,55cm][t]{0.01cm}
    \centering
    \begin{tikzpicture}[step=.5cm,black,thick] %ultra thin, very thin, thin, semithick, thick, very thick, ultra thick. gray,
        \draw
        (0,2) -- ++(0,2);
    \end{tikzpicture}
    \centering
\end{minipage}
}
\fbox{
\begin{minipage}[b][2.5cm][t]{3.5cm}
    \begin{flushleft}
        \begin{large}  
        \usekomavar{fromaddress}\\
            \usekomavar{fromemail}\\
        \end{large}    
    \end{flushleft}
\end{minipage}
}
}

\begin{document}

% KOMA letter 2
%-------------------------------------------------------------------
\begin{letter}{}

\opening{Sehr gegehrte Damen und Herren}

Your tenancy is due to come to an end on \today. I would like to arrange an inspection at the property before the tenancy ends to identify anything that may lead me to retain some of your deposit if not addressed by the time I retake possession.

Carrying out this inspection prior to the tenancy ending will give you the opportunity to tackle anything raised and ensure I can return the maximum amount of deposit to you when the tenancy ends

I would like to carry out the inspection on \{\{date\}\} at \{\{time\}\}. It would be best if you were present then if anything is identified we can discuss this and be clear on what would be required to rectify it. Please can you contact me as soon as possible to confirm whether or not this is convenient.

If you do not wish to be present I have a set of keys to access the property and will send you the results of the inspection. Please let me know either way at your earliest convenience.

\closing{Freundliche Grüsse}

\end{letter}
\end{document}

结果是:

无标题的主题

如您所见,这只是删除了主题标题“Betreff:”和标题后的空格。

subject=titled顺便说一句:您的选项列表中有两次\documentclass。因此,如果您想将上述内容与您的真实信件一起使用,则必须删除其中一个或更改两者。

相关内容