我试图得到一个类似于这个封面的效果这里:
我从找到的代码开始这里绘制带有颜色的网格。我该如何完成代码才能获得如上图所示的输出?
这是我目前拥有的代码:
\documentclass[11pt,letterpaper]{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\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}{10}
\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}[scale=1]
\begin{scope}[thick]
\ColorCells
\draw (0, 0) grid (\GridSize, \GridSize);
\coordinate (input);
\end{scope}
\end{tikzpicture}
\rotatebox{90}{\textcolor[rgb]{0.01,0.50,1.00}{\fontsize{50}{120}\selectfont{the name of the course}}}
{\fontsize{50}{120}\selectfont{name of authorities}}
\end{document}
答案1
您可以使用 TikZ 节点叠加文本。您甚至可以使用[overlay]
和将其扩展以填充整个页面(current page)
。
\documentclass[11pt,letterpaper]{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\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}{10}
\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}[scale=1]
\begin{scope}[thick]
\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{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}