LaTeX forum ⇒ Graphics, Figures & TablestikZ | Labels beneath Nodes Topic is solved

Information and discussion about graphics, figures & tables in LaTeX documents.
gaelle
Posts: 1
Joined: Wed Jun 13, 2012 10:47 am

tikZ | Labels beneath Nodes

Postby gaelle » Wed Jun 13, 2012 11:04 am

Hi,

This my code :
  1. \documentclass{article}
  2. \usepackage{tikz}
  3.  
  4. \begin{document}
  5. \begin{figure}
  6. \centering
  7. \begin{tikzpicture}
  8. [acteur/.style={circle, fill=black,thick, inner sep=2pt, minimum size=0.2cm}]
  9. \node (a1) at ( 2.5,2.5) [acteur][label=A]{};
  10. \node (a2) at ( 2,1)[acteur][label={B}]{};
  11. \node (a3) at ( 1,2.5) [acteur][label=C]{};
  12. \node (a4) at ( 0,0) [acteur][label=D]{};
  13. \node (a5) at ( -1.5,1.5) [acteur][label=E]{};
  14. \node (a6) at ( -2,3) [acteur][label=F]{};
  15. \node (a7) at ( -3,1) [acteur][label=G]{};
  16. \node (a8) at ( -3.5,2) [acteur][label=H]{};
  17. \node (a9) at ( 0,3) [acteur][label=I]{};
  18. \draw [-, thick, red] (a1) -- (a2);
  19. \draw [-, thick, red] (a2) -- (a3);
  20. \draw [-, thick, red] (a1) -- (a3);
  21. \draw [-, thick, red] (a2) -- (a4);
  22. \draw [-, thick, red] (a5) -- (a4);
  23. \draw [-, thick, red] (a5) -- (a6);
  24. \draw [-, thick, red] (a6) -- (a7);
  25. \draw [-, thick, red] (a7) -- (a8);
  26. \draw [-, thick, red] (a8) -- (a5);
  27. \draw [-, thick, red] (a7) -- (a5);
  28. \draw [-, thick, red] (a9) -- (a5);
  29. \draw [-, thick, red] (a9) -- (a4);
  30. \draw [-, thick, red] (a5) -- (a3);
  31. \draw [-, thick, red] (a6) -- (a2);
  32. \end{tikzpicture}
  33. \end{figure}
  34. \end{document}

I would like to place some labels under the nodes. Any suggestions?

thanks in advance
Gaëlle

User avatar
localghost
Site Moderator
Posts: 9206
Joined: Fri Feb 02, 2007 12:06 pm

Postby localghost » Wed Jun 13, 2012 5:54 pm

Section 3.9 of the pgf/tikZ user guide describes quite precise how to do that.
  1. \documentclass[11pt]{article}
  2. \usepackage{tikz}
  3.  
  4. \begin{document}
  5. \begin{figure}
  6. \centering
  7. \begin{tikzpicture}[
  8. thick,
  9. acteur/.style={
  10. circle,
  11. fill=black,
  12. thick,
  13. inner sep=2pt,
  14. minimum size=0.2cm
  15. }
  16. ]
  17. \node (a1) at (2.5,2.5) [acteur,label=A]{};
  18. \node (a2) at (2,1)[acteur,label=below:B]{};
  19. \node (a3) at (1,2.5) [acteur,label=C]{};
  20. \node (a4) at (0,0) [acteur,label=below:D]{};
  21. \node (a5) at (-1.5,1.5) [acteur,label=below:E]{};
  22. \node (a6) at (-2,3) [acteur,label=F]{};
  23. \node (a7) at (-3,1) [acteur,label=below:G]{};
  24. \node (a8) at (-3.5,2) [acteur,label=H]{};
  25. \node (a9) at (0,3) [acteur,label=I]{};
  26. \draw[red] (a1) -- (a2);
  27. \draw[red] (a2) -- (a3);
  28. \draw[red] (a1) -- (a3);
  29. \draw[red] (a2) -- (a4);
  30. \draw[red] (a5) -- (a4);
  31. \draw[red] (a5) -- (a6);
  32. \draw[red] (a6) -- (a7);
  33. \draw[red] (a7) -- (a8);
  34. \draw[red] (a8) -- (a5);
  35. \draw[red] (a7) -- (a5);
  36. \draw[red] (a9) -- (a5);
  37. \draw[red] (a9) -- (a4);
  38. \draw[red] (a5) -- (a3);
  39. \draw[red] (a6) -- (a2);
  40. \end{tikzpicture}
  41. \end{figure}
  42. \end{document}



Best regards and welcome to the board
Thorsten
Attachments
tikZ-labels.png
The obtained output.
tikZ-labels.png (5.29 KiB) Viewed 12641 times
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1

uyysidmc
Posts: 3
Joined: Thu Sep 06, 2018 12:26 pm

Postby uyysidmc » Thu Sep 06, 2018 12:27 pm

How to make more thicker of a line ?

User avatar
Stefan Kottwitz
Site Admin
Posts: 9105
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Thu Sep 06, 2018 2:43 pm

You can add options for that:

  1. \draw [red, thick] (a1) -- (a2);
  2. \draw [red, very thick] (a2) -- (a3);


Stefan
Site admin


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 8 guests