我的目的是創建一封帶有多個附錄的信件,這些附錄是\include
d 並且它們的part
標題將添加到\encl
列表中。
我的信看起來像:
\documentclass{scrlttr2}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage{lmodern,textcomp,graphicx}
\usepackage{booktabs}
\usepackage{tabu}
\newcounter{part}
\setcounter{secnumdepth}{-1}
\makeatletter
\newcommand{\part}{\@startsection{part}{-1}{\z@}% name, ebene, einzug
{1ex}% vor-abst
{1ex}% nach-abst
{\normalfont\Large\bfseries}}\\% format
\renewcommand{\thepart}{Anlage \Alph{part}}
\makeatother
\begin{document}
\begin{letter}{to somebody}
\opening{Dear Sirs and Madams,}
...
\closing{Farewell,}
\include{anlage-a}
\end{letter}
\end{document}
附錄開頭如下:
\part{test part}
My part-content...
哪個被渲染為:
為什麼會發生這種情況,以及如何避免這種情況?
答案1
你需要定義\partmark
.每個分段命令都應該有一個伴隨的\<level>mark
命令,該命令是作為\@startsection
.
\documentclass{scrlttr2}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage{lmodern,textcomp,graphicx}
\usepackage{booktabs}
\usepackage{tabu}
\newcounter{part}
\setcounter{secnumdepth}{-1}
\makeatletter
\newcommand{\part}{\@startsection{part}{-1}{\z@}% name, ebene, einzug
{1ex}% vor-abst
{1ex}% nach-abst
{\normalfont\Large\bfseries}}
\renewcommand{\thepart}{Anlage \Alph{part}}
\newcommand{\partmark}[1]{}
\makeatother
\begin{document}
\begin{letter}{to somebody}
\opening{Dear Sirs and Madams,}
...
\closing{Farewell,}
\part{ABC}
Text
\end{letter}
\end{document}
我敢打賭你想要\input
但又不想\include
。