sagemath 提供的 Latex 所需软件包

sagemath 提供的 Latex 所需软件包

我正在尝试使用以下命令导出 sagemath 图表:

sage: M = Matrix ([ [0, 1, 1], [1, 0, 1], [1, 1, 0] ])
sage:  # (the order is the number of edges)
sage: G = Graph(M); G.order()
sage: G.show();
sage: latex.engine();
sage: latex(G);

我的输出是:

\begin{tikzpicture}
%
\useasboundingbox (0,0) rectangle (5.0cm,5.0cm);
%
\definecolor{cv0}{rgb}{0.0,0.0,0.0}
\definecolor{cfv0}{rgb}{1.0,1.0,1.0}
\definecolor{clv0}{rgb}{0.0,0.0,0.0}
\definecolor{cv1}{rgb}{0.0,0.0,0.0}
\definecolor{cfv1}{rgb}{1.0,1.0,1.0}
\definecolor{clv1}{rgb}{0.0,0.0,0.0}
\definecolor{cv2}{rgb}{0.0,0.0,0.0}
\definecolor{cfv2}{rgb}{1.0,1.0,1.0}
\definecolor{clv2}{rgb}{0.0,0.0,0.0}
\definecolor{cv0v1}{rgb}{0.0,0.0,0.0}
\definecolor{cv0v2}{rgb}{0.0,0.0,0.0}
\definecolor{cv1v2}{rgb}{0.0,0.0,0.0}
%
\Vertex[style={minimum
size=1.0cm,draw=cv0,fill=cfv0,text=clv0,shape=circle},LabelOut=false,L=\\
hbox{$0$},x=3.6292cm,y=0.0cm]{v0}
\Vertex[style={minimum
size=1.0cm,draw=cv1,fill=cfv1,text=clv1,shape=circle},LabelOut=false,L=\\
hbox{$1$},x=5.0cm,y=5.0cm]{v1}
\Vertex[style={minimum
size=1.0cm,draw=cv2,fill=cfv2,text=clv2,shape=circle},LabelOut=false,L=\\
hbox{$2$},x=0.0cm,y=3.6915cm]{v2}
%
\Edge[lw=0.1cm,style={color=cv0v1,},](v0)(v1)
\Edge[lw=0.1cm,style={color=cv0v2,},](v0)(v2)
\Edge[lw=0.1cm,style={color=cv1v2,},](v1)(v2)
%
\end{tikzpicture}

但我肯定缺少一些可以导入 TeXstudio 的包,因为它无法识别\useasboundingbox\definecolor\Vertex\Edge

我必须使用什么包?

答案1

您需要的包是tkz-图

来自圣人文档

要在 Sage 中使用 LaTeX,您当然需要安装一个可以运行的 TeX,如果您有dvipngconvert实用程序,效果会更好。对于图形,您需要tkz-graph 包的tkz-graph.stytkz-berge.sty样式文件。TeX、dvipng 和 convert 应该可以通过包管理器或安装程序广泛使用。您可能需要在适当的位置安装 tkz-graph 样式文件,这项任务超出了本介绍的范围。

相关内容