如何在 \address cluster 旁边制作动态注释框?

如何在 \address cluster 旁边制作动态注释框?

我确信您知道 \address{blah} 是什么。好吧,我想创建一个方框注释,它的高度与我的地址一样高,并从文档左边距延伸到地址左侧 3 厘米:

在此处输入图片描述


\documentclass[standard]{letter}
\usepackage{invoice}
\address{\emph{Invoice from:} \\ My Address \\ My Address \\ My Address}
\signature{Piglet Master}
\date{23. May 2009}
\begin{document}
  \begin{letter}{\emph{Invoice to:} \\ My Address \\ My Address \\ My Address}
    \opening{Invoice no. 1}
    My greeting \footnote{I am a man.}
    \begin{invoice}{Euro}{0}
      \ProjectTitle{Example Project}%
      \Fee{Development} {1000.00} {1}
    \end{invoice}
    \closing{Invoice Release Authorization}
  \end{letter}
\end{document}

答案1

使用\address{}将给出地址的原始定义。使用\address[]{}将在左侧给出空白发票框,使用\address[comment\\comment]{}将在发票框中添加注释。

\documentclass[standard]{letter}
\usepackage[usestackEOL]{stackengine}
\edef\tmpbs{\the\baselineskip}
\setstackgap{L}{\tmpbs}
\newlength\tmpwd
\newlength\tmpht
\usepackage{invoice}
\fboxrule=1pt

\let\svaddress\address
\renewcommand\address[2][]{% OPTIONAL ARGUMENT AS [~] FOR EMPTY INVOICE BOX
  \ifx\relax#1\relax\svaddress{#2}\else
  \def\theaddress{#2}\invoicenote{#1}\fi}

\def\invoicenote#1{%
  \def\stackalignment{l}
  \setbox0=\hbox{\expandafter\Longstack\expandafter{\theaddress}}
  \tmpwd=\wd0\relax
  \tmpht=\ht0\relax
  \def\y{\fboxsep=0pt\fbox{\rule{0pt}{\tmpht}%
    \stackon[\tmpht-\tmpbs]{\rule{\dimexpr\textwidth-\tmpwd-3cm\relax}{0pt}}%
    {~\textsf{\strut INVOICE}~~\smash{\Longunderstack{#1}}}}}
  \svaddress{\llap{\y\hspace{3cm}}\expandafter\Longstack\expandafter{\theaddress}}
}

%  ANY OF THESE FORMS WILL WORK:
%\address{\emph{Invoice from:} \\ My Address \\ My Address \\ My Address}
%\address[~]{\emph{Invoice from:} \\ My Address \\ My Address \\ My Address}
\address[Hi, Joe\\ Here is your order]{\emph{Invoice from:} \\ My Address \\ My Address \\ My Address}

\signature{Piglet Master}
\date{23. May 2009}
\begin{document}
  \begin{letter}{\emph{Invoice to:} \\ My Address \\ My Address \\ My Address}
    \opening{Invoice no. 1}
    My greeting \footnote{I am a man.}
    \begin{invoice}{Euro}{0}
      \ProjectTitle{Example Project}%
      \Fee{Development} {1000.00} {1}
    \end{invoice}
    \closing{Invoice Release Authorization}
  \end{letter}
\end{document}

在此处输入图片描述

相关内容