0

How draw line and string of characters in latex

I have this figure: enter image description here

this my code

\documentclass{article}
\usepackage{tikz}

\newcommand{\linkeditem}[1]{
  \begin{tikzpicture}[remember picture]%
  \node (#1) [gray,circle,fill,inner sep=1.5pt]{};
  \end{tikzpicture}%
}

\newenvironment{linkedlist}{%
    \renewcommand{\theenumi}{\protect\linkeditem{\arabic{enumi}}}
    \renewcommand{\labelenumi}{\theenumi}
    \begin{enumerate}
}{ \end{enumerate} \begin{tikzpicture}[remember picture,overlay]
  \ifnum\value{enumi}>1% Only if there are at least 2 bullet points
  \foreach \x [remember=\x as \lastx (initially 1)] 
    in {2,...,\value{enumi}}{% iterate over them
    \draw[gray, shorten >=1mm, shorten <=1mm] (\lastx) -- (\x);}% and draw the connecting lines
  \fi
  \end{tikzpicture}
}

\begin{document}

\begin{linkedlist}
  \item tiempo presion
  \item ultimo keyPress
  \item tiempo realce
\end{linkedlist}

\end{document}
  • 3
    The picture only appeals to you. Can you enlarge it a little bit? – ferahfeza Feb 11 at 15:27
  • 1
    tikz seems to be a good option. Maybe this example could help you get started. – Partha D. Feb 11 at 15:35
  • 2
    I'm voting to close this question as off-topic because the question is too broad to be answered with the available information. Please add a MWE to make it clearer. – Raaja Feb 11 at 16:07
  • 2
    @x-rw you have been in this site for quite sometime now and we all know that this is not a do-it-for-me site. – Raaja Feb 11 at 16:14
  • @x-rw: It is great that you have added an MWE. However, to make it even clearer, please improve the quality of your image! I personally can't get it. – JouleV Feb 14 at 15:09
2

Is this what you need?

\documentclass[tikz,margin=3mm]{standalone}
\renewcommand{\rmdefault}{\sfdefault}
\usetikzlibrary{decorations.markings}
\begin{document}
\begin{tikzpicture}[
    every node/.style={minimum width=2cm},
    decoration={
        markings,
        mark=at position 0 with {\arrow{|}},
        mark=at position 1 with {\arrow{|}}
    }
]
\draw[fill=gray!10,rounded corners=3pt] (0,0) rectangle (6,4);
\node (kd) at (1,3.5) {keyDown};
\foreach \i in {3,2.5,1}
    \node (kp\i) at (1,\i) {keyPress};
\node (ku) at (1,.5) {keyUp};
\foreach \i in {1.5,1.75,2}
    \fill[black] (1,\i) circle (1pt);
\draw[postaction={decorate}] (kd.east)--(kp1.east) node[midway,right] {tiempo de presion};
\draw[postaction={decorate},blue] (kp1.east)--(ku.east) node[midway,right,black] {tiempo de realce};
\node[minimum width=2.5cm] (uk) at (4.5,1.5) {ultimo keyPress};
\draw[->,red] (kp1.east)--(uk.west);
\end{tikzpicture}
\end{document}

enter image description here

  • i get error ! Argument of \language@active@arg> has an extra }. in this line \draw[->,red] (kp1.east)--(uk.west); – x-rw Feb 14 at 16:27
  • @x-rw So you are having language errors. In your document do you use babel? – JouleV Feb 14 at 16:28
  • yes i used babel \usepackage[spanish,es-tabla]{babel} – x-rw Feb 14 at 16:29
  • @x-rw Read here for a solution! – JouleV Feb 14 at 16:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.