3

I took a basic QSL card template from here and now I would like to try to put a postage box and address lines on the right as seen here.

There are two issues with my approach that I think are related. First, the postage box is aligned with its baseline on the text's baseline, causing the left minipage to move down:

enter image description here

The callsign, AB5CDE, should be at the top of the page, with its top on the same line as the top of the postage box. Without the postage box, the callsign is aligned properly.

Second, for some reason an empty page is inserted at the start of the document.

How can I set the vertical alignment of the \framebox such that it aligns it top at the top of the text in the left minipage?

\documentclass[10pt]{article}
\pagestyle{empty}
\usepackage{amsmath}
\usepackage{latexsym}
\usepackage[papersize={14cm,9cm}, margin=0.5cm, marginratio=1:1]{geometry}
\setlength{\parindent}{0pt}

\begin{document}

\begin{minipage}[t][\textheight][t]{9cm}
    {\Huge\texttt{AB5CDE}}
    \medskip

    John Doe\\
    Main Street 123\\
    NL-1234AB City\\
    \bigskip

    I am pleased to confirm the following QSO(s):
    \bigskip

    \begin{tabular}{l l l l l l}
        \textsc{date} & \textsc{time} & \textsc{mhz} & \textsc{mode} & \textsc{rst s} & \textsc{rst r} \\
        \hline
    \end{tabular}
\end{minipage}%
%
\begin{minipage}[t][\textheight][t]{4cm}
    \hfill\framebox(40,50){\scriptsize Postage}
\end{minipage}

\end{document}

2 Answers 2

1

It's easier to make things fit without forcing the minipage to be full height.

enter image description here

\documentclass[10pt]{article}
\pagestyle{empty}
\usepackage{amsmath}
\usepackage{latexsym}
\usepackage[papersize={14cm,9cm}, margin=0.5cm, marginratio=1:1]{geometry}
\setlength{\parindent}{0pt}

\begin{document}

\begin{minipage}[t]{9cm}
    \null
    {\Huge\texttt{AB5CDE}}
    \medskip

    John Doe\\
    Main Street 123\\
    NL-1234AB City\\
    \bigskip

    I am pleased to confirm the following QSO(s):
    \bigskip

    \begin{tabular}{l l l l l l}
        \textsc{date} & \textsc{time} & \textsc{mhz} & \textsc{mode} & \textsc{rst s} & \textsc{rst r} \\
        \hline
    \end{tabular}
\end{minipage}%
%
\begin{minipage}[t]{4cm}
    \null
    \hfill\framebox(40,50){\scriptsize Postage}%
\end{minipage}

\end{document}

If you need the height forced for other reasons, make it slightly less than \textheight (by the amount tex says the page is overfull) to allow for the baselineskip and topskip space that is added in addition to the boxes (or set those spaces to zero)

2
  • It is tough to see on your image, but the top and side margins don't seem to match. Commented Jan 4, 2017 at 15:02
  • 1
    I know but I decided that I can't lick a postage stamp to millimetre accuracy so I left the spacing as given by the OP:-) Commented Jan 4, 2017 at 15:03
2

The problem is that the \Huge text sits on the baseline and rises 15pt above it, while the \framebox also sits on the baseline and rises 50pt above it. So, in this case, using the [t] feature of the minipage will not align those discrepancies.

So, I used a \belowbaseline[-15pt]{} to limit the top placement of the \framebox to 15pt above the baseline, which corresponded to the height of the \Huge text. Note that \belowbaseline is from the stackengine package.

This also fixes the extra leading blank page issue, because the minipage no longer exceeds the page's vertical margin.

\documentclass[10pt]{article}
\pagestyle{empty}
\usepackage{amsmath,stackengine}
\usepackage{latexsym}
\usepackage[papersize={14cm,9cm}, margin=0.5cm, marginratio=1:1]{geometry}
\setlength{\parindent}{0pt}\fboxsep=-\fboxrule
\begin{document}

\begin{minipage}[t][\textheight][t]{9cm}
    {\Huge\texttt{AB5CDE}}
    \medskip

    John Doe\\
    Main Street 123\\
    NL-1234AB City\\
    \bigskip

    I am pleased to confirm the following QSO(s):
    \bigskip

    \begin{tabular}{l l l l l l}
        \textsc{date} & \textsc{time} & \textsc{mhz} & \textsc{mode} & \textsc{rst s} & \textsc{rst r} \\
        \hline
    \end{tabular}
\end{minipage}%
%
\begin{minipage}[t][\textheight][t]{4cm}
    \hfill\belowbaseline[-15pt]{\framebox(40,50){\scriptsize Postage}}
\end{minipage}

\end{document}

enter image description here

Here I show the two minipages inside \fboxes, to show the net alignment of the two minipage tops.

enter image description here

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .