1

I am creating a class that I will use for my notes and, as the front page, I intended to have a fractal running through the diagonal of the page and the two parts created by the path, filled with different colors.

As you can see in the image I managed to get the fractal but the fill does not properly work. I have tried different approaches: using \filldraw while creating the fractal, using path picture as shown in this question and answer, clipping and more but none of them gave different results than what you can see in the following picture.

wrong result

This picture was created by the following code:

\documentclass{article}

\usepackage{tikzpagenodes}
\usetikzlibrary{decorations.fractals}

\begin{document}
\begin{tikzpicture}[overlay, remember picture]
  \fill[blue] (current page.north west) rectangle (current page.south east);
  \filldraw[fill=red,decoration=Koch curve type 2,draw=white,very thick]
    decorate {
      decorate {
        decorate {
          (current page.north west) --
          (current page.south east)
        }
      }
    };
\end{tikzpicture}
\end{document}

I am then trying to understand how I can properly achieve what I want. What options are there? Thanks for your time!

6
  • 1
    Does replacing the last }; by } -- (current page.south west) -- cycle; do what you want? Mar 18, 2020 at 16:23
  • Yes, for the most part. Thanks a bunch, that was so easy! The only problem now is that there's a white (the draw color) line all on the bottom and left side of the document. To avoid that I would have to have 2 calls: one \fill with the coordinates you gave me and one \draw with only the diagonal. Are there any other solutions?
    – gjkf
    Mar 18, 2020 at 16:28
  • @gjkf I do not get the bottom left white line you mention when I compile your document.
    – BambOo
    Mar 18, 2020 at 17:06
  • You can see it here. Of course you have to add Phelype's correction to the code to actually make the output I just gave you.
    – gjkf
    Mar 18, 2020 at 17:11
  • The white line is the draw. You can use \fill[fill=red,decoration=Koch curve type 2] with Phelype's modification and then draw[decoration=Koch curve type 2,draw=white,very thick] ... with our original path. Of course you can do it in one path, too, if you either clip or just go beyond the page boundaries without clipping. Then you need to replace ; in your code by -- ++ (0,-1) -| ([xshift=-1cm,yshift=1cm]current page.north west);.
    – user194703
    Mar 18, 2020 at 18:29

1 Answer 1

1

As suggested by Phelype Oleinik in the comments, here's the fixed code:

\documentclass{article}

\usepackage{tikzpagenodes}
\usetikzlibrary{decorations.fractals}

\begin{document}
\begin{tikzpicture}[overlay, remember picture]
  \fill[blue] (current page.north west) rectangle (current page.south east);
  \fill[fill=red,decoration=Koch curve type 2,very thick]
    decorate {
      decorate {
        decorate {
          (current page.north west) --
          (current page.south east)
        }
      }
    } -- (current page.south west) -- cycle;
  \draw[draw=white,decoration=Koch curve type 2,very thick]
    decorate {
      decorate {
        decorate {
          (current page.north west) --
          (current page.south east)
        }
      }
    };
\end{tikzpicture}
\end{document}
1
  • I guess you can drop the very thick in the first path, see my comment.
    – user194703
    Mar 18, 2020 at 20:58

You must log in to answer this question.

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