标签包仅输出一列

标签包仅输出一列

我正在尝试创建包含许多复杂元素的自定义不干胶标签:

Example Label

我的一端有一个旋转的部分,里面有大量的字体数据。

在标签的主体中,我有完整的法定名称(作为单个字段输入),这些名称必须适合空间,如果太长,则可以通过截断或大小处理来适应空间。

名称下方的其余文本和数据没有大问题。

我目前正在使用labels2x8 标签网格包,用于genericlabel打包复杂的格式,用于tcolorbox提供左右分割,另一个tcolorbox用于fitting压缩长名称并rotating获取侧面文本。

一切正常……除了它只在第一列输出标签。也就是说,除非我将其设置numberoflabels为 2 或更多。如果我将其设置为 2,它会输出我所期望的内容:

11

22

33……

如果我将其设置为 3,则会输出:

11

1

2

22

33

3 ...

对于 4、5 等等同样如此。

因此,有两个问题:

  1. tcolorboxes有没有比嵌套更好的方法来实现这一点labels
  2. 如果没有,为什么我没有获得两列 numberoflabels=1(或默认值)的贴纸?

(我当然尝试过明显的解决方案,那就是减少的高度和宽度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}

答案1

正如约翰所指出的:去掉空白。

另外:自己制作一个宏,您应该在序言中定义它。然后您可以在序言中调整宏,文档中的所有标签都会以独特的方式显示出来。

我不知道您是否能以更好的方式实现您的目标。我\small在您的代码中插入了一个,以便将长名称下方的下一个内容放入标签中。尽管如此,它似乎运行得很好,正如您在第二个标签上看到的那样,它有一个非常长的名称。

(John Kormylo 在他的评论中回答了第二个问题:删除标签之间的空白。)

这可能是您的解决方案。我定义了一个新的宏。名字\mylabel很别扭。为宏定义一个更好的名字,一个更符合字面意思的名字。我还将和命令移到了\parindent它们\setspace应该在的前言部分。

\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}

这是结果。请注意:第二行中的最后一个标签是由您的代码生成的。仔细观察标签中最后一行的位置。我想说,它太低了。也许您还必须摆弄标签的左边距,因为文本立即开始。

Resulting image

相关内容