2

I'm trying to draw an ornament after a horizontal line, with a small spacing between the figure and the line, but xshift doesn't seem to work when I connect the line to a node.

I'm attempting to do this

\draw ([yshift=-10pt]current page header area.south west) -- %
([xshift=-5pt,yshift=-10pt]current page header area.south); %
node {\pgfornament[width=0.5cm]{1}};
PerroNoob
  • 641
  • 9
  • 23

1 Answers1

4

Something like this? Notice the options remember picture,overlay for tikzpicture (thanks to Paul Gaborit for reminding me of this):

\documentclass{article}
\usepackage{tikzpagenodes}
\usepackage{pgfornament}
\begin{document}
\begin{tikzpicture}[remember picture,overlay]
\draw ([yshift=-10pt]current page header area.south west) -- %
([xshift=-5pt,yshift=-10pt]current page header area.south) %
node[xshift=20pt] {\pgfornament[width=0.5cm]{1}};
\end{tikzpicture}
\end{document}

enter image description here

You had a spurious ; before the node.

Perhaps is it something like this what you have in mind?

\documentclass{article}
\usepackage{tikzpagenodes}
\usepackage{pgfornament}
\begin{document}
\begin{tikzpicture}[remember picture,overlay]
\draw ([yshift=-10pt]current page header area.south west) --
([xshift=-15pt,yshift=-10pt]current page header area.south);
\draw ([xshift=15pt,yshift=-10pt]current page header area.south) --
([yshift=-10pt]current page header area.south east);
\node[yshift=-10pt] at (current page header area.south) {\pgfornament[width=0.5cm]{1}};
\end{tikzpicture}
\end{document}

enter image description here

Or this:

\documentclass{article}
\usepackage{tikzpagenodes}
\usepackage{pgfornament}
\begin{document}
\begin{tikzpicture}[remember picture,overlay]
\draw ([yshift=-10pt]current page header area.south west) --
node[fill=white,inner xsep=10pt] {\pgfornament[width=0.5cm]{1}}
([yshift=-10pt]current page header area.south east);
\end{tikzpicture}
\end{document}

The precaution mentioned in the answer to How to avoid empty space caused by TikZ might be useful too.

Gonzalo Medina
  • 505,128