如何在LaTex中繪製簡單的二分類圖表?

如何在LaTex中繪製簡單的二分類圖表?

我需要以乳膠格式繪製以下圖表。目前我把它當作圖像。需要一些專家的幫助來以最簡單的方式做到這一點。

在此輸入影像描述

-------更新----------------------------------------- 根據評論中給定的連結我將創建這樣的樹,我如何可以像給定圖像一樣格式化該文字並將兩棵樹並排放置在同一參考中?

    \begin{tikzpicture}[level distance=1.5cm,
  level 1/.style={sibling distance=3cm},
  level 2/.style={sibling distance=1.5cm}]
  \node {Cryptography}
    child {node {cryptos}
      child {node {hidden}}
    }
    child {node {graphia}
    child {node {writing}}
    };
\end{tikzpicture}

在此輸入影像描述

答案1

你最好的選擇是使用 TikZ,但這可以工作並且不使用額外的包:

\documentclass[12pt]{article}
\begin{document}
\begin{center}
  \begin{tabular}{ccc}
    \Large Cryptography&\qquad&\Large Stenography\\[1ex]
    \Large$\swarrow\qquad\searrow$&&\Large$\swarrow\qquad\searrow$\\[1ex]
    \textit{cryptos}\qquad\textit{graphia}&&\textit{steganos}\qquad\textit{graphia}\\[1ex]
    \Large$\downarrow$\qquad\qquad$\downarrow$&&\Large$\downarrow$\qquad\qquad$\downarrow$\\[1ex]
    hidden\qquad writing&&covered\qquad writing
  \end{tabular}
\end{center}
\end{document}

答案2

您可以使用font鍵設定字體樣式和大小。

這是一個使用以下解決方案TikZ

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{trees}
\begin{document}
\begin{tikzpicture}[
        ->,
        font = \Large,
        level distance = 1.5cm,
        level 1/.style={
            font = \normalfont\sl,
            sibling distance = 3cm
        },
        level 2/.style = {
            font = \normalfont\large,
            sibling distance = 1.5cm
        }
    ]
    \node {Cryptography}
        child {node {cryptos}
            child {node {hidden}}
        }
        child {node {graphia}
            child {node {writing}}
        };
    \node[xshift = 5cm] {Steganography}
        child {node {steganos}
            child {node {covered}}
        }
        child {node {graphia}
            child {node {writing}}
        };
\end{tikzpicture}
\end{document}

樹

相關內容