我想画一些拼图块(盒子),然后在其中写入文字。类似下图。
我找不到可以获得这种形状的包,但是,我发布了一个具有矩形形状的最小示例。
\documentclass{report}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,shapes.geometric,positioning,patterns}
\usepackage{pgfplots}
\begin{document}
%
\begin{center}
\begin{tikzpicture}[ node distance=0 cm,outer sep = 0pt]
%
\tikzstyle{introStyle}=[rectangle,draw, minimum width=4 cm, minimum height=3.5cm, anchor=north west,fill=red!20]
\tikzstyle{lrStyle}=[rectangle,draw, minimum width=4 cm, minimum height=3.5cm, anchor=north west,fill=green!20]
\tikzstyle{methodStyle}=[rectangle,draw, minimum width=8 cm, minimum height=3.5cm, anchor=north west,fill=blue!20]
%
\node[introStyle] (intro) at (0,0) {
\parbox{3.5cm}{\color{red}%
\begin{itemize}
\item context
\item research problem
\item objectives
\end{itemize}
}
};
%
\node[lrStyle] (lr) [right = of intro] {
\parbox{3.5cm}{\color{green}%
\begin{itemize}
\item studies before 2000
\item studies after 2000
\end{itemize}
}
};
%
\node[methodStyle] (method) at (0,-3.5) {
\parbox{3.5cm}{\color{blue}%
\begin{itemize}
\item method
\item set up
\end{itemize}
}
};
%
%
\end{tikzpicture}
\end{center}
%
\end{document}
这是我的结果,但是,我想要的是拼图块而不是矩形。
评论后编辑
- 我想要获得两种不同尺寸的块,如下图所示(红色/绿色框和蓝色框)
- 就我而言,我只需要在红色和绿色盒子的底部有一个凹痕(凸起/凹口),以便它们嵌入蓝色盒子中。
答案1
您可以使用该jigsaw
包来创建这样的形状:
\documentclass{standalone}
\usepackage[svgnames]{xcolor}
\usepackage{jigsaw}
\begin{document}
\begin{tikzpicture}
\tiny
\sffamily
\begin{scope}
\color{blue!40!white}
\piece[blue!40!white]{-1}{-1}{0}{0}
\end{scope}
\begin{scope}[xshift=1cm]
\color{green!30!white}
\piece[green!30!white]{1}{1}{0}{1}
\end{scope}
\begin{scope}[xshift=2cm]
\color{green!30!white}
\piece[green!30!white]{0}{1}{0}{-1}
\end{scope}
\begin{scope}[xshift=3cm]
\color{orange}
\piece[orange]{-1}{0}{0}{-1}
\end{scope}
\begin{scope}[yshift=-1cm]
\color{green!50!black}
\piece[green!50!black]{0}{-1}{1}{0}
\end{scope}
\begin{scope}[xshift=1cm,yshift=-1cm]
\color{brown}
\piece[brown]{0}{0}{-1}{1}
\end{scope}
\begin{scope}[xshift=2cm,yshift=-1cm]
\color{blue}
\piece[blue]{0}{1}{0}{0}
\end{scope}
\begin{scope}[xshift=3cm,yshift=-1cm]
\color{blue!25!white}
\piece[blue!25!white]{0}{0}{1}{-1}
\end{scope}
\node at (0.5,0.5) {Abstract};
\node at (2,0.5) {Literature Review};
\node at (3.5,0.5) {Discussion};
\node at (0.5,-0.5) {\color{white}Introduction};
\node at (1.6,-0.5) {Methods};
\node at (2.4,-0.5) {\color{white}Results};
\node at (3.5,-0.5) {Conclusions};
\end{tikzpicture}
答案2
嗯,看完之后这和其他参考资料,我认为,这对我来说太难了。所以,我使用箭头和矩形修复了它...
\documentclass[12pt]{article}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,shapes.geometric,positioning,patterns,arrows.meta}
\begin{document}
\thispagestyle{empty}
\begin{center}
\begin{tikzpicture}[ node distance=0 cm,outer sep = 0pt,inner sep=0pt]
%
\def\x{0.4\textwidth}
\def\y{0.35\textwidth}
\tikzstyle{introStyle}=[rectangle, minimum width=\x, minimum height=\y, anchor=north west, fill=red!20]
\tikzstyle{lrStyle}=[rectangle, minimum width=\x, minimum height=\y, anchor=north west, fill=green!20]
\tikzstyle{methodStyle}=[rectangle, minimum width= 2*\x, minimum height=\y, anchor=north west, fill=blue!20]
\node[methodStyle] (method) at (0,-\y) { % plotting it first, in order to overlaid by other rectangle/arrows.
\parbox[c]{5cm}{%
\begin{itemize}
\item method
\item set up
\end{itemize}
}
};
%
\node[introStyle] (intro) at (0,0) {
\parbox[c]{4cm}{%
\begin{itemize}
\item context
\item research problem
\item objectives
\end{itemize}
}
};
\draw[-Triangle, line width=.22cm,red!20] (\x/2,-\y) - - (\x/2,-1.18*\y) ;
%
\node[lrStyle] (lr) [right = of intro] {
\parbox[c]{4cm}{%
\begin{itemize}
\item studies before 2000
\item objectives
\item
\end{itemize}
}
};
\draw[-Triangle, line width=.22cm,green!20] (1.5*\x,-\y) - - (1.5*\x,-1.18*\y) ;
% outer rectangle
\draw [densely dashed] (0,0) rectangle (2*\x,-2*\y);
%
%
\end{tikzpicture}
\end{center}
\end{document}
这是输出...
这与上面描述的并不完全一样,但考虑到所需的时间和精力,已经足够好了。希望对其他人也有用。