0

How to make the below arrows in latex

enter image description here

The suggested duplicate is a vertical tree and I don't need that I just need a horizontal two arrows

  • Welcome to TeX SX! What does this have to do with biblatex? – Bernard Dec 07 '17 at 22:44
  • I did not know which one show i tag, that is all – Marwah Soliman Dec 07 '17 at 22:48
  • 2
    Welcome to TeX.SX. Please read the introductory material for this site. When you post a question, you are expected to provide a "Minimal Working Example" (MWE) that starts with \documentclass, includes all relevant \usepackage commands, ends with \end{document} and compiles without errors, even if it does not produce your desired output. – Sandy G Dec 07 '17 at 22:48
  • @Bernard can you tell me which should I tag, and I will edit – Marwah Soliman Dec 07 '17 at 22:49
  • I suggest you start by learning the very basics of TikZ. There are many online resources; try Google. Your question can be solved using the \node command. Undoubtedly someone will soon post a complete solution, but in the future it's much better for you and the site if you make an effort to solve as much of the problem yourself as possible. – Sandy G Dec 07 '17 at 22:53
  • There are plenty of examples of horizontal trees. You only have to change the direction of growth. Why don't you look at the documentation before assuming that the solutions there don't meet your needs? Or at any of the many, many trees on this site already? You can't possibly have looked at the documentation for the packages suggested there in the all of 30 seconds which you spent before rejecting the suggestions. (I linked those because of the emphasis in the question in simplicity, but there are plenty of alternative models around.) – cfr Dec 07 '17 at 23:20
  • Links on the right of that question include horizontal trees e.g. https://tex.stackexchange.com/questions/295330/write-trees-in-latex?noredirect=1&lq=1. However, if this is all you need, just draw the nodes with TikZ or, don't bother with TikZ, which is probably overkill in that case, too. – cfr Dec 07 '17 at 23:23

3 Answers3

1

You can use this as a starting point.

enter image description here

Adjust text size and type as you see fit. Read about different arrowheads by looking up arrows.meta for example in this question.

Here's the code.

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{arrows.meta}

\begin{document}
\[
\begin{tikzpicture}
    \draw[{Latex[length=2mm,width=2mm]}-{Latex[length=2mm,width=2mm]}]
    (5,.75)node[right]{\Large\textsf{K-means}}
    -- (0,0)node[left]{\Large\textsf{\begin{tabular}{c}Squared-\\error\end{tabular}}} 
    -- (5,-.75)node[right]{\Large\textsf{\begin{tabular}{c}Kernel\\K-means\end{tabular}}};
\end{tikzpicture}
\]
\end{document}
Sandy G
  • 42,558
1

If you want to connect some elements of a text by arrows, you may want to do it this way.

\documentclass{article}
\usepackage{tikz}
\newcommand{\tikznode}[2]{%
\ifmmode%
\tikz[remember picture,baseline=(#1.base),inner sep=0pt] \node (#1) {$#2$};%
\else
\tikz[remember picture,baseline=(#1.base),inner sep=0pt] \node (#1) {#2};%
\fi}%from https://tex.stackexchange.com/questions/402462/tikz-equivalent-of-pstricks-commands-ncbar-and-rnode/402466#402466
\begin{document}
\begin{flushright}
\tikznode{km}{K--means} 
\end{flushright}
\tikznode{se}{\begin{tabular}{c}
squared\\ error
\end{tabular}}
\begin{flushright}
\tikznode{ke}{\begin{tabular}{c}
Kernel\\ K--means
\end{tabular}} 
\end{flushright}
\tikz[overlay,remember picture]{\draw[->] (se.east)--(km.west);
\draw[->] (se.east)--(ke.west);}
\end{document}

enter image description here

1

pure tikz solution. used is positioning library for positioning of nodes:

\documentclass[tikz, margin=3mm]{standalone}% very suitable for test of image drawings
\usetikzlibrary{arrows.meta, positioning}

\begin{document}
    \begin{tikzpicture}[
node distance = 0mm and 22mm, % vertical and horizontal distances between nodes
mynode/.style = {align=center, font=\sffamily}
                    ]
% nodes
\node (n1)  [mynode]                    {Squared-\\error};
\node (n21) [mynode,above right=of n1]  {K-means};
\node (n22) [mynode,below right=of n1]  {Kernel\\ K-means};
% arrow
\draw[Triangle-Triangle] (n21.west) -- (n1.east) -- (n22.west);
    \end{tikzpicture}
\end{document}

enter image description here

Zarko
  • 296,517