scrlttr2:如何正确匹配所有页面上的文本主体

scrlttr2:如何正确匹配所有页面上的文本主体

在我的信中,我希望表格能够填满空间直至页脚,或者至少与所有后续页面的长度相同。当我添加表格时,\setlength{\footskip}{0mm}第一页会这样,但所有后续页面不会这样。另外,我希望表格稍微宽一点。我可以通过向 scrlttr2 的选项添加 DIV=14 来实现,但这样文本主体就会与第二页及后续页面的页眉和页脚相冲突。那么我应该如何将文本主体设置得更宽以适合我的表格呢?

编辑:似乎我的问题类似于这个。我刚刚在 scrlttr2 选项中添加了一行\setlength{\footskip}{0mm}'\setlength{\textheight}{22cm' enlargefirstpage=true。它可以解决页脚前底部页面上的空白区域。

这是我的文件:

\documentclass[
  fontsize=11pt, 
  parskip=half, 
  firsthead=off
]{scrlttr2}


%just for measure 
\usepackage{xcolor}
\usepackage[grid, gridunit=mm, gridcolor=blue!40, subgridcolor=blue!20]{eso-pic} 

\usepackage[T1]{fontenc} 
\usepackage[ngerman]{babel} 
\usepackage{lmodern}
\usepackage{graphicx}
\usepackage{xltabular}

\usepackage{blindtext}% only for dummy text

\renewcommand*\familydefault{\sfdefault}
\renewcommand*{\raggedsignature}{\raggedright}

\newcommand{\mVorname}{stupid company GmbH} 
\newcommand{\mNachname}{\& Co. KG} 
\newcommand{\mStrasse}{Somestreet. 1} 
\newcommand{\mStadt}{Somecity} 
\newcommand{\mPLZ}{22223} 
\setkomavar{date}{} 

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

\setkomavar{frombank}{SomeBank\\IBAN:DE00 0000 0000 0000 0000 00\\BIC: AAAAAAAAAAA}
\newcaptionname{ngerman}{\banknames}{Bankverbindungen}% caption name for more than one bank
\newkomavar[\banknames]{frombanks}% caption for more than one bank
\newkomavar[\usekomavar*{frombank}]{secondfrombank}
\setkomavar{secondfrombank}{Someotherbank\\IBAN:DE00 0000 0000 0000 0000 00\\BIC: BBBBBBBBBBB}
\newkomavar[\usekomavar*{frombank}]{thirdfrombank}
\setkomavar{thirdfrombank}{Somethirdbank\\IBAN:DE00 0000 0000 0000 0000 00\\BIC: CCCCCCCCCCC}

\setkomavar{location}{\raggedright 
  Versandanschrift:\\
  \vfill
  Some Guy\\
  23423 Blablubbing\\
  Blabistan\\
  Telefon
} 

\setplength{locvpos}{4.8cm}
\setplength{locwidth}{7.5cm}
\setplength{firstfootvpos}{250mm}

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

\renewcommand*\pagemark{%
  \usekomafont{pagenumber}{\pagename~\thepage~von~\letterlastpage}%
}

\setkomavar{firstfoot}{%
  \usekomafont{pageheadfoot}{% <- changed: { added
    \parbox{\useplength{firstfootwidth}}{%
      \rule{\linewidth}{.4pt}\\
      \parbox[t]{0.31\linewidth}{%
        \begin{tabular}[t]{l}
          \multicolumn{1}{@{}l@{}}{\textbf{Geschäftsinformation:}}\\ 
          persönlich haftende Gesellschafterin:\\ 
          stupid company Verwaltungs-GmbH\\
          Amtsgericht Somecity, HBR 111111 \\
          Handelsregister: Somecity HRA222222 \\
          \begin{tabular}{@{}l@{\;}l@{}}USt-IdNr.:& DE 000000000 \\
          WEEE-Nr.: & DE 00000000 \end{tabular}\\
          Geschäftsführer: Some Guy \\
          Sitz Somecity 
        \end{tabular}
      }%
      \hfill
      \parbox[t]{0.31\linewidth}{%
        \begin{tabular}[t]{l@{}}
          \multicolumn{1}{@{}l@{}}{\textbf{\usekomavar*{frombanks}:}} \smallskip \\% <- frombanks
          \usekomavar{frombank} \smallskip \\
          \usekomavar{thirdfrombank}
        \end{tabular}%
      }%
      \hfill
      \parbox[t]{0.31\linewidth}{%
        \begin{tabular}[t]{l@{}}
          \multicolumn{1}{@{}l@{}}{} \smallskip \\ 
          \usekomavar{secondfrombank}
        \end{tabular}%
      }%
      \par\centering\pagemark\par% <- centered pagemark added
}}}% <- changed: { added

\setkomafont{pageheadfoot}{\scriptsize}

\usepackage{scrlayer-scrpage}
\DeclareNewLayer[
  foreground,
  textarea,
  voffset=\useplength{firstfootvpos},
  hoffset=\dimexpr.5\paperwidth-.5\useplength{firstfootwidth}\relax,
  width=\useplength{firstfootwidth},
  mode=picture,
  contents=\putUL{\raisebox{\dimexpr-\height}{\usekomavar{firstfoot}}}
]{likefirstpage.foot}

\AddLayersToPageStyle{scrheadings}{likefirstpage.foot}
\clearpairofpagestyles

\DeclareNewLayer[
  background,
  page,
  addvoffset=20pt+.3333em,
  addhoffset=47pt+.3333em,
  addwidth=-47pt-.6666em,
  addheight=-20pt-.6666em,
  mode=picture,
  contents={%
    \putUR{\raisebox{\dimexpr-\height}{\makebox[0pt][r]{\includegraphics[height=18mm]{example-image}\hspace{10pt}}}}%
    \putUL{\raisebox{\dimexpr-\height}{\includegraphics[height=15mm]{example-image}}}%
    \putLR{\makebox[0pt][r]{\includegraphics[height=13mm]{example-image}}}%
  }
]{logos}
\AddLayersToPageStyle{@everystyle@}{logos}

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

  \setkomavar{subject}{BETREFF} 
  \opening{}

\newcolumntype{R}{>{\raggedleft\arraybackslash}X}%
\begin{xltabular}{\textwidth}{R X X R R R}
    
    Firstttttttt & Second & Third & Forth & Fifth & Lasttttttt \\ \hline 
    \endfirsthead

    Firstttttttt & Second & Third & Forth & Fifth & Lasttttttt \\ \hline 
    \endhead
    
    
    \hline
    \multicolumn{6}{l}{Bla}
    \endlastfoot
    
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    One & abcdef & ghjijklmn & 123.456778 & 5 & 6\\
    16  & abcdef & ghjijklmn & 123.456778 & 5 & 6 \\ *[\fill]
\end{xltabular}  
  
\end{letter} 
\end{document}

答案1

使用firstfoot=false并将带有页脚的图层添加到@everystyle@

\documentclass[
  fontsize=11pt, 
  parskip=half, 
  firsthead=off,
  firstfoot=off% <- added
]{scrlttr2}


%just for measure 
\usepackage{xcolor}
\usepackage[grid, gridunit=mm, gridcolor=blue!40, subgridcolor=blue!20]{eso-pic}

\usepackage[T1]{fontenc} 
\usepackage[ngerman]{babel} 
\usepackage{lmodern}
\usepackage{graphicx}
\usepackage{xltabular}
\newcolumntype{R}{>{\raggedleft\arraybackslash}X}%

\usepackage{blindtext}% only for dummy text

\renewcommand*\familydefault{\sfdefault}
\renewcommand*{\raggedsignature}{\raggedright}

\newcommand{\mVorname}{stupid company GmbH} 
\newcommand{\mNachname}{\& Co. KG} 
\newcommand{\mStrasse}{Somestreet. 1} 
\newcommand{\mStadt}{Somecity} 
\newcommand{\mPLZ}{22223} 
\setkomavar{date}{} 

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

\setkomavar{frombank}{SomeBank\\IBAN:DE00 0000 0000 0000 0000 00\\BIC: AAAAAAAAAAA}
\newcaptionname{ngerman}{\banknames}{Bankverbindungen}
\newkomavar[\banknames]{frombanks}
\newkomavar[\usekomavar*{frombank}]{secondfrombank}
\setkomavar{secondfrombank}{Someotherbank\\IBAN:DE00 0000 0000 0000 0000 00\\BIC: BBBBBBBBBBB}
\newkomavar[\usekomavar*{frombank}]{thirdfrombank}
\setkomavar{thirdfrombank}{Somethirdbank\\IBAN:DE00 0000 0000 0000 0000 00\\BIC: CCCCCCCCCCC}

\setkomavar{location}{\raggedright 
  Versandanschrift:\\
  \vfill
  Some Guy\\
  23423 Blablubbing\\
  Blabistan\\
  Telefon
} 

\setplength{locvpos}{4.8cm}
\setplength{locwidth}{7.5cm}
\setplength{firstfootvpos}{250mm}

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

\renewcommand*\pagemark{%
  \usekomafont{pagenumber}{\pagename~\thepage~von~\letterlastpage}%
}

\setkomavar{firstfoot}{%
  \usekomafont{pageheadfoot}{% <- changed: { added
    \parbox{\useplength{firstfootwidth}}{%
      \rule{\linewidth}{.4pt}\\
      \parbox[t]{0.31\linewidth}{%
        \begin{tabular}[t]{l}
          \multicolumn{1}{@{}l@{}}{\textbf{Geschäftsinformation:}}\\ 
          persönlich haftende Gesellschafterin:\\ 
          stupid company Verwaltungs-GmbH\\
          Amtsgericht Somecity, HBR 111111 \\
          Handelsregister: Somecity HRA222222 \\
          \begin{tabular}{@{}l@{\;}l@{}}USt-IdNr.:& DE 000000000 \\
          WEEE-Nr.: & DE 00000000 \end{tabular}\\
          Geschäftsführer: Some Guy \\
          Sitz Somecity 
        \end{tabular}
      }%
      \hfill
      \parbox[t]{0.31\linewidth}{%
        \begin{tabular}[t]{l@{}}
          \multicolumn{1}{@{}l@{}}{\textbf{\usekomavar*{frombanks}:}} \smallskip \\
          \usekomavar{frombank} \smallskip \\
          \usekomavar{thirdfrombank}
        \end{tabular}%
      }%
      \hfill
      \parbox[t]{0.31\linewidth}{%
        \begin{tabular}[t]{l@{}}
          \multicolumn{1}{@{}l@{}}{} \smallskip \\ 
          \usekomavar{secondfrombank}
        \end{tabular}%
      }%
      \par\centering\pagemark\par
}}}

\setkomafont{pageheadfoot}{\scriptsize}

\usepackage{scrlayer-scrpage}
\clearpairofpagestyles
\DeclareNewLayer[
  foreground,
  textarea,
  voffset=\useplength{firstfootvpos},
  hoffset=\dimexpr.5\paperwidth-.5\useplength{firstfootwidth}\relax,
  width=\useplength{firstfootwidth},
  mode=picture,
  contents=\putUL{\raisebox{\dimexpr-\height}{\usekomavar{firstfoot}}}
]{likefirstpage.foot}

\DeclareNewLayer[
  background,
  page,
  addvoffset=20pt+.3333em,
  addhoffset=47pt+.3333em,
  addwidth=-47pt-.6666em,
  addheight=-20pt-.6666em,
  mode=picture,
  contents={%
    \putUR{\raisebox{\dimexpr-\height}{\makebox[0pt][r]{\includegraphics[height=18mm]{example-image}\hspace{10pt}}}}%
    \putUL{\raisebox{\dimexpr-\height}{\includegraphics[height=15mm]{example-image}}}%
    \putLR{\makebox[0pt][r]{\includegraphics[height=13mm]{example-image}}}%
  }
]{logos}
\AddLayersToPageStyle{@everystyle@}{logos,likefirstpage.foot}% <- add likefirstpage.foot to @everystyle@

%\AtBeginLetter{\flushbottom}% maybe?
\begin{document} 
\begin{letter}{%
  Max Musterkunde\\
  Teststraße 2\\
  55555 Teststadt\\
  Schweiz\\
}
\setkomavar{subject}{BETREFF} 
\opening{}
\blindtext[10]% <- dummy text
\end{letter}
\end{document}

结果: 在此处输入图片描述

结果为\AtBeginLetter{\flushbottom}

在此处输入图片描述

相关内容