我想知道如何才能实现带有棋盘格背景图像的封面设计。
\documentclass[12pt,svgnames]{book}
\usepackage{eso-pic}
\usepackage{geometry}
\usepackage[english]{babel}
% Title Page
\title{My Title Page}
\author{My Self}
\date{}
\AddToShipoutPicture*{\put(0,0){\includegraphics[width=\paperwidth,height=\paperheight]{example-a}}}
\begin{document}
\newgeometry{margin = 0pt}
\maketitle
\restoregeometry
\chapter{Chapter Title}
%
chapter text.
\end{document}
答案1
我创建了一个pic
有两个元素的正方形args
:边长(以厘米为单位)和颜色。
通过这种方式,你可以尽情选择你喜欢的东西:
\documentclass[12pt,svgnames]{book}
\usepackage{eso-pic}
\usepackage{geometry}
\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage{tikz}
% Title Page
\title{My Title Page}
\author{My Self}
\date{}
\newlength{\mydim}
\tikzset{%
pics/chessboard/.style args={#1,#2}{code={%
\setlength{\mydim}{#1cm}
\pgfmathsetmacro{\stepeven}{2*#1}
\pgfmathsetmacro{\totx}{int(round(\paperwidth/\mydim))*#1}
\pgfmathsetmacro{\toty}{int(round(\paperheight/\mydim))*#1}
\pgfmathsetmacro{\stepodd}{(2*#1)+#1}
\foreach \x in {0,\stepeven,...,\totx} \foreach \y in {0,\stepeven,...,\toty}
{
\path[fill=#2] (\x,\y) rectangle ++ (#1,#1);
}
\foreach \x in {#1,\stepodd,...,\totx} \foreach \y in {#1,\stepodd,...,\toty}
{
\path[fill=#2] (\x,\y) rectangle ++ (#1,#1);
}
}}
}
\AddToShipoutPicture*{\put(0,0){\includegraphics[width=\paperwidth,height=\paperheight]{example-image-a}}
\put(0,0){%
\begin{tikzpicture}
\pic {chessboard={.7,red}};
\end{tikzpicture}
}}
\begin{document}
\newgeometry{margin = 0pt}
\maketitle
\restoregeometry
\chapter{Chapter Title}
%
chapter text.
\end{document}
这是 MWE ( ) 的输出\pic {chessboard={.7,red}};
:
例如,如果你输入\pic {chessboard={.4,green}};
,你会得到这样的结果: