Outils pour utilisateurs

Outils du site


pele_mele:stack_exchange:tex_latex:374734

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
pele_mele:stack_exchange:tex_latex:374734 [2024/11/23 04:02] – supprimée - modification externe (Date inconnue) 127.0.0.1pele_mele:stack_exchange:tex_latex:374734 [2024/11/23 04:02] (Version actuelle) – ↷ Nom de la page changé de pele_mele:stack_exchange:tex_latex:tex-374734 à pele_mele:stack_exchange:tex_latex:374734 alexis
Ligne 1: Ligne 1:
 +====== Why is there a padding only on the first row of a repeating pattern? ======
 +I've made a page of labels and I don't understand why the first line is rendered in a different way as the others.
 +
 +The first line is not align the same way and the ''\vspace*'' following it doesn't have the expected effect.
 +
 +Here is my code:
 +
 +<code latex>
 +\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}
 +</code>
 +
 +<WRAP help>
 +The horizontal misalignment was due to first line being indented. To fix the issue with the vertical space: don't use ''\\'' if you want a line break.
 +
 +<code latex>
 +\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}
 +</code>
 +{{:pele_mele:stack_exchange:tex-374734.png?nolink|}}
 +</WRAP>
 +<WRAP info>
 +[[https://tex.stackexchange.com/questions/374734/why-is-there-a-padding-only-on-the-first-row-of-a-repeating-pattern|tikz pgf - Why is there a padding only on the first row of a repeating pattern? - TeX - LaTeX Stack Exchange]]
 +</WRAP>