0

I would like to bring in several ornamental elements in the lines between the corners. I'am usigng,

\begin{tikzpicture}[every node/.style={inner sep=0pt}]
\node[shift={(1.cm,-1cm)},anchor=north west](CNW)
at (current page.north west) {\pgfornament[width=1.75cm]{61}};
\node[shift={(-1cm,-1cm)},anchor=north east](CNE)
at (current page.north east) {\pgfornament[width=1.75cm,symmetry=v]{61}};
\node[shift={(1cm,1cm)},anchor=south west](CSW)
at (current page.south west) {\pgfornament[width=1.75cm,symmetry=h]{61}};
\node[shift={(-1cm,1cm)},anchor=south east](CSE)
at (current page.south east) {\pgfornament[width=1.75cm,symmetry=c]{61}};
\pgfornamentline{CNW}{CNE}{87}
\pgfornamentline{CSW}{CSE}{87}
\pgfornamentline{CNW}{CSW}{87}
\pgfornamentline{CNE}{CSE}{87}
\end{tikzpicture}%

but i could not define the majority of ornaments between the corners.

The normal definition is known from the package description,

\begin{tikzpicture}[bullet/.style={% circle,draw,fill=black!30,inner sep=2pt}] \draw [help lines,color=black!60] (0,0) grid (5,2); \node[bullet] (A) at (0,0) {}; \node[bullet] (B) at (6,4) {}; \pgfornamentline[color=red]{A}{B}{4}{88} \end{tikzpicture}

but does not lead to the desired result here.

I need help, thank you very much!

For a better understanding of the problem, a sketch.

enter image description here

The background option should be enough.

So far so good. I tried to modify it with a colored frame.

\documentclass{article}
\usepackage{xcolor} 
\usepackage[object=vectorian]{pgfornament}
\usepackage{background}
\usetikzlibrary{calc}
\usepackage{lipsum}

\begin{document}

\backgroundsetup{ scale=1, opacity=1, angle=0, color=black, contents={% \begin{tikzpicture}[every node/.style={inner sep=0pt}] \nodeshift={(1cm,-1cm)},anchor=north west at (current page.north west) {\pgfornament[width=1.75cm]{61}}; \nodeshift={(-1cm,-1cm)},anchor=north east at (current page.north east) {\pgfornament[width=1.75cm,symmetry=v]{61}}; \nodeshift={(1cm,1cm)},anchor=south west at (current page.south west) {\pgfornament[width=1.75cm,symmetry=h]{61}}; \nodeshift={(-1cm,1cm)},anchor=south east at (current page.south east) {\pgfornament[width=1.75cm,symmetry=c]{61}}; \pgfornamentline{CNW.north east}{CNE.north west}{3}{87} \pgfornamentline{CSW.south east}{CSE.south west}{3}{87} \pgfornamentline{CNW.south west}{CSW.north west}{5}{87} \pgfornamentline{CNE.south east}{CSE.north east}{5}{87} \fill[blue] (current page.south west) rectangle ( $ (current page.north west) + (3cm,0) $); \fill[blue] (current page.south east) rectangle ( $ (current page.north east) + (-3cm,0) $); \fill[blue] (current page.north west) rectangle ( $ (current page.north east) + (0,-3cm) $); \fill[blue] (current page.south west) rectangle ( $ (current page.south east) + (0,3cm) $); \end{tikzpicture}% } }

\lipsum[1-20]

\end{document}

But the ornament structure is overwritten. Can I determine a corresponding level order or is there another solution. Wouldn't lose the ability to manually adjust the colored frame if possible.

  • Welcome to tex.se. For the command syntax, you have left out the number of repetitions: \pgfornamentline{start-pos}{finish-pos}number-of-repeats{ornament-number} e.g., \pgfornamentline{CNW}{CNE}1{87} – Cicada Jan 12 '21 at 10:45
  • This isn't a made-to-order answer, but it provides a way of thinking about how to create a frame: Glisterings article by Peter Wilson in TUGboat, on the subject of ornaments. – barbara beeton Jan 17 '21 at 00:34

1 Answers1

2

Amended answer

After examining the layout sketch added, and some other information surfacing, several paths to a solution become available.

The question is many-parts.

Dealing with the first part, an ornamental frame, we have:

(1) eso-pic package, and drawing on the PDF picture background layer (adapting @user11232 solution at ornaments in pgfornament to be at the corners at every page)

(2) background package (which runs on top of TikZ), and drawing a tikzpicture (adapting @GonzaloMedina solution at the same link as above)

(3) picture mode, and making a zero-width picture and placing it in the footer using fancyhdr package (Thanks to @BarbaraBeeton for the link to the Peter Wilson 2011 TUGboat article v32 p202).

As to the second matter, the question how many ornamental glyphs should go along an edge, aside from it being a judgemental/opinion-based question, an automatic solution (or solutions) could be designed and built (using some set of as-yet unspecified aesthetic rules), but, since the definition is only ever done once, manually implementing it is much more practical (and simpler).

For example, because \pgfornamentline can take a scale= option, thus making the number of ornaments discretionary according to taste, the ratio of the long:short edges of the page can be used as a guideline (or not): 5:3 (left:top) for A4 portrait, say; or 2:3 (left:top) for A5 landscape.

An automated solution sounds desirable and a method like this would involve tracking three dimensions, the page-edge ratio, the ornament scale factor, and the ornament height/width ratio, keeping two of them constant while varying the third, but won't be pursued further here (at least not tonight, anyway).


So:

The Frame

(1)eso-pic package drawing on the background layer with \AddToShipoutPictureBG.

Positioning and layout is manual.

The ornament line is assembled, so individual items are accessible (although, an assembled set of elements could be fed in, and repeated once only).

For completeness, for a version with an on/off switch for the frame, see (1a).

esopic

MWE

\documentclass[12pt]{article}
\usepackage{pgfornament}
\usepackage{eso-pic}
\usepackage{rotating}
\usepackage{xcolor}
\usepackage{lipsum}

\newcommand\AtPageUpperRight[1]{\AtPageUpperLeft{% \put(\LenToUnit{\paperwidth},\LenToUnit{0\paperheight}){#1}% }}% \newcommand\AtPageLowerRight[1]{\AtPageLowerLeft{% \put(\LenToUnit{\paperwidth},\LenToUnit{0\paperheight}){#1}% }}%

\newcommand\ornscale{0.42} \newcommand\ornscalev{0.44}

\newcommand\leavesthree{\pgfornament[scale=\ornscale]{87}\textcolor{red}{\pgfornament[scale=\ornscale]{87}}\pgfornament[scale=\ornscale]{87}}

\newcommand\leavesfive{\turnbox{-90}{\pgfornament[scale=\ornscalev]{87}\textcolor{red}{\pgfornament[scale=\ornscale]{87}}\textcolor{red}{\pgfornament[scale=\ornscale]{87}}\pgfornament[scale=\ornscalev]{87}}}

\AddToShipoutPictureBG{% \AtPageUpperLeft{\put(25,-50){\textcolor{blue}{\pgfornament[width=1.75cm]{61}}}} \AtPageUpperRight{\put(-75,-50){\textcolor{blue}{\pgfornament[width=1.75cm,symmetry=v]{61}}}} \AtPageLowerLeft{\put(25,50){\textcolor{blue}{\pgfornament[width=1.75cm,symmetry=h]{61}}}} \AtPageLowerRight{\put(-75,50){\textcolor{blue}{\pgfornament[width=1.75cm,symmetry=c]{61}}}} \AtPageUpperLeft{\put(78,-25){\leavesthree}}%top border \AtPageLowerLeft{\put(78,27){\leavesthree}}%bottom \AtPageUpperLeft{\put(25,-78){\leavesfive}}%left side
\AtPageUpperRight{\put(-25,-78){\leavesfive}}%right side }

\begin{document} \lipsum[1-40] \end{document}

(1a)

To make the frame switchable on/off, create a new IF variable:

\newif{\ifbgoff}
\bgofftrue

where (in this methodology) true will mean "no frame" (as in "background off").

Add the if-condition to the \AddToShipoutPictureBG command like so:

\AddToShipoutPictureBG{%
 \ifbgoff\else  *<existing code>* \fi}

Usage: Toggle the frame on (with \bgofffalse)/off (with \bgofftrue) in conjunction with a \newpage or equivalent.

\begin{document}
\section{Off}
\lipsum[1-15]
\bgofffalse
\section{On}
\lipsum[1-15]

\newpage \bgofftrue \section{Off Again} \lipsum[1-8]

\newpage\bgofffalse \section{On Again} \lipsum[1-15]

\newpage \bgofftrue \section{And Off Once More} \lipsum[1-8]

\end{document}

Full MWE:

\documentclass[12pt]{article}
\usepackage{pgfornament}
\usepackage{eso-pic}
\usepackage{rotating}
\usepackage{xcolor}
\usepackage{lipsum}

\newcommand\AtPageUpperRight[1]{\AtPageUpperLeft{% \put(\LenToUnit{\paperwidth},\LenToUnit{0\paperheight}){#1}% }}% \newcommand\AtPageLowerRight[1]{\AtPageLowerLeft{% \put(\LenToUnit{\paperwidth},\LenToUnit{0\paperheight}){#1}% }}%

\newcommand\ornscale{0.42} \newcommand\ornscalev{0.44}

\newcommand\leavesthree{\pgfornament[scale=\ornscale]{87}\textcolor{red}{\pgfornament[scale=\ornscale]{87}}\pgfornament[scale=\ornscale]{87}}

\newcommand\leavesfive{\turnbox{-90}{\pgfornament[scale=\ornscalev]{87}\textcolor{red}{\pgfornament[scale=\ornscale]{87}}\textcolor{red}{\pgfornament[scale=\ornscale]{87}}\pgfornament[scale=\ornscalev]{87}}}

\newif{\ifbgoff} \bgofftrue

\AddToShipoutPictureBG{% \ifbgoff\else \AtPageUpperLeft{\put(25,-50){\textcolor{blue}{\pgfornament[width=1.75cm]{61}}}} \AtPageUpperRight{\put(-75,-50){\textcolor{blue}{\pgfornament[width=1.75cm,symmetry=v]{61}}}} \AtPageLowerLeft{\put(25,50){\textcolor{blue}{\pgfornament[width=1.75cm,symmetry=h]{61}}}} \AtPageLowerRight{\put(-75,50){\textcolor{blue}{\pgfornament[width=1.75cm,symmetry=c]{61}}}} \AtPageUpperLeft{\put(78,-25){\leavesthree}}%top border \AtPageLowerLeft{\put(78,27){\leavesthree}}%bottom \AtPageUpperLeft{\put(25,-78){\leavesfive}}%left side
\AtPageUpperRight{\put(-25,-78){\leavesfive}}%right side \fi}

\begin{document} \section{Off} \lipsum[1-15] \bgofffalse \section{On} \lipsum[1-15]

\newpage \bgofftrue \section{Off Again} \lipsum[1-8]

\newpage\bgofffalse \section{On Again} \lipsum[1-15]

\newpage \bgofftrue \section{And Off Once More} \lipsum[1-8]

\end{document}

(2) background package plus tikzpicture in the \backgroundsetup command.

Positioning elements is much easier with TikZ.

The ornament line is a unit.

Backgrounds can be switched on/off or changed within the document on a page(s) basis.

background

MWE

\documentclass[12pt]{article}
\usepackage{background}
\usepackage{pgfornament}
\usepackage{lipsum}
\usetikzlibrary{calc}

\backgroundsetup{ scale=1, opacity=1, angle=0, color=black, contents={% \begin{tikzpicture}[every node/.style={inner sep=0pt}] \nodeshift={(1cm,-1cm)},anchor=north west at (current page.north west) {\pgfornament[width=1.75cm]{61}}; \nodeshift={(-1cm,-1cm)},anchor=north east at (current page.north east) {\pgfornament[width=1.75cm,symmetry=v]{61}}; \nodeshift={(1cm,1cm)},anchor=south west at (current page.south west) {\pgfornament[width=1.75cm,symmetry=h]{61}}; \nodeshift={(-1cm,1cm)},anchor=south east at (current page.south east) {\pgfornament[width=1.75cm,symmetry=c]{61}}; \pgfornamentline{CNW.north east}{CNE.north west}{3}{87} \pgfornamentline{CSW.south east}{CSE.south west}{3}{87} \pgfornamentline{CNW.south west}{CSW.north west}{5}{87} \pgfornamentline{CNE.south east}{CSE.south east}{5}{87} \end{tikzpicture}% } }

\begin{document} \lipsum[1-40] \end{document}

(3) a picture mode zero-width picture in the footer (or header, if desired)

Picture mode is used, so positioning is manual here.

Footers and headers (and associated pagestyles) can be modified using fancyhdr package commands.

zero width picture

MWE

\documentclass[12pt]{article}
\usepackage{pgfornament}
%\usepackage{eso-pic}
\usepackage{rotating}
\usepackage{xcolor}
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage{lipsum}

\newcommand\ornscale{0.39} \newcommand\ornscalev{0.45}

\newcommand\leavesthree{\pgfornament[scale=\ornscale]{87}\textcolor{red}{\pgfornament[scale=\ornscale]{87}}\pgfornament[scale=\ornscale]{87}}

\newcommand\leavesfive{\turnbox{-90}{\pgfornament[scale=\ornscalev]{87}\textcolor{red}{\pgfornament[scale=\ornscale]{87}}\textcolor{red}{\pgfornament[scale=\ornscale]{87}}\pgfornament[scale=\ornscalev]{87}}}

%\pgfornament[width=2cm]{3}

\newcommand{\upit}[2]{\raisebox{#1}{#2}}\newcommand{\rotpi}[1]{\rotatebox{180}{#1}}\newcommand{\rotrt}[1]{\rotatebox{90}{#1}}\newcommand{\rotlft}[1]{\rotatebox{-90}{#1}}

%%% draws a (page) frame \newcommand*{\goddfoot}{\begin{picture}(0,0) %\wb{10pt}{10pt} \put(-70,-50){% change these to move the frame \begin{picture}(0,0) \multiput(52,0)(0,0){1}{\leavesthree} % bottom \multiput(5,669)(0,0){1}{\leavesfive} % left \multiput(530,669)(0,0){1}{\leavesfive} % right \multiput(52,718)(0,0){1}{\leavesthree} % top \put(0,700){\textcolor{blue}{\pgfornament[width=1.75cm]{61}}}%TL \put(485,700){\textcolor{blue}{\pgfornament[width=1.75cm,symmetry=v]{61}}}%TR \put(0,20){\textcolor{blue}{\pgfornament[width=1.75cm,symmetry=h]{61}}}%BL \put(485,20){\textcolor{blue}{\pgfornament[width=1.75cm,symmetry=c]{61}}}%BR \end{picture}} \end{picture}} \let\gevenfoot\goddfoot

\fancyfoot[L]{\goddfoot}

\begin{document} \lipsum[1-40] \end{document}


Original answer

You need to supply a Minimum Working Example so people can test their answers against without having to guess anything; and also use the remember picture,overlay options (as the manual says).

I am not sure what you intend the anchors for.

This MWE:

\documentclass{article}
\usepackage{tikz}
\usepackage{pgfornament}

\begin{document} \begin{tikzpicture}[remember picture,overlay,every node/.style={inner sep=0pt}] \node [shift={(1cm,-1cm)},blue,scale=2] (CNW) at (current page.north west) {\pgfornament[height=1cm,width=1cm]{61}}; \node [shift={(-1cm,-1cm)},blue,scale=2] (CNE) at (current page.north east) {\pgfornament[height=1cm,width=1cm,symmetry=v]{61}}; \node [shift={(1cm,1cm)},blue,scale=2] (CSW) at (current page.south west) {\pgfornament[height=1cm,width=1cm,symmetry=h]{61}}; \node [shift={(-1cm,1cm)},blue,scale=2] (CSE) at (current page.south east) {\pgfornament[height=1cm,width=1cm,symmetry=c]{61}}; \pgfornamentline[color=brown]{CNW}{CNE}{2}{87} \pgfornamentline{CSW}{CSE}{2}{87} \pgfornamentline{CNW}{CSW}{3}{87} \pgfornamentline{CNE}{CSE}{3}{87} \end{tikzpicture}%

produces this:

ornaments


Addition

In TikZ, there are multiple ways to achieve the same effect.

If I understand the statement in the comments correctly, if the goal is to draw ornamental lines between the corners of a page, from corner to corner, and such that the centre of the line is on the page edge, then one way is -- to draw ornamental lines between the corners of the page:

\pgfornamentline[color=brown]{current page.north west}{current page.north east}{2}{87}
\pgfornamentline{current page.south west}{current page.south east}{2}{87}
\pgfornamentline{current page.north west}{current page.south west}{3}{87}
\pgfornamentline{current page.north east}{current page.south east}{3}{87}

To avoid being overwritten, (one method is) the corner ornaments can be pushed out of the way with the anchor= options.

ornamentsonedge

MWE2

\documentclass{article}
\usepackage{tikz}
\usepackage{pgfornament}

\begin{document} \begin{tikzpicture}[remember picture,overlay,every node/.style={inner sep=0pt}] \node [shift={(1cm,-1cm)},blue,scale=2,anchor=north west] (CNW) at (current page.north west) {\pgfornament[height=1cm,width=1cm]{61}}; \node [shift={(-1cm,-1cm)},blue,scale=2,anchor=north east] (CNE) at (current page.north east) {\pgfornament[height=1cm,width=1cm,symmetry=v]{61}}; \node [shift={(1cm,1cm)},blue,scale=2,anchor=south west] (CSW) at (current page.south west) {\pgfornament[height=1cm,width=1cm,symmetry=h]{61}}; \node [shift={(-1cm,1cm)},blue,scale=2,anchor=south east] (CSE) at (current page.south east) {\pgfornament[height=1cm,width=1cm,symmetry=c]{61}}; %\pgfornamentline[color=brown]{CNW}{CNE}{2}{87} %\pgfornamentline{CSW}{CSE}{2}{87} %\pgfornamentline{CNW}{CSW}{3}{87} %\pgfornamentline{CNE}{CSE}{3}{87} \pgfornamentline[color=brown]{current page.north west}{current page.north east}{2}{87} \pgfornamentline{current page.south west}{current page.south east}{2}{87} \pgfornamentline{current page.north west}{current page.south west}{3}{87} \pgfornamentline{current page.north east}{current page.south east}{3}{87} \end{tikzpicture}%

%\begin{tikzpicture}[bullet/.style={% %circle,draw,fill=black!30,inner sep=2pt}] %\draw [help lines,color=black!60] (0,0) grid (5,2); %\node[bullet] (A) at (0,0) {}; \node[bullet] (B) at (6,4) {}; %\pgfornamentline[color=red]{A}{B}{4}{88} %\end{tikzpicture} \end{document}

Cicada
  • 10,129
  • Thank you for your answers. Please excuse if not all information has been given. If possible, the ornamental line should lie exactly between the corners. – Sebastian Moritz Jan 13 '21 at 16:30
  • @SebastianMoritz See amended answer. – Cicada Jan 15 '21 at 02:04
  • And again I have to apologize for making myself unclear. I had edited the article, but the supplement was not published. I'll try again.The corners ornaments as in your first answer, and the ornaments lines exactly in between. – Sebastian Moritz Jan 15 '21 at 14:11
  • Like this example. https://tex.stackexchange.com/questions/159597/ornaments-in-pgfornament-to-be-at-the-corners-at-every-page But for an overall balanced appearance (in a4paper, a5paper) more ornaments in the vertical. – Sebastian Moritz Jan 15 '21 at 21:32
  • You will have to draw a picture. None of my guesses have been correct so far. (1) The link has 3 codes (OP + 2 answers) - which one do you mean when you say 'like this example'? (2) Do you want every page to have the ornamentation, or just the specific poem-text like in the linked OP? (3) Number of items in a line is the 3rd parameter \pgfornamentline{CNW}{CNE}{3}{87} will put 3 items in the top line. (4) Do you want the number of items in a line to be calculated automatically based on paper size? (5) Each line should join which two points? Can you draw a picture, or name the points? – Cicada Jan 16 '21 at 01:19
  • I meant the first example (Picture). 2) It's for a book. So it should appear on every page. It would of course be great if you could manually turn it off on one or more pages if necessary. 4) If you could calculate the ratio of the number and size of ornaments to that of the page, it should look balanced. Otherwise also set manually via 3). 5) It should be like in the example. Only that within the line several ornaments should appear under the conditions you specified. I tried to edit a picture post, but it did not appear after submitting it. How am I supposed to send you the picture?
  • – Sebastian Moritz Jan 16 '21 at 08:00
  • Load the image into your question by editing the question and clicking on the image icon. I still do not fully understand what you want: can you put all the requirements specifically into the question, instead of referring to external factors in a vague manner? e.g., "under the conditions you specified": what conditions? There are many. Also, do you want the solution as in the link or not? That is, do you want to use eso-pic package or background package (both would explain why remember picture, overlay is not needed there. Also2: why not use the solution from the link? – Cicada Jan 16 '21 at 09:52
  • I've now inserted a sketch for the layout. I mean the conditions for the automatic calculation of the aspect ratio and the analog input. – Sebastian Moritz Jan 16 '21 at 14:34
  • Thank you for your help and your detailed answers. I tried to work with the background from 2). But the right ornament line protrudes (as in your example under 2)) into the corner ornament. Do you know why? Under 1) and 3) the proportions and the number of ornaments must be calculated and entered manually. For that I have to keep trying. – Sebastian Moritz Jan 17 '21 at 20:09
  • For fine-tuning the positioning, use the xshift= and yshift= options to nudge the object slightly (see the manual: do texdoc pgfmanual). Also, try adjusting the scale= by a tiny amount. For the number of ornaments and their scale, none of the three methods calculates anything; it is all manual. Set the scale to your liking, and then, for method (2), type in the number of repeats, and the methods (1) and (2), paste in the ornament as many times as you desire for the scale. What "looks right" is always going to be a matter of judgement and experimentation – Cicada Jan 18 '21 at 04:56
  • No, in 2) it would not be a mere matter of opinion that can be discontinued. It can only be due to the coordinates of the anchor points. At all other corners the ornament line ends exactly in front of the ornament corner. But at the bottom right it goes into the corner ornament. I haven't been able to change it yet. – Sebastian Moritz Jan 18 '21 at 19:10
  • Apologies. There is no "mere". I mistook you to be referring to automatic calculations. To the matter: In the code there is the command \pgfornamentline{CNE.south east}{CSE.south east}{5}{87}. Is that desirable? If the ornament line is made a different colour, say red, \pgfornamentline[color=red]{CNE.south east}{CSE.south east}{5}{87}, it makes more visible what is happening. Does that suggest a remedy? – Cicada Jan 19 '21 at 08:01
  • Under the definition; \pgfornamentline{CNE.south east}{CSE.north east}{5}{87}, all corners of ornaments are the same. But I want to be honest, I have once again fully understood the definition of structure. The question here is from which point the respective element is drawn so that the corner element is seen as the starting point for the ornament line. And not the other way around. – Sebastian Moritz Jan 19 '21 at 09:08
  • The first coordinate should be the starting point (CNE.south east} = south east corner of the north east node/corner-ornament), I expect, and the second coordinate will be the finishing point (where the arrow tip would go, if it were an arrow). The pfgmanual has illustrations. I expect pgfornaments follows the same method. – Cicada Jan 19 '21 at 09:17
  • "node placed beside the actual coordinate: Right ("right" or "anchor=west"), ...Combinations are also possible, like "anchor=north east" or "below left" ...use anchors as defined above relative to (x) as "(x.)", like "(x.north)"..." Form Wikibook LaTeX/PGF/TikZ. I had to find my way back into it. Thank you for your help. – Sebastian Moritz Jan 19 '21 at 09:29