[XeTeX] A "box" in the bottom-left corner of the first page

Jonathan Kew jonathan_kew at sil.org
Tue May 1 12:44:05 CEST 2007


> On 1 May 2007, at 9:45 am, Székely Gábor Balázs wrote:
>>
>> We often have special letters (in Italian as well as in
>> Hungarian). One of their speciality is that the recipient's address
>> _always_ must go on the first page of the letter, in the bottom-left
>> corner and with a line above it the length of which corresponds to
>> the length of the longest line of the address. Of course the address
>> can't be split and there should be some vertical space above the line
>> where the text of the letter starts (or, in this case, ends on that
>> page), and some space below the line so that it doesn't stick to the
>> address.

OK, I couldn't resist hacking at macros a bit! :)

Here is a version with a {recipient} environment that lets you enter  
the name/address more cleanly, without explicit boxes. Maybe this  
could give you a basis for something useful.

JK

% - - - - - - - - - - - - - - - - -

\documentclass[a4paper,12pt]{letter}

\usepackage{fontspec,xunicode,xltxtra}
\setmainfont[Mapping=tex-text]{Adobe Garamond Pro}

\usepackage{float}
\newfloat{recipientfloat}{b}{}

\newenvironment{recipient}
   {\begin{recipientfloat}
    \setbox0=\vbox\bgroup}
   {\egroup
    \vbox{\setbox2=\vbox{}
      \unvbox0 \shrinklinestofit
      \hrule \vskip5pt
      \unvbox2}
    \end{recipientfloat}}
\def\shrinklinestofit{
    \setbox0=\lastbox
    \ifhbox0
      \skip0=\lastskip \unskip
      \count0=\lastpenalty \unpenalty
      \setbox2=\vbox{\vskip\skip0\hbox{\unhbox0\unskip}\box2}
      \let\next=\shrinklinestofit
    \else \let\next=\relax \fi \next}

\signature{Jonathan}
\address{Bachotek\\Poland\\(temporarily)}

\begin{document}
\begin{letter}{}

\begin{recipient}
Gábor Székely\\
Somewhere\\
in\\
Hungary
\end{recipient}

\opening{Dear Gábor,}

Sounds like you could use a float to do this, with the \texttt{b}  
placement code
so that it is positioned at the bottom of the page.

I wouldn't be surprised if there's already a package that does  
something like this.
This is just a quick-and-dirty sample to show the basic idea.

\closing{Hope this helps,}

\cc{\XeTeX\ mailing list}
\vfill

\end{letter}
\end{document}




More information about the XeTeX mailing list