Есть ли способ легко создать такую ​​диаграмму в Latex?

Есть ли способ легко создать такую ​​диаграмму в Latex?

Я пытаюсь создать диаграмму в Latex, но она слишком сложна для моего уровня опыта Tikz. Есть ли способ легко воссоздать эту диаграмму? Или есть какие-либо советы о том, что мне следует сделать? Спасибо за любую помощь, которую вы можете оказать!

Изображение, которое я пытаюсь воссоздать

решение1

У вас могут возникнуть проблемы с размещением этого элемента на странице, поскольку он слишком широкий, но вот решение с forest.

введите описание изображения здесь

\documentclass{article}

\usepackage{forest}
\tikzset{circ/.style={label={[draw, circle, red, minimum size=2.5ex, inner sep=0pt]left:#1}}}

\begin{document}

\begin{forest}
for tree={math content, l*=.3, anchor=center, font=\footnotesize,
    if level>=2{l sep=1mm, if level>=3{no edge}{}}{l sep=2cm},
    s sep=4mm}
[{(A,B,C)}
    [\emptyset[\emptyset, circ=1]]
    [(A)[\{(A)\}, circ=2]]
    [(B)[\{(B)\}, circ=3]]
    [(C)[\{(C)\}, circ=4]]
    [{(A,B)}[{\{(A),(B)\}}, circ=5[{\{(A,B)\}}, circ=6]]]
    [{(A,C)}[{\{(A),(C)\}}, circ=7[{\{(A,C)\}}, circ=8]]]
    [{(B,C)}[{\{(B),(C)\}}, circ=9[{\{(B,C)\}}, circ=10]]]
    [{(A,B,C)}
        [{\{(A),(B),(C)\}}, circ=11[{\{(A,B),(C)\}}, circ=12[{\{(A,C),(B)\}}, circ=13[{\{(B,C),(A)\}}, circ=14[{\{(A,B,C)\}}, circ=15]]]]]]
]
\end{forest}

\end{document}

решение2

Прошло много времени с тех пор, как я использовал TikZ без геометрии. Вот классическое решение (Sandy'answer идеален) У меня только проблема, возможно, лучше выровнять 10,11,12 и т.д. Я использовал стиль Sandy

Обновление с выравниванием красных цифр

\documentclass[a4paper,10pt,landscape]{article}
\usepackage{tikz}
\tikzset{circ/.style={label={[draw, circle, red, minimum size=2.5ex, inner sep=0pt]left:#1}}}
\begin{document} 
\begin{tikzpicture} [font=\footnotesize,
grow=south, level 1/.style={sibling distance=6em, level distance=5cm},
level 2/.style={ level distance=2cm},
level 3/.style={ level distance=1.5em},
level 4/.style={ level distance=1.5em},
level 5/.style={ level distance=1.5em},
level 6/.style={ level distance=1.5em}]
\node {(A,B,C)} % root
    child { node {$\emptyset$}
      child { node[circ=1] {$\emptyset$}}
    }
    child { node {(A)}
      child { node[circ=2] {\{(A)\}}}
    }
    child { node {(B)}
      child { node[circ=3] {\{(B)\}}}
    }
    child { node {(C)}
      child { node[circ=4] {\{(C)\}}}
    }
    child { node {(A,B)}
      child {   node[circ=5,minimum width=1.5cm] {\{(A),(B)\}} 
        child { node[circ=6,minimum width=1.5cm] {\{(A,B)\}}}}
    }
    child { node {(A,C)}
      child { node[circ=7,minimum width=1.5cm] {\{(A),(C)\}} 
        child {node[circ=8,minimum width=1.5cm] {\{(A,C)\} }}}
    }
    child { node {(B,C)}
      child { node[circ=9,minimum width=1.5cm] {\{(B),(C)\}} 
        child {node[circ=10,minimum width=1.5cm] {\{(B,C)\}}}}
    }
    child { node {(A,B,C)}
      child { node[circ=11,minimum width=2cm] {\{(A),(B),(C)\}} 
        child {node[circ=12,minimum width=2cm] {\{(A,B),(C)\}}  
         child {node[circ=13,minimum width=2cm] {\{(A,C),(B)\}} 
           child {node[circ=14,minimum width=2cm] {\{(B,C),(A)\}} 
             child {node[circ=15,minimum width=2cm] {\{(A,B,C)\}}}}}}}
};

\end{tikzpicture}
\end{document}

введите описание изображения здесь

решение3

Я рекомендую использоватьМатча. Там вы можете рисовать, выбрав опцию «Вставить диаграмму» и выбрав опцию «Область рисования», чтобы отобразить область рисования с правой стороны. Я делюсь кодом, который похож на вашу диаграмму. Вы можете экспортировать свою работу как изображение или в формате TikZ, используя эту платформу. Я рекомендую выбрать опцию TikZ для лучшего качества.

\documentclass{article}

\usepackage{tikz}

\begin{document}

\tikzset{every picture/.style={line width=0.75pt}} %set default line width to 0.75pt        

\begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1]
%uncomment if require: \path (0,296); %set diagram left start at 0, and has height of 296

%Straight Lines [id:da842538810449589] 
\draw    (381.88,44.88) -- (353.08,112.48) ;
%Straight Lines [id:da7257564806335599] 
\draw    (434.88,130.36) -- (434.88,179.56) ;
%Straight Lines [id:da20949947181562223] 
\draw    (349.88,130.36) -- (349.88,179.56) ;
%Straight Lines [id:da2593651135736319] 
\draw    (518.68,130.16) -- (518.68,179.36) ;
%Straight Lines [id:da7741353868078296] 
\draw    (281.88,131.36) -- (281.88,180.56) ;
%Straight Lines [id:da9720425366631544] 
\draw    (227.88,130.96) -- (227.88,180.16) ;
%Straight Lines [id:da581739553085237] 
\draw    (173.88,131.36) -- (173.88,180.56) ;
%Straight Lines [id:da8464131628402256] 
\draw    (120.68,130.56) -- (120.68,179.76) ;
%Straight Lines [id:da058139682734349885] 
\draw    (614.48,129.76) -- (614.48,178.96) ;
%Straight Lines [id:da4017264009317001] 
\draw    (177.4,111.13) -- (356.28,44.88) ;
%Straight Lines [id:da7610123999802281] 
\draw    (229.72,110.88) -- (365.88,44.88) ;
%Straight Lines [id:da2905799653222627] 
\draw    (123.32,112.48) -- (352.6,40.67) ;
%Straight Lines [id:da9847257278990789] 
\draw    (283.88,110.08) -- (374.68,44.88) ;
%Straight Lines [id:da09133555586008946] 
\draw    (389.48,44.88) -- (435.48,110.88) ;
%Straight Lines [id:da06694033598480398] 
\draw    (397.88,44.48) -- (518.33,110.53) ;
%Straight Lines [id:da5575718778158445] 
\draw    (408.28,43.68) -- (612.68,110.48) ;

% Text Node
\draw (351.4,24.4) node [anchor=north west][inner sep=0.75pt]    {$( A,B,C)$};
% Text Node
\draw (269.87,112.2) node [anchor=north west][inner sep=0.75pt]    {$( C)$};
% Text Node
\draw (329.67,112.07) node [anchor=north west][inner sep=0.75pt]    {$( A,B)$};
% Text Node
\draw (413.2,112.2) node [anchor=north west][inner sep=0.75pt]    {$( A,C)$};
% Text Node
\draw (262.48,182.68) node [anchor=north west][inner sep=0.75pt]    {$\{( C)\}$};
% Text Node
\draw (316.48,182.28) node [anchor=north west][inner sep=0.75pt]    {$\{( A) ,( B)\}$};
% Text Node
\draw (317.28,202.08) node [anchor=north west][inner sep=0.75pt]    {$\{( A,B)\}$};
% Text Node
\draw (400.68,182.68) node [anchor=north west][inner sep=0.75pt]    {$\{( A) ,( C)\}$};
% Text Node
\draw (401.08,202.28) node [anchor=north west][inner sep=0.75pt]    {$\{( A,C)\}$};
% Text Node
\draw (498.47,111.87) node [anchor=north west][inner sep=0.75pt]    {$( B,C)$};
% Text Node
\draw (485.28,182.08) node [anchor=north west][inner sep=0.75pt]    {$\{( B) ,( C)\}$};
% Text Node
\draw (485.08,201.88) node [anchor=north west][inner sep=0.75pt]    {$\{( B,C)\}$};
% Text Node
\draw (215.87,111.8) node [anchor=north west][inner sep=0.75pt]    {$( B)$};
% Text Node
\draw (208.48,182.28) node [anchor=north west][inner sep=0.75pt]    {$\{( B)\}$};
% Text Node
\draw (161.87,112.2) node [anchor=north west][inner sep=0.75pt]    {$( A)$};
% Text Node
\draw (154.48,182.68) node [anchor=north west][inner sep=0.75pt]    {$\{( A)\}$};
% Text Node
\draw (114.27,111.8) node [anchor=north west][inner sep=0.75pt]    {$\emptyset $};
% Text Node
\draw (113.87,182.2) node [anchor=north west][inner sep=0.75pt]    {$\emptyset $};
% Text Node
\draw (581.2,111) node [anchor=north west][inner sep=0.75pt]    {$( A,B,C)$};
% Text Node
\draw (568.68,181.48) node [anchor=north west][inner sep=0.75pt]    {$\{( A) ,( B) ,( C)\}$};
% Text Node
\draw (569.08,202.08) node [anchor=north west][inner sep=0.75pt]    {$\{( A,B) ,( C)\}$};
% Text Node
\draw (569.08,221.88) node [anchor=north west][inner sep=0.75pt]    {$\{( A,C) ,( B)\}$};
% Text Node
\draw (568.88,241.88) node [anchor=north west][inner sep=0.75pt]    {$\{( B,C) ,( A)\}$};
% Text Node
\draw (569.21,261.81) node [anchor=north west][inner sep=0.75pt]    {$\{( A,B,C)\}$};
% Text Node
\draw (32,174.33) node [anchor=north west][inner sep=0.75pt]   [align=left] {\begin{minipage}[lt]{44.12pt}\setlength\topsep{0pt}
\begin{center}
Possible \\Groups
\end{center}

\end{minipage}};
% Text Node
\draw (14.67,100) node [anchor=north west][inner sep=0.75pt]   [align=left] {\begin{minipage}[lt]{58.85pt}\setlength\topsep{0pt}
\begin{center}
Participating\\Schools
\end{center}

\end{minipage}};
% Text Node
\draw (206.07,16.4) node [anchor=north west][inner sep=0.75pt]   [align=left] {\begin{minipage}[lt]{49.78pt}\setlength\topsep{0pt}
\begin{center}
Schools in\\District
\end{center}

\end{minipage}};

\end{tikzpicture}
\end{document}

При использовании приведенного выше кода вы получите следующий результат.

введите описание изображения здесь

Связанный контент