4

I am trying to print a worksheet for the math class I'm teaching and I was wondering if anyone can specifically help me out in two areas.

a) How do I get the output BAL1L2 without the slant?

     $BAL_{1}L_{2}$ 

b) And is there is an easier code out there to create tree diagrams for probability?

guest
  • 125

2 Answers2

4

You can use \(\mathrm{BAL_{1}L_{2}\) to remove the slant.

The best tree-diagram program out there is pgf-tkiz, but you could also hack out something with dirtree.

More on probability trees with pgf at this link: Example: Probability tree

Some dirtree stuff here: (Semi-)automatic directory-tree in LaTeX

NictraSavios
  • 1,697
1

A recommended tree with 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}

enter image description here