Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm sure you're aware what \address{blah} is. Well, I'd like to make a boxed comment that's just as high as my address and stretches from the left margin of the document to 3cm to the left of the address:

enter image description here


\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}
share|improve this question
    
Please add a minimal, complete document showing how are you producing your letter. –  Gonzalo Medina Apr 14 at 17:50
    
@GonzaloMedina, see my edit. –  Mike McKittrick Clikeman Apr 14 at 18:00

1 Answer 1

up vote 6 down vote accepted

Using \address{} will give original definition of address. Using \address[]{} will give blank invoice box to the left, and using \address[comment\\comment]{} will add comment to the invoice box.

\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}

enter image description here

share|improve this answer
    
+1. I think I'll delete my answer, since the bug in invoice.sty forces a modification of the .sty file itself which should be made by the author and not but users. –  Gonzalo Medina Apr 14 at 18:37
    
@GonzaloMedina I think you describe how it should be altered to avoid the problem. I would not delete yours yet (unless all the voters agree with you :^). –  Steven B. Segletes Apr 14 at 18:40
1  
I think I'll leave it deleted. I don't like a solution involving modification (even to a copy) of a .sty file, and even if it is due to a bug. –  Gonzalo Medina Apr 14 at 18:46

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.