tikz 图表问题

tikz 图表问题

我想要创建下图中的图表 在此处输入图片描述

我有其上部的代码,但是我很难完成其余部分,如能提供任何帮助将不胜感激。

我的代码:-

\documentclass[11pt, oneside]{article}      % use "amsart" instead of "article" for AMSLaTeX format
\usepackage{geometry}                       % See geometry.pdf to learn the layout options. There are lots.
\geometry{letterpaper}                          % ... or a4paper or a5paper or ... 
\usepackage{graphicx}
\usepackage{tikz-cd}
\usetikzlibrary{decorations.markings}
\tikzset{middleArrowHead/.style={decoration={markings, mark= at position #1 with \arrow{>}}, postaction=decorate}}
\usepackage{braket} % defines \ket and \bra
\begin{document}
\begin{tikzcd}[every arrow/.append style={bend left, dash, middleArrowHead=1}] % change the last value until the arrow position pleases you.
\mathcal{B}^{'}
\arrow[start anchor={[yshift=1.5pt]east},end anchor={[yshift=2.5pt]west}]{r}{U^{-1}AU^{-1}} 
& \mathcal{C}^{'}
\arrow[start anchor={[yshift=-1.5pt]west},end anchor={[yshift=-2.5pt]east}]{l}{U^{-1}A^{-1}U}
\end{tikzcd}

\end{document}

答案1

今晚我心情很好,所以这里有一个完整的解决方案。通常我们会尝试让您完成大部分工作并尽可能接近解决方案,因为这是学习新技能的最佳方式,亲自尝试。以下是代码:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\tikzset{>={Straight Barb[length=4pt]}}

\begin{document}

\begin{tikzpicture}[scale=3]
% Nodes
\node (b0) at (0,0) {$\mathcal B$};
\node (c0) at (1,0) {$\mathcal C$};
\node (b1) at (0,1) {$\mathcal B'$};
\node (c1) at (1,1) {$\mathcal C'$};
% Arrows
\draw[->] (b1) to [out=40,in=140] node[above] {$U^{-1}AU$} (c1);
\draw[->] (c1) to [out=-140,in=-40] node[below] {$UA^{-1}U$} (b1);
\draw[->,dashed,red] (b0) to node[left,black] {$U^{-1}$?} (b1);
\draw[->,dashed,red] (c0) to node[right,black] {$U$?} (c1);
\end{tikzpicture}

\end{document}

结果如下:

在此处输入图片描述

我不太喜欢这个tikz-cd环境,我tikzpicture更喜欢它,因为它对于一般图表来说更加通用。也许其他人有更好的答案tikz-cd

答案2

以下是带有 的代码tikz-cd。我添加了一个带有 的解决方案pstricks

\documentclass{article}
\usepackage{pst-node}
\usepackage{auto-pst-pdf} \usepackage{tikz-cd}

\begin{document}
%
\[ \psset{arrows=->, arrowinset=0.12, linewidth=0.5pt, arcangle = 40, , nodesep=3pt, rowsep=1.2cm, colsep = 1.5cm, shortput =tablr}
  \everypsbox{\scriptstyle}
  \begin{psmatrix}
    \mathcal B' & \mathcal C'\\%
    \mathcal{B} & \mathcal{C} %
%%%%%% arrows%
 {\psset{nodesepA=2pt, nodesepB=1pt, labelsep=-2pt}
      \ncarc{1,1}{1,2}^{U^{-1}AU} \ncarc{1,2}{1,1}_{UA^{-1}U}}
    \psset{linestyle=dashed, dash=3pt 2pt, labelsep=2pt, linecolor=red}
    \ncline{2,2}{1,2}>[l]{u?}
    \ncline{2,1}{1,1}<[r]{u^{-1}?}
  \end{psmatrix}
\]

\[ \begin{tikzcd}[row sep=1.2cm, column sep=1.2cm, inner sep=10ex]
  \mathcal B' \rar[bend left, "U^{-1}AU"] & \mathcal C'\lar[bend left, "UA^{-1}U"] \\%
  \mathcal{B}\uar[dashed, draw=red, "u^{-1}?"] & \mathcal{C}\uar[dashed, draw=red, swap, "u?"] \end{tikzcd}
\]
\end{document} 

在此处输入图片描述

相关内容