如何以毫米为单位指定条形码的尺寸?(使用pst-barcode
和labels
包装时)
scalex
,scaley
似乎有效。为什么不是绝对尺寸规格?
\documentclass[a4paper,12pt]{article}
\usepackage[newdimens]{labels}
\usepackage{pst-barcode}
\usepackage{auto-pst-pdf} % require -shell-escape
\LabelCols=4%
\LabelRows=11%
\LeftPageMargin=7mm%
\RightPageMargin=7mm%
\TopPageMargin=15mm%
\BottomPageMargin=2mm%
\InterLabelColumn=0mm%
\InterLabelRow=0mm%
% These four parameters give the extra space used around the text on
% each actual label.
\LeftLabelBorder=4mm%
\RightLabelBorder=4mm%
\TopLabelBorder=4mm%
\BottomLabelBorder=4mm%
\begin{document}
% Specification of 4mm x 4mm seems not respected
\numberoflabels=4
\boxedaddresslabel{
\begin{pspicture}(4,4mm)
\psbarcode{38}{includetext guardwhitespace}{ean2}
%\psbarcode[scalex=0.2,scaley=0.2]{38}{includetext guardwhitespace}{ean2}
\end{pspicture}
}
% Specification of 0.1in x 0.1in seems not respected
\numberoflabels=4
\boxedaddresslabel{
\begin{pspicture}(0.1,0.1in)
\psbarcode{38}{includetext guardwhitespace}{ean2}
%\psbarcode[scalex=0.2,scaley=0.2]{38}{includetext guardwhitespace}{ean2}
\end{pspicture}
}
% but scalex, scaley seems respected
\numberoflabels=36
\boxedaddresslabel{
\begin{pspicture}
\psbarcode[scalex=0.1,scaley=0.1]{38}{includetext guardwhitespace}{ean2}
\end{pspicture}
}
\end{document}
命令行
pdflatex -shell-escape input.tex
笔记:
如果mm
不可能或者代码过于复杂,就让它在in
。
答案1
\begin{pspicture}(0.1,0.1in)
没有意义。如果没有单位或前缀,\psset{unit=1in}
则始终为 cm。 也一样 \begin{pspicture}(4,4mm)
。如果不是默认单位,则必须同时指定两个单位:
\documentclass[a4paper,12pt]{article}
\usepackage[newdimens]{labels}
\usepackage{pst-barcode}
\usepackage{auto-pst-pdf} % require -shell-escape
\LabelCols=4%
\LabelRows=11%
\LeftPageMargin=7mm%
\RightPageMargin=7mm%
\TopPageMargin=15mm%
\BottomPageMargin=2mm%
\InterLabelColumn=0mm%
\InterLabelRow=0mm%
% These four parameters give the extra space used around the text on
% each actual label.
\LeftLabelBorder=4mm%
\RightLabelBorder=4mm%
\TopLabelBorder=4mm%
\BottomLabelBorder=4mm%
\begin{document}
\numberoflabels=4
\boxedaddresslabel{%
\begin{pspicture}(4mm,4mm)
\psbarcode{38}{height=0.158 includetext guardwhitespace}{ean2}
\end{pspicture}%
}
\numberoflabels=4
\boxedaddresslabel{%
\begin{pspicture}(0.1in,0.1in)
\psbarcode{38}{width=0.1 height=0.1 includetext guardwhitespace}{ean2}
\end{pspicture}%
}
\end{document}
height=
并 width=
在 PostScript 级别使用,并且总是以英寸为单位。4mm=4/25.3 in=0.158in
scalex
并scaley
在 TeX 级别使用。