在 Tikz 中用名字製作一個徽標

在 Tikz 中用名字製作一個徽標

我正在嘗試用乳膠製作一個小標誌。我畫了圖片(決策樹),我想在它旁邊添加一個文字。此外,我需要繪圖很小,其大小與旁邊的文字大小相同。

只是一張隨機圖片來顯示我想要的形狀:

在此輸入影像描述

來源

到目前為止,我製作了繪圖,並嘗試在其旁邊添加一些文字。不幸的是沒有結果。

\documentclass{scrartcl}
\usepackage[a4paper,margin=1cm,landscape]{geometry}
\usepackage{tikz}

%%%<
\usepackage{verbatim}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{5pt}%
%%%>

\usetikzlibrary{positioning,shadows,arrows}

\begin{document}

\begin{figure}
   \begin{minipage}[c]{7cm}
\begin{tikzpicture}[
    state/.style={circle, draw=none, fill=orange, circular drop shadow,
        text centered, anchor=north, text=white},
    leaf/.style={circle, draw=none, fill=red, circular drop shadow,
        text centered, anchor=north, text=white},
    level distance=0.5cm, growth parent anchor=south
]
\node (State00) [state] {$X$}
   child{ [sibling distance=3cm]
            node (State01) [state] {$f(x)_{1}$}
            child{
                child{ [sibling distance=2cm]
                    node (State02) [state] {$f(x)_{11}$}
                    child{
                        child{
                            node (State03) [leaf] {$\hat{y}_{1}$}
                        }
                    }
                    child{
                        child{ [sibling distance=2.0cm]
                            node (State04) [state] {$\hat{y}_{2}$}
                        }
                    }
                }
            }
            child{ [sibling distance=2cm]
                child{
                    node (State10) [state] {$f(x)_{12}$}
                    child{
                        child{
                            node (State11) [leaf] {$\hat{y}_{3}$}
                        }
                    }
                    child{
                        child{
                            node (State12) [state] {$\hat{y}_{4}$}
                        }
                    }
                }
            }
        }
;    
\end{tikzpicture}]
\end{minipage}%

\begin{minipage}[c]{\textwidth-7cm}
      Some text describing the image.
      Some text describing the image.
      Some text describing the image.
\end{minipage}

\end{figure}

\end{document}

輸出如下圖所示: 在此輸入影像描述

文本應採用以下形式:

\documentclass{article}
\pagestyle{empty}
\usepackage{xcolor}
\usepackage{bm}
\usepackage{setspace}

\begin{document}

\setstretch{0.5}

\begin{center}
Nam$\textcolor{orange}{\bm{{\hat{e}}}}$ of New \\
~\\
 Team
\end{center}

您能指出我的解決方案嗎?

編輯

在@Guilherme Zanotelli 的幫助下,我讓它發揮作用並設定了正確的比例。但是當我將其儲存為pdf時,徽標很小。

如何在保持比例不變的情況下讓它變大?

用更大的字體解決了

答案1

我不明白問題實際上是什麼,但我認為問題之一是讓Nam*ê* of New Team出現在決策樹的右側。

因此,以下是在 tikzpicture 中執行此操作的一種方法(不需要迷你頁)。

\documentclass{article}
\usepackage[a4paper,margin=1cm,landscape]{geometry}
\usepackage{tikz,pbox}
\usepackage{xcolor}
\usepackage{bm}
\usepackage{setspace}

%%%<
\usepackage{verbatim}
\usepackage[active,tightpage,floats]{preview}
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{5pt}%
%%%>

\usetikzlibrary{positioning,shadows,arrows}

\begin{document}
    \begin{figure}[h]
            \begin{tikzpicture}[
            state/.style={circle, draw=none, fill=orange, circular drop shadow,
                text centered, anchor=north, text=white},
            leaf/.style={circle, draw=none, fill=red, circular drop shadow,
                text centered, anchor=north, text=white},
            level distance=0.5cm, growth parent anchor=south
            ]
            \node (State00) [state] {$X$}
            child{ [sibling distance=3cm]
                node (State01) [state] {$f(x)_{1}$}
                child{
                    child{ [sibling distance=2cm]
                        node (State02) [state] {$f(x)_{11}$}
                        child{
                            child{
                                node (State03) [leaf] {$\hat{y}_{1}$}
                            }
                        }
                        child{
                            child{ [sibling distance=2.0cm]
                                node (State04) [state] {$\hat{y}_{2}$}
                            }
                        }
                    }
                }
                child{ [sibling distance=2cm]
                    child{
                        node (State10) [state] {$f(x)_{12}$}
                        child{
                            child{
                                node (State11) [leaf] {$\hat{y}_{3}$}
                            }
                        }
                        child{
                            child{
                                node (State12) [state] {$\hat{y}_{4}$}
                            }
                        }
                    }
                }
            };
        \node[right] at (current bounding box.east) {\pbox{\textwidth}{\relax\ifvmode\centering\fi Nam$\textcolor{orange}{\bm{{\hat{e}}}}$ of New \\
            ~\\
            Team}};
        \end{tikzpicture}
    \end{figure}
\end{document}

在此輸入影像描述

答案2

這是一個改編吉列爾梅·扎諾泰利的回答,使用森林,我相當喜歡它的字體。在我看來,它還使用了standalone更簡單的方法preview(但使用了preview,取決於配置)。

在標誌中,一個關鍵的決定是字體的選擇。雖然我不確定我會推薦什麼,因為這在很大程度上取決於上下文和受眾,但《電腦現代》不太可能是一個好的選擇。作為說明,我kpfonts在下面的範例中使用。

我還重點介紹如何為右側的文字選擇任意字體大小。第一個數字是磅值。第二個是基線跳躍。可縮放字體至關重要。預設情況下,您可能會獲得點陣圖 Computer Modern。一切都很好,但絕對不適合這裡。 (如果您需要 CM,請\usepackage[T1]{fontenc}單獨使用以確保獲得可擴展的版本。)

我增加了樹中的線條寬度,因為如果徽標使用小尺寸,您不希望線條消失。至少,我猜你不會。

標識

\documentclass[border=10pt,multi,tikz,border=5pt]{standalone}
\usepackage{forest,bm}
\usetikzlibrary{shadows}
\usepackage[T1]{fontenc}
\usepackage{kpfonts}
\begin{document}
\begin{forest}
  state/.style={fill=orange},
  leaf/.style={fill=red},
  for tree={
    text centered,
    child anchor=parent,
    text=white,
    circle,
    circular drop shadow,
    math content,
    state,
    font=\large,
    edge={line width=1pt},
  },
  for descendants={
    edge path'={(.child anchor) -- +(0,7.5mm) -- (!u.parent anchor)},
    l sep'=15mm,
  },
  l sep'=7.5mm,
  where n children=0{
    !u.s sep'=15mm,
  }{},
  [X
    [f(x)_{1}
      [f(x)_{11}
        [\hat{y}_{1}, leaf]
        [\hat{y}_{2}]
      ]
      [f(x)_{12}
        [\hat{y}_{3}, leaf]
        [\hat{y}_{4}]
      ]
    ]
  ]
  \node [right, align=center, font=\fontsize{50pt}{75pt}\selectfont] at (current bounding box.east) {Nam$\textcolor{orange}{\bm{{\hat{e}}}}$ of New\\Team};
\end{forest}
\end{document}

相關內容