![带有图像和不同字体大小的标签](https://linux22.com/image/384017/%E5%B8%A6%E6%9C%89%E5%9B%BE%E5%83%8F%E5%92%8C%E4%B8%8D%E5%90%8C%E5%AD%97%E4%BD%93%E5%A4%A7%E5%B0%8F%E7%9A%84%E6%A0%87%E7%AD%BE.png)
我想创建产品标签。为了对齐,我使用 tabluar。但是,只要我在表格中放置图像或更改字体大小,一切都会变得一团糟。图像会移出表格,右侧的内部表格上方会有一些填充。右侧上方的文本有额外的行距。
\documentclass[a4paper]{article}
\usepackage[margin=0pt]{geometry}
\pagestyle{plain}
\usepackage[newdimens]{labels}
\usepackage{anyfontsize}
\LabelGridtrue
\usepackage{ngerman}
\usepackage{graphicx}
% Set Label Parameters
\numberoflabels=27
\LabelCols=3
\LabelRows=9
\LeftPageMargin=8mm
\RightPageMargin=6.5mm
\TopPageMargin=13.5mm
\BottomPageMargin=17mm
\InterLabelColumn=2.5mm
\InterLabelRow=0mm
\LeftLabelBorder=0mm
\RightLabelBorder=0mm
\TopLabelBorder=0mm
\BottomLabelBorder=0mm
% Set Fonts
\usepackage{fontspec}
\setmainfont[Path={/home/user/font/},
Extension={.otf},
BoldFont=fontbold.otf,
ItalicFont=fontitalic.otf,
BoldItalicFont=fontbolditalic.otf]{FrutigerLTStd-Light.otf}
%% Filter Label
%% Arguments:
%% #1:
%% #2:
%% #3:
%% #4:
\newcommand{\filterlabel}[4]{
\setlength{\tabcolsep}{0mm} %horizontal padding
\genericlabel{
% Breit: 63 mm
% Höhe: 29 mm
\begin{tabular}{|p{3.8cm}|p{2.3cm}|}
\hline
\includegraphics[width=3.3cm]{image.eps} &
\textbf{#1} \newline
{\fontsize{7}{8}\selectfont
\textbf{Max. #2}\newline
\textbf{Max. #3}}\\
\hline
{\fontsize{30}{30}\selectfont \textbf{#4}} &
\begin{tabular}{|p{6mm}|p{6mm}|p{6mm}|}
P & S & X \\
Y & Z & ZP \\
\end{tabular} \\
\hline
\multicolumn{2}{|l|}{\parbox{6.1cm}{\fontsize{6}{7}\selectfont sfjhsdjkfhsdfjshdfk\newline hgfsfhgsdhjf}}\\
\hline
\end{tabular}
}
}
\begin{document}
\filterlabel{1.100 l/min}{16 bar}{60 °C}{Model}
\end{document}
答案1
我找到了一个解决方案,这样图像就不会弄乱表格。但我仍然遇到“模型”与表格边框之间的间距太大的问题。
\documentclass[a4paper]{article}
\usepackage[margin=0pt]{geometry}
\pagestyle{plain}
\usepackage[newdimens]{labels}
\usepackage{tcolorbox}
\usepackage{anyfontsize}
\LabelGridtrue
\usepackage{ngerman}
\usepackage{graphicx}
% Set Label Parameters
\numberoflabels=27
\LabelCols=3
\LabelRows=9
\LeftPageMargin=8mm
\RightPageMargin=6.5mm
\TopPageMargin=13.5mm
\BottomPageMargin=17mm
\InterLabelColumn=2.5mm
\InterLabelRow=0mm
\LeftLabelBorder=0mm
\RightLabelBorder=0mm
\TopLabelBorder=0mm
\BottomLabelBorder=0mm
%% Filter Label
%% Arguments:
%% #1: Durchfluss
%% #2: Druck
%% #3: Temperatur
%% #4: Modell
%% #5: Webseite
%% #6: Adresse
\newcommand{\filterlabel}[6]{
\setlength{\tabcolsep}{0mm} %horizontal padding
\genericlabel{
% Breit: 63 mm
% Höhe: 29 mm
\begin{tabular}{|p{3.8cm}|p{2.3cm}|}
\hline
\raisebox{\dimexpr\ht\strutbox-\totalheight\relax}{\includegraphics[width=3.3cm]{logo.eps}} &
\textbf{#1} \newline
{\fontsize{7}{8}\selectfont\textbf{Max. #2}\newline \textbf{Max. #3}}\\
\hline
\parbox[c]{.5\textwidth}{\fontsize{24}{28}\selectfont \textbf{#4}} &
\begin{tabular}{|p{2.8mm}p{4.5mm}|p{2.8mm}p{4.5mm}|p{3.5mm}p{4.5mm}|}
P & & S & & X &\\
\hline
Y & & Z & & ZP & \\
\end{tabular} \\
\hline
\multicolumn{2}{|l|}{\parbox{6.1cm}{\fontsize{6}{7}\selectfont #5 \newline #6}}\\
\hline
\end{tabular}
}
}
\begin{document}
\filterlabel{1.100 l/min}{16 bar}{60 °C}{Model}{XXXXXXXXXX}{XXXXXXXXXXXXX}
\end{document}