我正在尝试绘制附图中的图表,但我的命令中缺少某些东西,我无法将这些框按图片中的正确顺序排列,我还尝试在两个方向上绘制箭头,例如从 a 到 b 和从 b 到 a,但编译后仍然只显示一种方向。这是我尝试的方法。
\documentclass{beamer}
%\usecolortheme{whale}
%\documentclass[handout,mathserif]{beamer}
\usepackage{pgfplots}
%\usecolortheme{whale}
%\usecolortheme{beaver}
\usetikzlibrary{positioning}
\usetikzlibrary{fit}
\usetikzlibrary{backgrounds}
\usetikzlibrary{calc}
\usetikzlibrary{shapes}
\usetikzlibrary{mindmap}
\usetikzlibrary{decorations.text}
\pgfplotsset{compat=1.7}
\definecolor{mygreen}{rgb}{.125,.5,.25}
\usetheme{Boadilla}
%\usepackage{beamerthemeDresden}
\usecolortheme{seagull}
%\usetheme{Madrid}
%\usetheme{Warsaw}
\usepackage{cite}
\usepackage{listings}
\usepackage{mathrsfs }
\usepackage{caption}
\usepackage{subcaption}
\usepackage{tabularx}
\usepackage{xparse}
\usepackage{sectsty}
%\usepackage[ut8]{inputenc}
\usepackage{extarrows}
\usepackage{amsmath,amsthm,amssymb,graphics}
\usepackage[english]{babel}
\setbeamercolor{normal text}{fg=black}
\setbeamercolor{progress bar}{use=palette primary,fg=primary}
\usepackage{geometry}
\usepackage{xspace}
%\usepackage{polyglossia}
\usepackage{tikz}
%\usepackage{natbib}
\usepackage{bibentry}
\usepackage{lmodern}
\usepackage{booktabs} % Allows the use of \toprule,
\usepackage{media9}
\definecolor{RoyalRed}{RGB}{157,16, 45}
\definecolor{mynicegreen}{rgb}{102,252,102}
\definecolor{darkgreen}{rgb}{0,0.5,0}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
%\usetheme{upb}
\setbeamerfont{block title}{size={}}
\setbeamercovered{transparent}
\usepackage{ragged2e} % besseren Umbruch
\usepackage{booktabs} % spezielle Tabellen zulassen
\usepackage{textpos}
\setbeamertemplate{blocks}[rounded][shadow=true]
\setbeamercolor*{title}{use=structure,fg=white,bg=structure.fg,}
\setbeamertemplate{title page}[default][colsep=-5bp,rounded=true,shadow=true]
%Information to be included in the title page:
\usecolortheme[rgb={0.7,0.2,0.2}]{structure}
\beamertemplateshadingbackground{red!70}{yellow!85}
\mode<article>{
\usepackage{fullpage}
\usepackage[bookmarks=false]{hyperref}
}
\mode<presentation>{
\usetheme{Darmstadt}
}
\tikzset{block/.style={draw, thick, text width=1.8cm ,minimum height=1.5cm, align=center},
line/.style={-latex}
}
\begin{document}
\begin{frame}
\begin{tikzpicture}
\node[block] (a) {A};
\node[block,right=of a] (b) {B};
\node[block,right=of b, fill=blue] (c) {Algebre\\von\\Neumann};
\node[block,right=of a,fill=yellow] (b) {C*algebre\\ne\\comutative};
%\node[block,right=of d] (w) {W};
%\node[block,right=of e] (x) {X};
\node[block,fill=red] (f) at ([yshift=-2.5cm]$(b)!1!(c)$) {C*algebre\\ne-\\comutative};
\node[block,right=of c,fill=yellow] (g)at ([yshift=-3.5cm]$(d)!1!(e)$) {G};
\node[block,,right=of d,fill=red] (k) at ([yshift=-3.5cm]$(d)!1!(e)$) {C*algebre\\ne-\\comutative};
\node[block,,right=of k,fill=red] (l) at ([yshift=-3.5cm]$(d)!1!(e)$) {C*algebre\\ne-\\comutative};
\node[block,,right=of d,fill=red] (m) at ([yshift=-3.5cm]$(e)!1!(f)$) {C*algebre\\ne-\\comutative};
% the commands used for the different location of different blocks
%\node[block,fill=red] (b) at ([yshift=-4.5cm]$(b)!1!(c)$) {C*algebre\\ne-\\comutative};
%\node[block,fill=red] (d) at ([yshift=-4.5cm]$(d)!1!(c)$) {C*algebre\\ne-\\comutative};
%\node[block,fill=orange] (c) at ([yshift=-4.5cm]$(c)!1!(d)$) {von\\Neumann};
%\node[block,fill=orange] (h) at ([yshift=-4.5cm]$(h)!1!(f)$) {von\\ Neumann};
\node[block,fill=pink] (e) at ([yshift=-3.8cm]$(c)!1!(d)$) {$L^{\infty}(Y)$};
%\node[block] (g) at ([yshift=2cm]$(c)!0.5!(d)$) {G};
%$\node[block] (h) at ([yshift=2cm]$(g)!1.0!(g)$) {H};
\draw[line] (a)-- (b);
\draw[line] (b)-- (a);
%\draw[line] (c)-- (d);
%\draw[line] (a)-- (e);
%\draw[line] (g)-- (h);
%\draw[line] (d)-- (f);
%\draw[line] (e)-- (g);
%\draw[line] (f)-- (h);
%\draw[line] (a.east) -- (e.west);
%\draw[line] (h)-- (b);
%\draw[line] (e.west) -- (a.east);
\node[draw,inner xsep=6mm,inner ysep=10mm,fit=(a),fill=green,label={90:$\mathcal{B}(H)$}](g){};
\node[draw,inner xsep=2mm,inner ysep=2mm,fill=red,fit=(a)](g){};
%\node[draw,inner xsep=4.5mm,inner ysep=4.55mm,fill=white,fit=(b)](g){};
%\node[draw,inner xsep=2.5mm,inner ysep=2.5mm,fit=(d)](g){};
%\node[draw,inner xsep=2.5mm,inner ysep=2.5mm,fill=blue,fit=(b)](g){};
%\node[draw,inner xsep=2.5mm,inner ysep=2.5mm,fill=blue,fit=(a)](g){};
%\node[draw,inner xsep=2.5mm,inner ysep=2.5mm,fit=(d)](g){};
\end{tikzpicture}
\end{frame}
\end{document}
附图是我想在 Beamer 中绘制的图表。如能提供任何帮助,我将不胜感激。
答案1
起点:
附注:我删除了大部分前言代码,因为它与 tizzpicture 内部块的放置完全无关。您可能也需要花一些时间来清理前言。文档中有很多不需要的包beamer
(graphicx
,...),以及一些冲突/矛盾的代码行,尤其是关于您的 beamer 主题。我没有在回答中解决这些问题。
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{positioning, fit}
\tikzset{block/.style={draw, thick, text width=1.8cm ,minimum height=1.5cm, align=center},
line/.style={-latex}
}
\begin{document}
\begin{frame}
\begin{tikzpicture}
\node[block] (a) {};
\node[draw,inner xsep=6mm,inner ysep=6mm,fit=(a),fill=green,label={90:$\mathcal{B}(H)$}](l-greenblock){};
\node[draw,fill=red,fit=(a)](l-redblock){};
\node[block,below=of l-redblock, fill=red] (l-c*algeb) {C*algebre\\ne-\\comutative};
\node[block,below=of l-c*algeb, fill=blue] (l-neumann) {Algebre\\von\\Neumann};
\draw[<->] (l-redblock)-- (l-c*algeb);
\draw[->] (l-neumann)-- (l-c*algeb);
\node[block, right= 2.5cm of a, label={90:$C(x)$}] (r-emptyblock) {};
\node[block,right=of r-emptyblock, fill=red] (r-c*algeb) {C*algebre\\ne-\\comutative};
\node[block,below=of r-c*algeb, fill=blue] (r-neumann) {Algebre\\von\\Neumann};
\node[block,below=of r-neumann, fill=pink] (r-infty) {$L^{\infty}(Y)$};
\draw[<->] (r-emptyblock)-- (r-c*algeb);
\draw[->] (r-neumann)-- (r-c*algeb);
\draw[<->] (r-neumann)-- (r-infty);
\end{tikzpicture}
\end{frame}
\end{document}
答案2
作为对 @leandriis 的回答的补充 (+1)。他的解决方案添加了 Ti钾Z 库backgrounds
和chains
,箭头所指的库是使用的arrows.meta
库,fit
库所放置的节点位于背景层上:
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
backgrounds,
chains,
fit,
positioning}
\tikzset{
node distance = 7mm and 11mm,
start chain = going below,
box/.style = {draw, thick, fill=#1,
text width=6.4em, minimum height=15mm,
align=center},
> = {Latex},
FIT/.style = {draw, inner sep=2mm, fill=green, fit=#1}
}% end of tikzset
\begin{document}
\begin{frame}
\centering
\begin{tikzpicture}
%% left branch
\begin{scope}[nodes={box,on chain}]
\node (a) [box=orange] {};
\node (b) [box=orange] {C*algebre noncomutative};
\node (c) [box=blue!30] {Algebre von Neumann};
\end{scope}
\scoped[on background layer]
\node[FIT=(a), label=$\mathcal{B}(H)$] {};
% connections
\draw[<->] (a) -- (b);
\draw[->] (c) -- (b);
%% right branch
\node (d) [box=white, right=of a, label=$C(x)$] {};
\begin{scope}[nodes={box,on chain}]
\node (e) [box=orange,right=of d] {C*algebre noncomutative};
\node (f) [box=blue!30] {Algebre von Neumann};
\node (g) [box=pink] {$L^{\infty}(Y)$};
\end{scope}
% connections
\draw[<->] (g) -- (f);
\draw[->] (f) -- (e);
\draw[<->] (e) -- (d);
\end{tikzpicture}
\end{frame}
\end{document}