0

I'd like to make a tex document that would fit pre-cut sticking labels sheets.

I set the margins with the geometry package. I now want to create a table that would hold the values I have to print on labels, so I must set the exact same width and height for each cell.

The sticking labels sheet is 5 * 13 labels, with 1cm margin top, bottom, left and right.

I can't figure out how to set those cells' size. Would you please accept to help me ?

  • Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – dexteritas Aug 2 '17 at 15:34
  • 2
    Rather than reinvent the wheel, perhaps the labels package can do what you want. (Already part of TeXLive and MikTeX). – Alan Munn Aug 2 '17 at 15:38
  • BTW, I forgot to say that all labels are different from each other ... – PinkPR Aug 2 '17 at 15:41
  • 2
    The package can handle a file of names + addresses. – Bernard Aug 2 '17 at 15:47
1

I haven't used the labels package, but it might just be the ticket. If you prefer a regular table syntax, here is one way to do it. We use the tikz package to format each label, and the collcell package to apply the tikz macro automatically to each table cell.

\documentclass{article}

\usepackage{tikz,collcell,array,calc}
\usepackage[margin=1cm]{geometry}

% some padding for the text inside each label
\newlength{\nodepadding}
\setlength{\nodepadding}{8pt}

% the tikz wrapper command that formats each label
% contains some stuff that you may not want - just 
% for illustrating that it is easy enough in case you do
\newcommand{\mycell}[1]{%
  \tikz{%
    \node[
      fill=yellow,
      draw,                                      % draw border
      align=left,                                % left-align text
      outer sep=0pt,                             % no padding on the outside 
      inner sep=\nodepadding,                    % apply inner padding
      minimum height=\textheight/13,             % scale height to page
      text width=\textwidth/5-2\nodepadding,     % scale width to page
      rounded corners=2pt] {#1}}}                % round corners with given radius

% declare a column type that applies the tikz wrapper macro to each cell
\newcolumntype{L}{>{\collectcell\mycell}p{\textwidth/5}<{\endcollectcell}}

% clobber any spurious white space that might get in the way
\setlength{\tabcolsep}{0pt}
\renewcommand{\arraystretch}{0}
\setlength{\parindent}{0pt}
\setlength{\parskip}{0pt}

\pagestyle{empty}  % no page number

\begin{document}

\begin{tabular}{@{}LLLLL@{}}
Some & stuff    & or    & other & tripe \\
yet  & another  & label & to    & print \\
some long text that hopefully wraps & some text\newline with\newline manual line breaks & b & c & d \\
\end{tabular}

\end{document}

This gives

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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