文本可以有颜色:
\documentclass{standalone}
\usepackage{xcolor}
\begin{document}
{\textcolor{green}{\Large I}}
\end{document}
可以填充以下区域patterns
:
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{patterns}
\begin{document}
\begin{tikzpicture}
\draw[pattern=bricks, pattern color=green] (0,0) -- (0,1) -- (1,1) -- (1,0) -- cycle;
\end{tikzpicture}
\end{document}
如何用 填充字母或符号pattern
?
例如,用绿色砖块填充的“I”看起来应该是这样的:
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{patterns}
\begin{document}
\begin{tikzpicture}
% shouldn't need to trace a symbol!
\draw[pattern=bricks, pattern color=green] (0,0) -- (3,0) -- (3,1) -- (2,1) -- (2,3) -- (3,3) -- (3,4) -- (0, 4) -- (0,3) -- (1,3) -- (1,1) -- (0,1) -- cycle;
\end{tikzpicture}
\end{document}
答案1
从概念上来说,这非常类似于这个答案。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{fadings,patterns}
\begin{document}
\newcommand\textpattern[2][pattern=bricks]{%
\begin{tikzfadingfrompicture}[name=letter]
\node [text=transparent!0,scale=10,font=\bfseries\sffamily] {#2};
\end{tikzfadingfrompicture}
\begin{tikzpicture}
\node [opacity=0,scale=10,font=\bfseries\sffamily] (aux) {#2};
\path[path fading=letter,fit fading=false,#1]
(aux.south west) rectangle (aux.north east);
\end{tikzpicture}}
\textpattern{Hello}
\textpattern[pattern=bricks,pattern color=green]{world!}
\end{document}