名前入りのロゴを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

質問が実際に何であるかは理解していませんが、問題の 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

これはギリェルメ・ザノテッリの回答、私は Forest を使用していますが、私は Forest の方が好きではありません。 また、 も使用しておりstandalone、私の意見では、 よりも手間がかかりませんpreview(ただしpreview、設定によっては を使用します)。

ロゴでは、フォントの選択が重要な決定事項になります。状況や対象者に大きく左右されるため、何を推奨するかはわかりませんが、Computer Modern はおそらく良い選択ではありません。説明のためだけに、kpfonts以下の例で使用しています。

また、右側のテキストに任意のフォント サイズを選択する方法も示しました。最初の数字はポイント サイズです。2 番目はベースライン スキップです。スケーラブル フォントは重要です。デフォルトでは、ビットマップの 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}

関連情報