我曾经xy-pic
画过一个图形模型,但奇怪的是,当我运行它时,左下角的圆圈总是标有一些随机的标记。它似乎标记了圆圈的中间。有人知道如何解决这个问题吗?会很有帮助!
多谢!
使用的代码示例如下:
\begin{figure}[H]
\centerline{ \xymatrix@C=6em@R=2.4em{
\xy*{\begin{array}{c}s_W,w_1 \\ U_W\end{array}}*\cir<20pt>{}*\cir<22pt>{}\endxy\ar@{<-}[r]|{all \: a} & \xy*{\begin{array}{c}s_B,w_1 \\ U_B\end{array}}*\cir<20pt>{}\endxy\ar@{->}[d]|{all \: a \neq a_1} \\
\xy*{\begin{array}{c}s_W,b_1 \\ U_W \end{array}}*\cir<20pt>{}\endxy\ar@{<->}[ur]|{all \: a \neq a_1}\ar@{<->}\ar@{->}[u]|{all \: a \neq a_1} & \xy*{\begin{array}{c}s_B,b_1 \\ U_B\end{array}}*\cir<20pt>{}\endxy\ar@{<->}[lu]|\hole \ar@{<-}\ar@{<-}[l]|{all \: a }
}}
\caption{Situation after product update with $a_1$'s draw}\label{fig:a1dpuu}
\end{figure}
答案1
你有多余的箭
....\ar@{<->}\ar@{->}[u]|{all \: a \neq a_1} & ....
以及
.... [lu]|\hole \ar@{<-}\ar@{<-}[l]|{all \: a }
删除它们之后我们得到
\documentclass{article}
\usepackage[all,cmtip]{xy}
\begin{document}
\begin{figure}[H]
\centerline{
\xymatrix@C=6em@R=2.4em{
\xy*{\begin{array}{c}s_W,w_1 \\ U_W\end{array}}*\cir<20pt>{}*\cir<22pt>{}\endxy\ar@{<-}[r]|{all \: a} & \xy*{\begin{array}{c}s_B,w_1 \\ U_B\end{array}}*\cir<20pt>{}\endxy\ar@{->}[d]|{all \: a \neq a_1} \\
\xy*{\begin{array}{c}s_W,b_1 \\ U_W \end{array}}*\cir<20pt>{}\endxy\ar@{<->}[ur]|{all \: a \neq a_1}\ar@{->}[u]|{all \: a \neq a_1} & \xy*{\begin{array}{c}s_B,b_1 \\ U_B\end{array}}*\cir<20pt>{}\endxy\ar@{<->}[lu]|\hole \ar@{<-}[l]|{all \: a }
}}
\caption{Situation after product update with $a_1$'s draw}\label{fig:a1dpuu}
\end{figure}
\end{document}
答案2
也许你想尝试更现代的包装tikz-cd这为您提供了更多的灵活性但更简单的语法:
% arara: pdflatex
\documentclass{article}
\usepackage{tikz-cd}
\usepackage{caption}
\usepackage{mathtools}
\begin{document}
\begin{figure}
\centering
\begin{tikzcd}[%
,cells={nodes={draw, circle, inner sep=-3.5pt}}
,column sep=1.5cm
,row sep=1.5cm
,every arrow/.append style={shorten <= 3pt, shorten >= 3pt}
]
\tikz{\node[draw, circle]{$\begin{array}{c}s_W,w_1 \\ U_W\end{array}$}} \arrow[<->]{dr} & \begin{array}{c}s_B,w_1 \\ U_B\end{array} \arrow{l}[description]{\text{all }a} \arrow{d}[description]{\text{all }a\ne a_1} \arrow[<->]{dl}[description]{\text{all }a\ne a_1}\\
\begin{array}{c}s_W,b_1 \\ U_W \end{array} \arrow{u}[description, yshift=2pt]{\text{all }a\ne a_1} \arrow{r}[description]{\text{all }a} & \begin{array}{c}s_B,b_1 \\ U_B\end{array}
\end{tikzcd}
\caption{Situation after product update with $a_1$'s draw}\label{fig:a1dpuu}
\end{figure}
\end{document}