如何在 scrlttr2 中将文本或文本框放在反向地址上方

如何在 scrlttr2 中将文本或文本框放在反向地址上方

我想在地址栏上方放置 5 个文本框。为此,我将其设置firstheadfalse。文本大小可以与地址文本大小相同。每个框的最大长度为 25 个字符。在图片中,我用红色标记了文本以便更好地解释。如果不太难的话,如何将页码放在那个奇怪的位置。

编辑:经过一番搜索,我找到textpos并想出了以下解决方案。这些框相互重叠,我收到警告,因为我使用了表格。但我没有其他解决方案,如何在不使用它们的情况下对齐这些该死的数字。此外,我必须为最后一个框找到另一个地方,因为它不适合。

这是我目前的代码:

\documentclass[fontsize=11pt, version=last, fromalign=left, backaddress=true, foldmarks=on, fromphone=off, fromemail=on, parskip=half, firsthead=false]{scrlttr2} 
% 
\usepackage[utf8]{inputenc} 
\usepackage[T1]{fontenc} 
\usepackage[ngerman]{babel} 
\usepackage{lmodern}  
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{tikz}      
\usepackage[absolute,overlay, quiet]{textpos}         
\renewcommand*\familydefault{\sfdefault}   

\renewcommand*{\raggedsignature}{\raggedright}  % Signatur wird bündig gesetzt


\usepackage[official]{eurosym}
%
%--------------------------------------------------------------------------- 
% Absender
% 
\newcommand{\mVorname}{ tlexxier kinorelekt GmbH} 
\newcommand{\mNachname}{\& Co. KG} 
\newcommand{\mStrasse}{Somestr. 1} 
\newcommand{\mStadt}{Stadt} 
\newcommand{\mPLZ}{23332} 
\setkomavar{date}{} 

\setkomavar{fromname}{\mVorname{}~\mNachname{}}               % Name 
\setkomavar{fromaddress}{\mStrasse{}\\{}\mPLZ{}~\mStadt{}}    % Adresse

\makeatletter
\@setplength{locvpos}{5.8cm}
\@setplength{locwidth}{6cm}
\makeatother
\begin{document} 

%recipient  
\begin{letter}{%    
Max Musterkunde \\
Teststraße 2    \\
55555 Teststadt \\
Schweiz         \\ 
     }
     
\setkomavar{location}{\raggedright 
Versandanschrift:\\
Muxiline Wirrewar Institute \\
Sagblobbberavenue 8323  \\
23423 Blablubbing       \\
Blabistan
} 
% 
%\setkomavar{title}{Titel} 
\setkomavar{subject}{Rechnung} 
% 
\opening{} 
%
test test test
% 

    \begin{tikzpicture}[remember picture,overlay]
    \node[anchor=north east,yshift=-20.0pt,xshift=-10]%
        at (current page.north east)
        {\includegraphics[height=18mm, width=95mm]{example-image-b}};
    \node [anchor=north west,yshift=-20.0pt,xshift=47]%
        at (current page.north west)
        {\includegraphics[height=15mm, width=35mm]{example-image-a}};
    \end{tikzpicture}


    \begin{textblock*}{4cm}(1.7cm,2.8cm) % {block width} (coords) 
    \footnotesize 
    \begin{tabular}{l@{\hskip3pt}l}
    \multicolumn{2}{l}{firstcontact:} \\
              Tel.   & +41 (0)1111 333-444  \\
              Fax    & +41 (0)2222 666-555  \\
    \multicolumn{2}{l}{www.somewebsite.ch}      
    \end{tabular}
    \end{textblock*}

    \begin{textblock*}{4cm}(6cm,2.8cm) % {block width} (coords) 
    \footnotesize
    \begin{tabular}{l@{\hskip3pt}l}
    \multicolumn{2}{l}{secondcontact:} \\
              Tel.   & +41 (0)1111 333-444  \\
              Fax    & +41 (0)2222 666-555  \\
    \multicolumn{2}{l}{www.someotherwebsite.ch}      
    \end{tabular}
    \end{textblock*}

    \begin{textblock*}{4cm}(10.3cm,2.8cm) % {block width} (coords) 
    \footnotesize
    \begin{tabular}{l@{\hskip3pt}l}
    \multicolumn{2}{l}{thirdcontact:} \\
              Tel.   & +41 (0)1111 333-444  \\
              Fax    & +41 (0)2222 666-555  \\
    \multicolumn{2}{l}{www.someotherwebsite.ch}      
    \end{tabular}
    \end{textblock*}

    \begin{textblock*}{4cm}(14.6cm,2.8cm) % {block width} (coords) 
    \footnotesize
    \begin{tabular}{l@{\hskip3pt}l}
    \multicolumn{2}{l}{lactcontact:} \\
              Tel.   & +41 (0)1111 333-444  \\
              Fax    & +41 (0)2222 666-555  \\
    \multicolumn{2}{l}{www.someotherwebsite.ch}      
    \end{tabular}
    \end{textblock*}

\end{letter} 
\end{document}

在此处输入图片描述

答案1

您可以使用firsthead和调整firstheadvpos

\setplength{firstheadvpos}{30mm}

\setkomavar{firsthead}{%
  \usekomafont{pageheadfoot}{%
    \parbox{\useplength{firstheadwidth}}{%
      \begin{tabular}[t]{@{}l@{\hskip3pt}l}
        \multicolumn{2}{@{}l}{firstcontact:} \\
        Tel.   & +41 (0)1111 333-444  \\
        Fax    & +41 (0)2222 666-555  \\
        \multicolumn{2}{@{}l}{www.somewebsite.ch}
      \end{tabular}%
      \hfill
      \begin{tabular}[t]{l@{\hskip3pt}l}
        \multicolumn{2}{l}{secondcontact:} \\
        Tel.   & +41 (0)1111 333-444  \\
        Fax    & +41 (0)2222 666-555  \\
        \multicolumn{2}{l}{www.someotherwebsite.ch}
      \end{tabular}%
      \hfill
      \begin{tabular}[t]{l@{\hskip3pt}l}
        \multicolumn{2}{l}{thirdcontact:} \\
        Tel.   & +41 (0)1111 333-444  \\
        Fax    & +41 (0)2222 666-555  \\
        \multicolumn{2}{l}{www.someotherwebsite.ch}
      \end{tabular}%
      \hfill
      \begin{tabular}[t]{l@{\hskip3pt}l}
        \multicolumn{2}{l}{lastcontact:} \\
        Tel.   & +41 (0)1111 333-444  \\
        Fax    & +41 (0)2222 666-555  \\
        \multicolumn{2}{l}{www.someotherwebsite.ch}
      \end{tabular}%
      \hfill
      \begin{tabular}[t]{l@{}}
        someother \\
        stuff\\
        bla\\
        Auto
      \end{tabular}%
}}}

\setkomafont{pageheadfoot}{\scriptsize}

例子:

\documentclass[
  fontsize=11pt,
  parskip=half,
  firsthead=true% <- changed
]{scrlttr2} 

\usepackage[T1]{fontenc} 
\usepackage[ngerman]{babel} 
\usepackage{lmodern}
%\usepackage{amsmath}
%\usepackage{graphicx}
\usepackage{tikz}% loads graphicx, xcolor etc.

%\LoadLetterOption{visualize}% loads visualize.lco to visualize boxes
%\showfields{address}% show the address box

\renewcommand*\familydefault{\sfdefault}
\renewcommand*{\raggedsignature}{\raggedright}  % Signatur wird bündig gesetzt

%\usepackage[official]{eurosym}

\newcommand{\mVorname}{ tlexxier kinorelekt GmbH} 
\newcommand{\mNachname}{\& Co. KG} 
\newcommand{\mStrasse}{Somestr. 1} 
\newcommand{\mStadt}{Stadt} 
\newcommand{\mPLZ}{23332} 
\setkomavar{date}{} 

\setkomavar{fromname}{\mVorname{}~\mNachname{}}
\setkomavar{fromaddress}{\mStrasse{}\\{}\mPLZ{}~\mStadt{}}

\setplength{locvpos}{5.8cm}
\setplength{locwidth}{6cm}
\setplength{firstheadvpos}{30mm}% <- added
%\setplength{firstheadhpos}{50pt}
%\setplength{firstheadwidth}{\paperwidth}
%\addtoplength{firstheadwidth}{-65pt}

\setkomavar{firsthead}{%
  \usekomafont{pageheadfoot}{%
    \parbox{\useplength{firstheadwidth}}{%
      \begin{tabular}[t]{@{}l@{\hskip3pt}l}
        \multicolumn{2}{@{}l}{firstcontact:} \\
        Tel.   & +41 (0)1111 333-444  \\
        Fax    & +41 (0)2222 666-555  \\
        \multicolumn{2}{@{}l}{www.somewebsite.ch}
      \end{tabular}%
      \hfill
      \begin{tabular}[t]{l@{\hskip3pt}l}
        \multicolumn{2}{l}{secondcontact:} \\
        Tel.   & +41 (0)1111 333-444  \\
        Fax    & +41 (0)2222 666-555  \\
        \multicolumn{2}{l}{www.someotherwebsite.ch}
      \end{tabular}%
      \hfill
      \begin{tabular}[t]{l@{\hskip3pt}l}
        \multicolumn{2}{l}{thirdcontact:} \\
        Tel.   & +41 (0)1111 333-444  \\
        Fax    & +41 (0)2222 666-555  \\
        \multicolumn{2}{l}{www.someotherwebsite.ch}
      \end{tabular}%
      \hfill
      \begin{tabular}[t]{l@{\hskip3pt}l}
        \multicolumn{2}{l}{lastcontact:} \\
        Tel.   & +41 (0)1111 333-444  \\
        Fax    & +41 (0)2222 666-555  \\
        \multicolumn{2}{l}{www.someotherwebsite.ch}
      \end{tabular}%
      \hfill
      \begin{tabular}[t]{l@{}}
        someother \\
        stuff\\
        bla\\
        Auto
      \end{tabular}%
}}}

\setkomafont{pageheadfoot}{\scriptsize}

\begin{document} 

\begin{letter}{%    
  Max Musterkunde\\
  Teststraße 2\\
  55555 Teststadt\\
  Schweiz\\ 
}

\setkomavar{location}{\raggedright 
  Versandanschrift:\\
  Muxiline Wirrewar Institute \\
  Sagblobbberavenue 8323\\
  23423 Blablubbing\\
  Blabistan
} 

\setkomavar{subject}{Rechnung} 
\opening{} 
test test test

  \begin{tikzpicture}[remember picture,overlay]
    \node[anchor=north east,yshift=-20.0pt,xshift=-10]%
      at (current page.north east)
      {\includegraphics[height=18mm, width=95mm]{example-image-b}};
    \node [anchor=north west,yshift=-20.0pt,xshift=47]%
      at (current page.north west)
      {\includegraphics[height=15mm, width=35mm]{example-image-a}};
  \end{tikzpicture}
\end{letter}
\end{document}

在此处输入图片描述

相关内容