# What is the right way to place a box at a specific location?

I have a box \mybox that contains a letterhead. The dimensions of the box are 7" by 1" (and depth 0pt). The box is going to be used only inside my letterhead macro:

\DeclareRobustCommand\letterhead{%
\cleardoublepage % letterhead only belongs at the top of a page
% something
\copy\mybox
% something
}


Thus, the letterhead can only appear at the top of the page.

My requirements are that \mybox needs to be .75" from the left and right margin, .5" from the top margin and at least .5" from the text of the page on which the letterhead appears. Further, (since I cannot convince people to upgrade their TeX distributions) it needs to work with a fairly old version of teTeX. The teTeX requirement rules out wallpaper and textpos. The requirement that the text of the page be at least some distance would also rule those out in addition to eso-pic. Thus, my situation is different from this one.

Right now, I'm forcing the margins to be 1" via \RequirePackage[margin=1in]{geometry}, but I'd like not to have to do that. I'd prefer that any margins could be set and the letterhead stay in exactly the same place and that the minimum of .5" between the letterhead and the text of the page be maintained. (Actually, a way to set that via a package option would be handy and it'd encourage me to learn how to use xkeyval. For a default, .5" seems pretty good, and it falls out nicely from my current solution.)

Since the margin is currently forced to be 1", my solution is the following.

\newbox\mybox
\setbox\mybox\vbox to1in{
\vss
% TeX to generate the letterhead
\vskip.5in
}

\cleardoublepage
\hb@xt@\z@{%
\skip\z@\oddsidemargin
\hskip-\skip\z@
\copy\mybox
\hss
}
}


(Using \moveleft also works nicely. I'm not sure which way is better.)

I should be able to remove the \vss and \vskip.5in from \mybox and position the box appropriately. What is the correct way to do this?

-

Update: Here's an example that's actually working. Just had my calculations a bit off, earlier. This isn't exactly reproducing your example output, but this should be flexible enough that you can insert whatever you like.

\documentclass{article}
\usepackage{lipsum}
\usepackage[a4paper,margin=2in]{geometry}

\newbox\mybox

\cleardoublepage
\setbox\mybox=\vbox{%
\parindent=0pt
}
\dp\mybox=0pt\ht\mybox=0pt\wd\mybox=0pt
\moveleft\dimexpr1in+\hoffset+\oddsidemargin\relax
\box\mybox
\vskip-\baselineskip
}

\hspace*{\fill}%
\hspace*{\fill}%
}

\begin{document}
\lipsum
\end{document}

-
This is so frustrating. Try adding the class option 12pt. The box moves slightly! – TH. Sep 12 '10 at 7:22
Try this one, instead :) – Will Robertson Sep 12 '10 at 8:14
\topskip! That's what the problem was. I'll update my answer (and mark it community wiki which is what I meant to do when I first posted it; it seems silly to get rep for a question and an answer). – TH. Sep 12 '10 at 9:36

This seems to work. Credit to Will for pointing out what was missing!

\documentclass[10pt]{article}
\usepackage{lipsum}
\usepackage[margin=1in]{geometry}
\makeatletter
\newbox\mybox
\setbox\mybox\vbox{
\hrule \@height.5in \@depth.5in \@width7in
}
\wd\mybox\z@

\cleardoublepage
\begingroup
\skip\z@\topmargin
\setbox\z@\vbox to\z@{
\vss
\skip\tw@\oddsidemargin
\skip\tw@\hoffset
\moveleft\skip\tw@\copy\mybox
\vskip\skip\z@
}