2

Consider the code:

\documentclass[12pt]{book}
\usepackage[hmargin=0in,vmargin=0in,right=0in,paperwidth=4in,paperheight=2.15in]{geometry}
\usepackage{pgfornament, tikzpagenodes}
\usetikzlibrary{fadings}
\usepackage{color}
\definecolor{gold}{RGB}{215,190,105}

\begin{tikzfadingfrompicture}[name=myborder, color=transparent!0, inner sep=0.6cm]
    \node[below right] at (current page text area.north west) {\pgfornament[width=2cm]{63}};
    \node[below left ] at (current page text area.north east) {\pgfornament[width=2cm, symmetry=v]{63}};
    \node[above right] at (current page text area.south west) {\pgfornament[width=2cm, symmetry=h]{63}};
    \node[above left ] at (current page text area.south east) {\pgfornament[width=2cm, symmetry=c]{63}};
\end{tikzfadingfrompicture}

\begin{tikzfadingfrompicture}[name=mytext, color=transparent!0]
    \node (n) at (current page text area) {\scalebox{1.00}{Everything is fine!}};
\end{tikzfadingfrompicture}


\begin{document}
    \pagestyle{empty}
    \begin{tikzpicture}[overlay, remember picture]
        \fill[gold] (current page text area.south west) rectangle (current page text area.north east);
        \fill[path fading=myborder, fit fading=false, fading transform={shift=(current page.center)}, transform canvas={xshift=1pt, yshift=-1pt}] (current page.south west) rectangle (current page.north east);
        \fill[path fading=myborder, fit fading=false, fading transform={shift=(current page.center)}, ball color=gold] (current page.south west) rectangle (current page.north east);
        \fill[path fading=mytext  , fit fading=false, fading transform={shift=(current page.center)}, transform canvas={yshift=-1.35pt}]  (n.south west) rectangle (n.north east);
        \fill[path fading=mytext  , fit fading=false, fading transform={shift=(current page.center)}, ball color=gold] (n.south west) rectangle (n.north east);
    \end{tikzpicture}
\end{document}

which produces

enter image description here

However, now I would like to increase the width of the picture (on the right) 0.25in.

So, I replace \usepackage[hmargin=0in,vmargin=0in,right=0in,paperwidth=4in,paperheight=2.15in]{geometry} by \usepackage[hmargin=0in,vmargin=0in,right=0.25in,paperwidth=4in,paperheight=2.15in]{geometry}

And now I run the code:

\documentclass[12pt]{book}
\usepackage[hmargin=0in,vmargin=0in,right=0.25in,paperwidth=4in,paperheight=2.15in]{geometry}
\usepackage{pgfornament, tikzpagenodes}
\usetikzlibrary{fadings}
\usepackage{color}
\definecolor{gold}{RGB}{215,190,105}

\begin{tikzfadingfrompicture}[name=myborder, color=transparent!0, inner sep=0.6cm]
    \node[below right] at (current page text area.north west) {\pgfornament[width=2cm]{63}};
    \node[below left ] at (current page text area.north east) {\pgfornament[width=2cm, symmetry=v]{63}};
    \node[above right] at (current page text area.south west) {\pgfornament[width=2cm, symmetry=h]{63}};
    \node[above left ] at (current page text area.south east) {\pgfornament[width=2cm, symmetry=c]{63}};
\end{tikzfadingfrompicture}

\begin{tikzfadingfrompicture}[name=mytext, color=transparent!0]
    \node (n) at (current page text area) {\scalebox{1.00}{Everything is not fine!}};
\end{tikzfadingfrompicture}


\begin{document}
    \pagestyle{empty}
    \begin{tikzpicture}[overlay, remember picture]
        \fill[gold] (current page text area.south west) rectangle (current page text area.north east);
        \fill[path fading=myborder, fit fading=false, fading transform={shift=(current page.center)}, transform canvas={xshift=1pt, yshift=-1pt}] (current page.south west) rectangle (current page.north east);
        \fill[path fading=myborder, fit fading=false, fading transform={shift=(current page.center)}, ball color=gold] (current page.south west) rectangle (current page.north east);
        \fill[path fading=mytext  , fit fading=false, fading transform={shift=(current page.center)}, transform canvas={yshift=-1.35pt}]  (n.south west) rectangle (n.north east);
        \fill[path fading=mytext  , fit fading=false, fading transform={shift=(current page.center)}, ball color=gold] (n.south west) rectangle (n.north east);
    \end{tikzpicture}
\end{document}

which gives:

enter image description here

Notice that the "E" in "Everything" is somewhat cut off; the width on both the left and the right side of the image is uniformily increased; and there is a white gap (presumably of width 0.25in) on the right.

QUESTION: What caused the cutting off of part of the letter "E" and how do I fix it? And, how do I increase the width of the original picture 0.25in on the RIGHT SIDE only and have it colored gold (not white)?

I compile with xelatex.

Thank you.

1
  • do you want the overall width to remain 4in? because your description suggests not, but your code obviously enforces that i.e. the area available for the not-margin image is 4" in the first case but 3.75" in the second. I'm assuming that is what you want, given the accepted answer, but then I'm not sure because your followup suggests you want the total width to be 4.25".
    – cfr
    Commented Aug 11 at 2:28

2 Answers 2

4

Quick and dirty hack: shift the coordinates of the rectangles with the text fading as needed

\documentclass[12pt]{book}
\usepackage[hmargin=0in,vmargin=0in,right=0.25in,paperwidth=4in,paperheight=2.15in]{geometry}
\usepackage{pgfornament, tikzpagenodes}
\usetikzlibrary{fadings}
\usepackage{color}
\definecolor{gold}{RGB}{215,190,105}

\begin{document}
    \pagestyle{empty}
    
\begin{tikzfadingfrompicture}[name=myborder, color=transparent!0, inner sep=0.6cm]
    \node[below right] at (current page text area.north west) {\pgfornament[width=2cm]{63}};
    \node[below left ] at (current page text area.north east) {\pgfornament[width=2cm, symmetry=v]{63}};
    \node[above right] at (current page text area.south west) {\pgfornament[width=2cm, symmetry=h]{63}};
    \node[above left ] at (current page text area.south east) {\pgfornament[width=2cm, symmetry=c]{63}};
\end{tikzfadingfrompicture}

\begin{tikzfadingfrompicture}[name=mytext, color=transparent!0]
    \node (n) at (current page text area) {\scalebox{1.00}{Everything is not fine!}};
\end{tikzfadingfrompicture}
    
    \begin{tikzpicture}[overlay, remember picture]
        \fill[gold] (current page.south west) rectangle (current page.north east);
        \fill[path fading=myborder, fit fading=false, fading transform={shift=(current page text area.center)}, transform canvas={xshift=1pt, yshift=-1pt}] (current page text area.south west) rectangle (current page text area.north east);
        \fill[path fading=myborder, fit fading=false, fading transform={shift=(current page text area.center)}, ball color=gold] (current page text area.south west) rectangle (current page text area.north east);
        \fill[path fading=mytext  , fit fading=false, fading transform={shift=(current page text area.center)}, transform canvas={yshift=-1.35pt}]  ([xshift=-0.25in]n.south west) rectangle (n.north east);
        \fill[path fading=mytext  , fit fading=false, fading transform={shift=(current page text area.center)}, ball color=gold] ([xshift=-0.25in]n.south west) rectangle (n.north east);
    \end{tikzpicture}
\end{document}

enter image description here

2
  • Many thanks. This seems to have done the trick.
    – DDS
    Commented Aug 10 at 19:08
  • @DDS You're welcome! Commented Aug 10 at 19:10
0

I removed "text area" in a couple of places and it seems to work...?

\documentclass[12pt]{book}
\usepackage[hmargin=0in,vmargin=0in,right=0.25in,paperwidth=4in,paperheight=2.15in]{geometry}
\usepackage{pgfornament, tikzpagenodes}
\usetikzlibrary{fadings}
\usepackage{color}
\definecolor{gold}{RGB}{215,190,105}

\begin{tikzfadingfrompicture}[name=myborder, color=transparent!0, inner sep=0.6cm]
    \node[below right] at (current page text area.north west) {\pgfornament[width=2cm]{63}};
    \node[below left ] at (current page text area.north east) {\pgfornament[width=2cm, symmetry=v]{63}};
    \node[above right] at (current page text area.south west) {\pgfornament[width=2cm, symmetry=h]{63}};
    \node[above left ] at (current page text area.south east) {\pgfornament[width=2cm, symmetry=c]{63}};
\end{tikzfadingfrompicture}

\begin{tikzfadingfrompicture}[name=mytext, color=transparent!0]
    \node (n) at (current page) {\scalebox{1.00}{Everything is not fine!}};
\end{tikzfadingfrompicture}


\begin{document}
    \pagestyle{empty}
    \begin{tikzpicture}[overlay, remember picture]
        \fill[gold] (current page.south west) rectangle (current page.north east);
        \fill[path fading=myborder, fit fading=false, fading transform={shift=(current page.center)}, transform canvas={xshift=1pt, yshift=-1pt}] (current page.south west) rectangle (current page.north east);
        \fill[path fading=myborder, fit fading=false, fading transform={shift=(current page.center)}, ball color=gold] (current page.south west) rectangle (current page.north east);
        \fill[path fading=mytext  , fit fading=false, fading transform={shift=(current page.center)}, transform canvas={yshift=-1.35pt}]  (n.south west) rectangle (n.north east);
        \fill[path fading=mytext  , fit fading=false, fading transform={shift=(current page.center)}, ball color=gold] (n.south west) rectangle (n.north east);
    \end{tikzpicture}
\end{document}

enter image description here

1
  • 1
    Yes, thank you; but the left hand margin is increased with the right hand margin. I wanted to keep the left hand margin as it was but increase only the right side by 0.25in.
    – DDS
    Commented Aug 10 at 17:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .