6

I would like to know how I can draw an arrow/line with an empty space in the middle or \dots in the middle. For example:

-----    ----->

Or:

---- ... ----->

Thanks!

EDIT:

Here is my try after the first answer, but still could not get it do work:

\documentclass{beamer}
%
% Choose how your presentation looks.
%
% For more themes, color themes and font themes, see:
% http://deic.uab.es/~iblanes/beamer_gallery/index_by_theme.html
%
\mode<presentation>
{
    \usetheme{default}      % or try Darmstadt, Madrid, Warsaw, ...
    \usecolortheme{default} % or try albatross, beaver, crane, ...
    \usefonttheme{default}  % or try serif, structurebold, ...
    \setbeamertemplate{navigation symbols}{}
    \setbeamertemplate{caption}[numbered]
} 

\usepackage{tikz}
\usepackage{float}
\usepackage[brazilian]{babel}
\usepackage[utf8x]{inputenc}
\usetikzlibrary{positioning,arrows,automata,shapes}

\begin{document}

    \begin{frame}
\begin{tikzpicture}[xscale=0.7,auto,swap,>=latex]
        \draw [thick] (0,0) --node {\dots} (12,0);
        \end{tikzpicture}

    \end{frame}

    \end{document}
2
  • 1
    What are the definition for the dots or the empty space? To they have a specific length? Is it a specific part of the line length? How about curved lines? Commented May 16, 2015 at 14:20
  • @Qrrbrbirlbel interesting points.
    – Alenanno
    Commented May 16, 2015 at 14:22

2 Answers 2

6

You simply add an empty (or not for the dots) node along a path/edge. The default position is midway, so you don't need to specify anything in particular. The width of the "gap" can be set by changing the minimum width of the node.

Edit: Since you use the beamer class, I changed the code slightly, but it's still Tikz. Get the new code from below.

Now your nodes along the paths are called mynode, so the style won't affect other nodes you might want to draw. Implementing what I said in the comments, you can manually specify the node position by entering pos=<number> where number is a decimal point from 0 (start) to 1 (end). midway (default) is pos=.5, for example.

Output

figure 1

Code

\documentclass{beamer}
\usepackage{lmodern}
\usepackage{tikz}
\usepackage{float}
\usepackage[brazilian]{babel}
\usepackage[utf8x]{inputenc}

\usetikzlibrary{positioning,arrows.meta,automata,shapes}

\mode<presentation>
{
    \usetheme{default}      % or try Darmstadt, Madrid, Warsaw, ...
    \usecolortheme{default} % or try albatross, beaver, crane, ...
    \usefonttheme{default}  % or try serif, structurebold, ...
    \setbeamertemplate{navigation symbols}{}
    \setbeamertemplate{caption}[numbered]
} 

\begin{document}
\begin{frame}
\begin{tikzpicture}[
    xscale=0.7,
    auto,
    swap,
    ->,
    >=latex,
    mynode/.style={rectangle,fill=white,anchor=center}]

        \draw[thick] (0,3) --node[mynode,minimum width=2cm] {} (12,3);
        \draw[thick] (0,2) --node[mynode,minimum width=1cm] {} (12,2);
        \draw[thick] (0,1) --node[mynode,pos=.7] {$\dots$} (12,1);
        \draw[thick] (0,0) --node[mynode,pos=.2] {$\dots$} (12,0);
        \end{tikzpicture}

    \end{frame}
    \end{document}
8
  • Tried your suggestion, but could not get it to work. See my edit in the post, please.
    – MJS
    Commented May 16, 2015 at 14:36
  • @MJS I'm looking into it.
    – Alenanno
    Commented May 16, 2015 at 14:47
  • @MJS See edited answer.
    – Alenanno
    Commented May 16, 2015 at 14:54
  • What If I wanted the dots at say, 3/4 of length?
    – MJS
    Commented May 16, 2015 at 15:29
  • @MJS You can mark a position along a path by using numbers from 0 to 1. So 3/4 would be 0.7 I think. Try writing ... node[mynode, pos=.7] ... and tell me if it works.
    – Alenanno
    Commented May 16, 2015 at 15:30
2

Another approach you might find more (or less) intuitive.

The pos value will place the dots (or text or whatever) at that proportion of the line length (0.5 in middle)

\documentclass{beamer}
\usepackage{lmodern}
\usepackage{tikz}
\usepackage{float}
\usepackage[brazilian]{babel}
\usepackage[utf8x]{inputenc}

\usetikzlibrary{positioning,arrows.meta,automata,shapes}

\mode<presentation>
{
    \usetheme{default}      % or try Darmstadt, Madrid, Warsaw, ...
    \usecolortheme{default} % or try albatross, beaver, crane, ...
    \usefonttheme{default}  % or try serif, structurebold, ...
    \setbeamertemplate{navigation symbols}{}
    \setbeamertemplate{caption}[numbered]
} 

\begin{document}
\begin{frame}

\begin{tikzpicture}[>=latex]
\coordinate (S) at (-4,0);
\coordinate (E) at ( 4,0);
\draw[->] (S) -- (E) node[pos=0.7,fill=white] {...};
\end{tikzpicture}

    \end{frame}
    \end{document}

enter image description here

3
  • This is no different from the answer above (see the comments under the answer).
    – Alenanno
    Commented May 16, 2015 at 17:24
  • Indeed I said that. For someone without experience of Tikz the layout of the code might be a little more intuitive. That's all. Commented May 16, 2015 at 17:26
  • Actually you said "another approach", which is not. And I don't understand what layout you're referring to.
    – Alenanno
    Commented May 16, 2015 at 17:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .