1

1

I randomly saw this and liked the look of it. I'm not really sure if this is Tikz? The graphs are quite small, and simple. I would like to add some graphs like this in a short report that I am writing. Anyone know what package this is?

Stefan Pinnow
  • 29,535
Marcel
  • 113

1 Answers1

3

Adapted from my answer to "Drawing tree-like symbols". Modify the length \RSu to change the size of the symbols.

enter image description here

\documentclass{article}
\usepackage{tikz}

\makeatletter \newcommand\RSloop{@ifnextchar\bgroup\RSloopa\RSloopb} \makeatother \newcommand\RSloopa[1]{\bgroup\RSloop#1\relax\egroup\RSloop} \newcommand\RSloopb[1]{% \ifx\relax#1% \else \ifcsname RS:#1\endcsname \csname RS:#1\endcsname \else \GenericError{(RS)}{RS Error: operator #1 undefined}{}{}% \fi \expandafter\RSloop \fi } \newcommand\X{0} \newcommand\RS[1]{% \begin{tikzpicture} [every node/.style= {circle,draw,fill,minimum size=1.5pt,inner sep=0pt,outer sep=0pt}, line cap=round ] \node[label=below:\tiny$2$] (0) {}; \node[label=below:\tiny$1$,xshift=-\RSu] (l) {}; \node[label=below:\tiny$3$,xshift=\RSu] (r) {}; \node[yshift=\RSu] (u) {}; \RSloop{#1}\relax \end{tikzpicture} } \newcommand\RSdef[1]{\expandafter\def\csname RS:#1\endcsname} \newlength\RSu \RSu=1ex \RSdef{l}{\draw (l) -- (u);} \RSdef{|}{\draw (0) -- (u);} \RSdef{r}{\draw (r) -- (u);} \RSdef{-}{\draw (l) -- (0);} \RSdef{+}{\draw (0) -- (r);} \begin{document}

\section*{The operators}

\begin{tabular}{ll} \texttt l = \RS l & \texttt r = \RS r \ \texttt - = \RS - & \texttt + = \RS + \ \multicolumn{1}{c}{ \texttt | = \RS |} \end{tabular}

\section*{Examples}

\RS{} \RS{l} \RS{|} \RS{l|} \RS{r} \RS{lr} \RS{|r} \RS{l|r}\ \RS{-} \RS{l-} \RS{-|} \RS{-r} \RS{lr-} \RS{-|r}\ \RS{-+} \RS{l-+} \RS{-|+} \RS{-+r} \RS{lr-+}

\end{document}

gernot
  • 49,614