# labels package — don't center

I've just started using the labels package to manage labels, business cards, and pretty much anything I plan to print "X-up".

The documentation is pretty clear --

The task of this package is to produce a rectangular grid of items on a sheet of paper, with each item centered in its grid area.

[...]

Then, within each label, the label text is vertically centered in a box

Is there a way to override this, so that my labels are top-aligned?

It looks like the appropriate code is here:

 \boxing@type{%
\vbox to \label@height{%
\vskip\TopLabelBorder
\vss
\hbox to \label@width{%
\hskip\LeftLabelBorder
\usebox{\this@label}%
\hss
}%
\vss
\vskip\BottomLabelBorder
}%
}%


Perhaps there is something I can include (that would go into the \this@label spot) that would somehow (I don't know the proper use of terms like "glue" and "stretch") overrule the existing \vss and force my label to be aligned to the top?

• One could place each label into a \parbox[c][<height>[t]{<width}{...}, but that sort of defeats the whole purpose of the labels environment. But not the \addresslabel \boxedaddresslabel approach. – John Kormylo Nov 6 '18 at 17:04

You need to call labels with the newdimens options and then patching \BuildB@x to remove the top \vss works.

\documentclass{article}
\usepackage[newdimens]{labels}
\usepackage{xpatch}

\makeatletter
\xpatchcmd{\BuildB@x}{\vss}{}{}{}
\makeatother

\begin{document}
\begin{labels}
Me
My City, State, Zipcode

My Brother
His City, State, Zipcode

You

Me
My City, State, Zipcode

My Brother
His City, State, Zipcode

You
\end{labels}

\end{document}


Adjust also \TopLabelBorder to suit your needs.

A different hack is to set \TopLabelBorder to cancel \vss itself:

\documentclass{article}
\usepackage[newdimens]{labels}
\usepackage{xpatch}

\let\TopLabelBorder\relax % :-(, \TopLabelBorder is a dimen
\newlength\TopLabelBorder % let's make it into a skip
\setlength{\TopLabelBorder}{0pt plus -1fil minus -1fil} % cancel the \vss

\begin{document}

• The second (short) one worked perfectly. Thank you! – hymie Nov 7 '18 at 14:51

This solution is a lot uglier, but does better with two and four line labels.

\documentclass{article}
\usepackage{labels}

\makeatletter
\renewcommand*{\BuildB@x}{%
\boxing@type{\parbox[c][\label@height][t]{\label@width}{%
\rule{\LeftBorder}{0pt}%
\usebox{\this@label}%
\rule{\RightBorder}{0pt}%
}%
}%
\else
\begingroup
\fboxsep=-\fboxrule
\boxing@type{\parbox[c][\label@height][t]{\label@width}{%
\vskip\TopLabelBorder
\centering% optional
\usebox{\this@label}
\vskip\BottomLabelBorder
}}%
\endgroup
\fi
\ifnum\skip@labels<\sk@pped\message{x}\else\message{+}\fi
\ifnum\label@number=\LabelCols
\message{|}%
\endgraf\nointerlineskip
\global\label@number=1
\fi
}%
\makeatother

\begin{document}
\begin{labels}
first line
second line

first line
second line
third line

first line
second line
third line
fourth line

first line
second line

first line
second line
third line

first line
second line
third line
fourth line
\end{labels}

\end{document}