1

I am trying to create custom sticky labels with a number of complex elements:

Example Label

I have a rotated section at one end, with large font data in it.

In the main body of the label I have full legal names (coming in as a single field) which must be fitted to the space, either by truncation or size manipulation if they are too long.

The rest of the text and data below the name isn't a major problem.

I'm currently using the labels package for the 2x8 label grid, using genericlabel to package the complex formatting, with tcolorbox to provide the left-right split, another tcolorbox with fitting to compress the long names and rotating to get the sideways text.

It all works... except that it only outputs labels in the first column. That is, unless I set numberoflabels to 2 or more. If I set it to 2 it outputs exactly what I would expect:

11

22

33...

If I set it to 3 it outputs:

11

1

2

22

33

3 ...

And similarly for 4, 5 and so on.

So, two questions:

  1. Is there a better way to achieve this than nested tcolorboxes on labels?
  2. If not, why am I not getting two columns of stickers with numberoflabels=1 (or default)?

(I have of course tried the obvious solution of reducing the height and width of the tcolorboxes.)

\documentclass[a4paper]{article}
\usepackage[newdimens]{labels}        % Provides label layout controls
\usepackage{tcolorbox}    % Provides constrained boxes
\usepackage{rotating}                 % Provides rotating text
\usepackage{anyfontsize}              % Provides font sizes other than 10,11,12
\LabelGridtrue
\numberoflabels=1

% Set Label Parameters
\LabelCols=2
\LabelRows=8
\LeftPageMargin=4mm
\RightPageMargin=4mm
\TopPageMargin=10mm
\BottomPageMargin=6mm
\InterLabelColumn=2mm
\InterLabelRow=0mm
\LeftLabelBorder=0mm
\RightLabelBorder=0mm
\TopLabelBorder=0mm
\BottomLabelBorder=0mm

% Set tcolorbox properties
\tcbuselibrary{fitting}     % Adjust font size to fit tcolorboxes

% Set Font
\usepackage{helvet}
\renewcommand{\familydefault}{\sfdefault}

\begin{document}
% "Normal" Style
\setlength\parindent{0pt}   % No paragraph indents
\linespread{1.25}\fontsize{11}{11.5}\selectfont

\genericlabel{
  \begin{tcolorbox}[colback=white,colframe=black,sidebyside, righthand width=20mm,size=minimal,width=97mm,height=30mm]
    \begin{tcolorbox}[colback=white,fit basedim=11pt, size=minimal,width=67mm,fit to height=25pt]
        Name: \textbf{ SURNAME, First And Middle Names Which Could Be Really Long And Not Fit }
    \end{tcolorbox}
    Some-Data: \textbf{ Nothing Difficult } \newline
    More Data: Also Not Difficult \newline
    \emph{Some italicised constant text} \newline
    Yet More Data: \textbf{ Also no problem }
  \tcblower
    \begin{turn}{270}
      \begin{tabular}{ c }
        \fontsize{18}{20}\selectfont
          88 88 88 \\
        \fontsize{32}{34}\selectfont
          X-LG
      \end{tabular}
    \end{turn}
  \end{tcolorbox}
} %End GenericLabel

\genericlabel{
  \begin{tcolorbox}[colback=white,colframe=black,sidebyside, righthand width=20mm,size=minimal,width=97mm,height=30mm]
    \begin{tcolorbox}[colback=white,fit basedim=11pt, size=minimal,width=67mm,fit to height=25pt]
        Name: \textbf{ SURNAME, First And Middle Names Which Could Be Really Long And Not Fit }
    \end{tcolorbox}
    Some-Data: \textbf{ Nothing Difficult } \newline
    More Data: Also Not Difficult \newline
    \emph{Some italicised constant text} \newline
    Yet More Data: \textbf{ Also no problem }
  \tcblower
    \begin{turn}{270}
      \begin{tabular}{ c }
        \fontsize{18}{20}\selectfont
          88 88 88 \\
        \fontsize{32}{34}\selectfont
          X-LG
      \end{tabular}
    \end{turn}
  \end{tcolorbox}
} %End GenericLabel

\end{document}
3
  • If you want them side by side, lose the blank line between them (equivalent to \par), Jan 12 '17 at 4:15
  • As an alternative to genericlabel you could also fix page dimensions with geometry and distribute labels with tcbraster (from tcolorbox).
    – Ignasi
    Jan 12 '17 at 10:24
  • Thank you all! Removing the whitespace does indeed do the trick. Thanks to Jan too for the improved structure, I will use that too.
    – rmnz
    Jan 12 '17 at 19:38
1

As pointed out by John: get rid of the white spaces.

Also: make yourself a macro, which you should define in the preamble. Than you can tweak the macro in the preamble and all the labels in the document come out in a unique fashion.

I have no idea, if you can achieve your goal in a better way. I inserted a \small into your code, to fit the next below the long name into the label. Despite that, it seems to work very well, as you can see on my second label, with an really long, long name.

(The second question was answered by John Kormylo in his comment: get rid of the white spaces between your labels.)

This could be a solution for you. I defined a new macro. The name \mylabel is awkward. Define yourself a better name for the macro, one, that is more literally. I also moved the \parindent and \setspace-commands into the preamble, where they belong.

\documentclass[a4paper]{article}
\usepackage[newdimens]{labels}        % Provides label layout controls
\usepackage{tcolorbox}    % Provides constrained boxes
\usepackage{rotating}                 % Provides rotating text
\usepackage{anyfontsize}              % Provides font sizes other than 10,11,12
\LabelGridtrue
\numberoflabels=1

% Set Label Parameters
\LabelCols=2
\LabelRows=8
\LeftPageMargin=4mm
\RightPageMargin=4mm
\TopPageMargin=10mm
\BottomPageMargin=6mm
\InterLabelColumn=2mm
\InterLabelRow=0mm
\LeftLabelBorder=0mm
\RightLabelBorder=0mm
\TopLabelBorder=0mm
\BottomLabelBorder=0mm

% Set tcolorbox properties
\tcbuselibrary{fitting}     % Adjust font size to fit tcolorboxes

% Set Font
\usepackage{helvet}
\renewcommand{\familydefault}{\sfdefault}

%% New: set this as part of the preamble!
% "Normal" Style
\setlength\parindent{0pt}   % No paragraph indents
\linespread{1.25}\fontsize{11}{11.5}\selectfont

%% New: define a macro, to typeset the label in a unique way!  You
%% should use a better name as "\mylabel", something more literally.
%% Arguments:
%%    #1: Name and Surname
%%    #2: Some Data
%%    #3: More Data
%%    #4: Yet more data
%%    #5: Label-Number
%%    #6: Label-ID
\newcommand{\mylabel}[6]{%
  \genericlabel{%
    %% Begin the outer tcolorbox
    \begin{tcolorbox}%
      [colback=white,%
      colframe=black,%
      sidebyside,%
      righthand width=20mm,%
      size=minimal,%
      width=97mm,%
      height=30mm]%
      %% insert the inner tcolorbox
      \begin{tcolorbox}%
        [colback=white,%
        fit basedim=11pt,%
        size=minimal,%
        width=67mm,%
        fit to height=25pt]%
        %% typeset the name (as #1) in bold
        Name: \textbf{#1}%
      \end{tcolorbox}           % of inner tcolorbox
      %% New: add \small, to fit the text in the box
      \small%
      Some-Data: \textbf{#2} \newline%
      More Data: #3\newline%
      \emph{Some italicised constant text} \newline%
      Yet More Data: \textbf{#4}%
      \tcblower%
      \begin{turn}{270}%
        \begin{tabular}{ c }%
          \fontsize{18}{20}\selectfont%
          %% print the Label-Number
          #5\\%
          \fontsize{32}{34}\selectfont%
          %% and finally the Label-ID
          #6%
        \end{tabular}%
      \end{turn}%
    \end{tcolorbox}%
  }%
}%

\begin{document}

\mylabel
  {Hadschi Halef Omar Ben Hadschi Abul Abbas Ibn Hadschi Dawuhd al Gossarah}
  {Nothing Difficult}
  {Also not Difficult}
  {Also no problem}
  {88 88 86}
  {X-LE}
\mylabel
  {Elizabeth the Second, by the Grace of God, of the United Kingdom of
    Great Britain and Northern Ireland and of Her other realms and
    territories Queen, Head of the Commonwealth, Defender of the
    Faith}
  {Nothing Difficult}
  {Also not Difficult}
  {Also no problem}
  {88 88 87}
  {X-LF}
\genericlabel{
  \begin{tcolorbox}[colback=white,colframe=black,sidebyside, righthand width=20mm,size=minimal,width=97mm,height=30mm]
    \begin{tcolorbox}[colback=white,fit basedim=11pt, size=minimal,width=67mm,fit to height=25pt]
        Name: \textbf{ SURNAME, First And Middle Names Which Could Be Really Long And Not Fit }
    \end{tcolorbox}
    Some-Data: \textbf{ Nothing Difficult } \newline
    More Data: Also Not Difficult \newline
    \emph{Some italicised constant text} \newline
    Yet More Data: \textbf{ Also no problem }
  \tcblower
    \begin{turn}{270}
      \begin{tabular}{ c }
        \fontsize{18}{20}\selectfont
          88 88 88 \\
        \fontsize{32}{34}\selectfont
          X-LG
      \end{tabular}
    \end{turn}
  \end{tcolorbox}
} %End GenericLabel

\end{document}

This is the result. Please notice: the last label in the second row was generated by your code. Watch carefully the location of the last line in the label. It is to low, I'd say. Maybe you also have to fiddle on the left margin of the label, as the text starts immediately.

Resulting image

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.