标签(包装):如何使地址文字适合标签包中的标签大小?

标签(包装):如何使地址文字适合标签包中的标签大小?

以下代码生成地址标签

我想要实现的是使文本适合框的大小由...制作标签包,这样就解决了地址很大,溢出盒子的问题。

任何指向此的指针:

\documentclass[12,a4paper]{article}
\usepackage[no-math]{fontspec}
\setmainfont{DejaVuSans-Bold.ttf}
\usepackage{labels}
\LabelCols=3
\LabelRows=7
\LeftBorder=8mm
\RightBorder=4mm
\TopBorder=14mm
\BottomBorder=11mm
\LabelGridtrue
\LabelInfotrue
\begin{document}
\begin{labels}
\input{Address.dat}
\end{labels}
\end{document}

内容Address.dat

E3
XX XXsfdsf 
23,fds sdkfjhdsfkj
fkdfjdskfjh s kjdsf
sdfds sfsdf 4564856

E4 %Bigger adress
sdfsdf dfsdfsd, sdfdsf, sdfsdfs sdfsdfsd dfsd
sdfsfdsfsd sdflkjsdf, sdfsdjldasdsdskdflsd  fasdfdsf
asdsd dfgrettwe 5223502 sdfsdfsdf asdGGHkdsjfhkkjSJGHjg 
sdfdsfsd fdsfsdsdfweweqw weeqweqw


E5
rtretertert rtwer
plpokpqlkdlkpo 
lklkllsdkfjwlek 6787686986

E6
rtretertert rtwer
plpokpqlkdlkpo 
lklkllsdkfjwlek 6787686986

输出

输出

答案1

这是一个手动方法。我还删除了与问题无关的代码。

\documentclass{article}

% Provides \scalebox
\usepackage{graphicx}

% Provided by the OP
\usepackage{labels}
\LabelCols=3
\LabelRows=7
\LeftBorder=8mm
\RightBorder=4mm
\TopBorder=14mm
\BottomBorder=11mm
\LabelGridtrue
\LabelInfotrue

\newcommand{\mySampleText}{Text Text Text Text Text Text Text Text Text Text Text Text }

\begin{document}
% ----- Start of Labels -----
\begin{labels}

% Label 1
    \textbf{Label 1}
    \mySampleText
    \mySampleText
    \mySampleText


% Label 2
    \textbf{Label 2}
    \mySampleText
    \mySampleText
    \mySampleText
    \mySampleText
    \mySampleText

% Label 3 (same as Label 2)
    \scalebox{0.7}{ % --> Scaled to 70 %
    % minipage is needed since scalebox acts like \mbox (--> no line breaks)
    % Found here (German): https://de.wikibooks.org/wiki/LaTeX-W%C3%B6rterbuch:_scalebox
    \begin{minipage}{\the\textwidth}
        \textbf{Label 3}
        \mySampleText
        \mySampleText
        \mySampleText
        \mySampleText
        \mySampleText
    \end{minipage}
    }

\end{labels}
% ----- End of Labels -----
\end{document}

在此处输入图片描述

相关内容