6

This question is building from the post found here. I would like to get the code to produce this cover page that is found here:

enter image description here

I am still not successful in getting the full page of the tikz image to show up. Here is the code modified as per the suggestions provided by John Kormylo with other tweaks:

\documentclass[11pt,letterpaper]{article}

\usepackage{tikz}
\usetikzlibrary{backgrounds, calc, shadows, shadows.blur}

\usepackage{graphicx}

\pgfmathdeclarerandomlist{MyRandomColors}{%
    {red}%
    {red!25}%
    {magenta}%
    {magenta!25}%
    {olive}%
    {olive!25}%
    {brown}%
    {brown!10}%
    {violet}%
    {violet!25}%
    {gray}%
    {purple}%
    {yellow}%
    {orange}%
    {orange!25}%
    {cyan}%
    {green}%
}%

\newcommand*{\GridSize}{20}

\newcommand*{\ColorCells}{%
    \foreach \y in {1,...,\GridSize} {
        \foreach \x in {1,...,\GridSize} {
            \pgfmathrandomitem{\RandomColor}{MyRandomColors}
            \draw [fill=\RandomColor, fill opacity=0.2, draw=none, ultra thick]
                (\x-1,\y-1) rectangle (\x,\y);
        }%
    }%
}%

\listfiles
\begin{document}
\pagestyle{empty}
\begin{tikzpicture}
\coordinate (Origin) at (0,0);
    \begin{scope}[scale=0.8,ultra thick,olive!45]
        \ColorCells
        \draw (0, 0) grid (\GridSize, \GridSize);
        \coordinate (input);
    \end{scope}

\node[rotate=90,above right] at ($(current bounding box.south east)+(-1,1)$)
      {\textcolor[rgb]{0.01,0.50,1.00}{\fontsize{50}{120}\selectfont{\textbf{the name of the course}}}};
          \node[above right] at ($(current bounding box.south west)+(1,1)$)
      {\fontsize{50}{120}\selectfont{name of authorities}};
\end{tikzpicture}
\end{document} 
Joe
  • 9,080

1 Answers1

7

I've introduced some changes to your code

  1. It works with current page references.
  2. ColorCells has been modified to accept two parameters: xgridsize and ygridsize which are the number of horizontal and vertical cells (1cm x 1cm) x scale to be drawn.
  3. Text nodes are placed with reference to current page instead of current size box.
  4. Replaced \textcolor...\fontsize...\selectfont by node font and text options to select fonts a la TiKZ.

The complete code is:

\documentclass[11pt,letterpaper]{article}
\usepackage{libertine}
\usepackage{tikz}
\usetikzlibrary{backgrounds, calc, shadows, shadows.blur}

\usepackage{graphicx}

\pgfmathdeclarerandomlist{MyRandomColors}{%
    {red}%
    {red!25}%
    {magenta}%
    {magenta!25}%
    {olive}%
    {olive!25}%
    {brown}%
    {brown!10}%
    {violet}%
    {violet!25}%
    {gray}%
    {purple}%
    {yellow}%
    {orange}%
    {orange!25}%
    {cyan}%
    {green}%
}%

\definecolor{titlecolor}{rgb}{0.01,0.50,1.00}

\newcommand*{\GridSize}{20}

%#2-Gridsizex
%#3-Gridsizey
\newcommand*{\ColorCells}[2]{%
    \foreach \y in {1,...,#1} {
        \foreach \x in {1,...,#2} {
            \pgfmathrandomitem{\RandomColor}{MyRandomColors}
            \draw [draw=olive!45,fill=\RandomColor, fill opacity=0.2, ultra thick]
                ([shift={(\x-1,\y-1)}]current page.south west) rectangle ++(1cm,1cm);
        }%
    }%
}%

\listfiles
\begin{document}
\pagestyle{empty}
\begin{tikzpicture}[remember picture,overlay]
    \begin{scope}[scale=0.8,ultra thick,olive!45]
        \ColorCells{35}{27}
        \coordinate (input);
    \end{scope}

    \node[rotate=90, above right, 
         node font=\fontsize{70}{90}\selectfont\bfseries\sffamily, 
         text=titlecolor] at ($(current page.south east)+(-1,1)$)
         {the name of the course};
    \node[above right, 
         node font=\fontsize{40}{90}\selectfont\bfseries\sffamily,   
         text=titlecolor!20!black] at ($(current page.south west)+(1,1)$)
         {name of authorities};
\end{tikzpicture}
\end{document} 

And the result:

enter image description here

Ignasi
  • 136,588
  • Can you tell me what font was used in the original cover page? Thanks. – Joe Jan 25 '16 at 14:34
  • 1
    @joe \fontsize{fontsize}{baselineskip}. If you change first parameter you change font size, but the second only will have effect with more than one line. Some fonts don't exist in any size, in this case they are substituded for a suitable size. You can see related warnings in .log file. If you want to use any font , select a scalable font. In updated answer I've used libertine. I don't know which font was used in metafun documentation. – Ignasi Jan 25 '16 at 15:09