我制作了一页标签,但我不明白为什么第一行的呈现方式与其他行不同。
第一行没有以相同的方式对齐,并且\vspace*
接下来的行没有达到预期的效果。
这是我的代码:
\documentclass{article}
\usepackage[a4paper,margin=1cm,landscape]{geometry}
\usepackage{pgfornament}
\usetikzlibrary{calc}
\newcommand\myLabel{
\begin{tikzpicture}
% Text
\node[font=\fontsize{32}{35}\selectfont,align=center,text width=11cm](myLabel) {\myTitle};
% Outside of the label
\draw[line width=1pt,line cap=rect,lightgray] ([xshift=-10pt,yshift=10pt]myLabel.north west) -| ([xshift=10pt,yshift=-10pt]myLabel.south east) -| ([xshift=-10pt,yshift=-10pt]myLabel.north west) -- cycle;
% Decoration
\draw[line width=1pt,line cap=rect,lightgray] (myLabel.north west) -| (myLabel.south east) -| (myLabel.north west) -- cycle;
% Decoration in corners
\node[anchor=north west,font=\color{gray}] at ([xshift=-10pt,yshift=10pt]myLabel.north west){\pgfornament[width=1cm]{31}};
\node[anchor=north east,font=\color{gray}] at ([xshift=10pt,yshift=10pt]myLabel.north east){\pgfornament[width=1cm,symmetry=v]{31}};
\node[anchor=south west,font=\color{gray}] at ([xshift=-10pt,yshift=-10pt]myLabel.south west){\pgfornament[width=1cm,symmetry=h]{31}};
\node[anchor=south east,font=\color{gray}] at ([xshift=10pt,yshift=-10pt]myLabel.south east){\pgfornament[width=1cm,symmetry=c]{31}};
\end{tikzpicture}
}
\begin{document}
\pagenumbering{gobble}
\def \myTitle {my label content}
\myLabel \myLabel \\
\vspace*{4mm}
\myLabel \myLabel \\
\vspace*{4mm}
\myLabel \myLabel \\
\vspace*{4mm}
\myLabel \myLabel \\
\vspace*{4mm}
\myLabel \myLabel \\
\vspace*{4mm}
\myLabel \myLabel \\
\vspace*{4mm}
\myLabel \myLabel \\
\vspace*{4mm}
\myLabel \myLabel \\
\vspace*{4mm}
\end{document}
答案1
水平错位是由于第一行缩进造成的。要解决垂直空间问题:\\
如果您想要换行,请不要使用。
\documentclass{article}
\usepackage[a4paper,margin=1cm,landscape]{geometry}
\usepackage{pgfornament}
\usetikzlibrary{calc}
\newcommand\myLabel{%
\begin{tikzpicture}
% Text
\node[font=\fontsize{32}{35}\selectfont,align=center,text width=11cm](myLabel) {\myTitle};%
% Outside of the label
\draw[line width=1pt,line cap=rect,lightgray] ([xshift=-10pt,yshift=10pt]myLabel.north west) -| ([xshift=10pt,yshift=-10pt]myLabel.south east) -| ([xshift=-10pt,yshift=-10pt]myLabel.north west) -- cycle;%
% Decoration
\draw[line width=1pt,line cap=rect,lightgray] (myLabel.north west) -| (myLabel.south east) -| (myLabel.north west) -- cycle;%
% Decoration in corners
\node[anchor=north west,font=\color{gray}] at ([xshift=-10pt,yshift=10pt]myLabel.north west){\pgfornament[width=1cm]{31}};%
\node[anchor=north east,font=\color{gray}] at ([xshift=10pt,yshift=10pt]myLabel.north east){\pgfornament[width=1cm,symmetry=v]{31}};%
\node[anchor=south west,font=\color{gray}] at ([xshift=-10pt,yshift=-10pt]myLabel.south west){\pgfornament[width=1cm,symmetry=h]{31}};%
\node[anchor=south east,font=\color{gray}] at ([xshift=10pt,yshift=-10pt]myLabel.south east){\pgfornament[width=1cm,symmetry=c]{31}};%
\end{tikzpicture}%
}
\setlength\parindent{0cm}
\begin{document}
\pagenumbering{gobble}%
\def\myTitle{my label content}%
\myLabel \myLabel
\vspace*{4mm}
\myLabel \myLabel
\vspace*{4mm}
\myLabel \myLabel
\vspace*{4mm}
\myLabel \myLabel
\vspace*{4mm}
\myLabel \myLabel
\vspace*{4mm}
\myLabel \myLabel
\vspace*{4mm}
\myLabel \myLabel
\vspace*{4mm}
\myLabel \myLabel
\vspace*{4mm}
\end{document}