我正在尝试打印一份我所教的数学课的工作表,我想知道是否有人可以在两个方面具体帮助我。
a) 如何获得不带倾斜的输出 BAL1L2?
$BAL_{1}L_{2}$
b) 有没有更简单的代码来创建概率树状图?
答案1
您可以使用\(\mathrm{BAL_{1}L_{2}\)
来消除倾斜。
目前最好的树形图程序是pgf-tkiz
,但你也可以用dirtree
。
有关 pgf 概率树的更多信息,请访问以下链接:例子:概率树
这里有一些 dirtree 的内容:LaTeX 中的(半)自动目录树
答案2
推荐使用 PSTricks 的树。
\documentclass[preview,border=12pt]{standalone}
\usepackage{pst-tree}
\psset{treemode=R,edge=\ncline}
\def\ABCD{%
\psTree{\Tcircle{A}}
\psTree{\Tcircle{B}}
\pstree[edge={\ncline[linecolor=red]}]{\Tcircle{C}}{\Tcircle{D}}\taput{\tiny an example}
\pstree{\Tcircle{D}}{\Tcircle{C}}
\endpsTree
\psTree{\Tcircle{C}}
\pstree{\Tcircle{B}}{\Tcircle{D}}
\pstree{\Tcircle{D}}{\Tcircle{B}}
\endpsTree
\psTree{\Tcircle{D}}
\pstree{\Tcircle{B}}{\Tcircle{C}}
\pstree{\Tcircle{C}}{\Tcircle{B}}
\endpsTree
\endpsTree
}
\def\BACD{%
\psTree{\Tcircle{B}}
\psTree{\Tcircle{A}}
\pstree{\Tcircle{C}}{\Tcircle{D}}
\pstree{\Tcircle{D}}{\Tcircle{C}}
\endpsTree
\psTree{\Tcircle{C}}
\pstree{\Tcircle{A}}{\Tcircle{D}}
\pstree{\Tcircle{D}}{\Tcircle{A}}
\endpsTree
\psTree{\Tcircle{D}}
\pstree{\Tcircle{A}}{\Tcircle{C}}
\pstree{\Tcircle{C}}{\Tcircle{A}}
\endpsTree
\endpsTree
}
\def\CABD{%
\psTree{\Tcircle{C}}
\psTree{\Tcircle{A}}
\pstree{\Tcircle{B}}{\Tcircle{D}}
\pstree{\Tcircle{D}}{\Tcircle{B}}
\endpsTree
\psTree{\Tcircle{B}}
\pstree{\Tcircle{A}}{\Tcircle{D}}
\pstree{\Tcircle{D}}{\Tcircle{A}}
\endpsTree
\psTree{\Tcircle{D}}
\pstree{\Tcircle{A}}{\Tcircle{B}}
\pstree{\Tcircle{B}}{\Tcircle{A}}
\endpsTree
\endpsTree
}
\def\DABC{%
\psTree{\Tcircle{D}}
\psTree{\Tcircle{A}}
\pstree{\Tcircle{B}}{\Tcircle{C}}
\pstree{\Tcircle{C}}{\Tcircle{B}}
\endpsTree
\psTree{\Tcircle{B}}
\pstree{\Tcircle{A}}{\Tcircle{C}}
\pstree{\Tcircle{C}}{\Tcircle{A}}
\endpsTree
\psTree{\Tcircle{C}}
\pstree{\Tcircle{A}}{\Tcircle{B}}
\pstree{\Tcircle{B}}{\Tcircle{A}}
\endpsTree
\endpsTree
}
\begin{document}
\psTree[thislevelsep=0]{\Tn}
\ABCD
\BACD
\CABD
\DABC
\endpsTree
\end{document}