![带框的 tikz 图](https://linux22.com/image/451218/%E5%B8%A6%E6%A1%86%E7%9A%84%20tikz%20%E5%9B%BE.png)
我只是想创建这样的东西,我尝试了这样的东西:
\documentclass{beamer}
%layout
\mode<presentation>{
\usetheme{Madrid}
}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\begin{frame}
\frametitle{Diagramm}
\begin{tikzpicture}
\begin{axis}[xmax=6,ymax=1]
\addplot [fill=red] coordinates
{(0,1) (2,1)}
\closedcycle;
\addplot [fill=green] coordinates
{(3,1) (6,1)}
\closedcycle;
\end{axis}
\end{tikzpicture}
\end{frame}
\end{document}
答案1
试试这个代码:
\documentclass{beamer}
%layout
\mode<presentation>{
\usetheme{Madrid}
}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\begin{frame}
\frametitle{Diagramm}
\begin{tikzpicture}[scale=2]
\filldraw[green] (1,0) rectangle (2,1);
\node[text width=2cm] at (1.5,0.5) () {\bfseries \footnotesize Damit\\ beschatungen mir aus};
\filldraw[red] (3,0) rectangle (5.5,1);
\node at (4.25,0.5) () {\bfseries NP};
\draw[line width=3,-latex] (1,0)--(5.5,0);
\foreach \x in {1,...,5}
\draw (\x,0.1)--(\x,-.1) node[below] {\x};
\node at (3,-.5) () {\bfseries \footnotesize Maximale Anzahl von Literalen in jeder Klausel}
\end{tikzpicture}
\end{frame}
\end{document}
输出: