2

Based on the answer in TikZ Adding Text, I tried the below example to display the coordinates as text in the Tikz figure. But the code is not compilable.

How do I add text to a coordinate in tikz without using the \node command.

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
  \draw[thick,rounded corners=8pt] (0,0) {0,0} -- (0,2) {0,2}; 
\end{tikzpicture}
\end{document} 

After the suggestion from @JouleV, I have the following:

enter image description here

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
  \draw (-5,0) node {-5,0} -- (5,0) node {5,0};
  \draw (0,-5) node {0,-5} -- (0,5) node {0,5};
  \draw (0,0) circle [radius=3cm];
\end{tikzpicture}
\end{document}

How to ensure that there is enough space between the text and lines?

subham soni
  • 9,673

1 Answers1

5

You just have to add some options to it.

\documentclass[tikz,margin=3mm]{standalone}
\begin{document}
\begin{tikzpicture}
\draw (0,-5) node[below] {$(0,-5)$}--(0,5) node[above] {$(0,5)$};
\draw (-5,0) node[left] {$(-5,0)$}--(5,0) node[right] {$(5,0)$};
\draw (0,0) circle (3cm);
\end{tikzpicture}
\end{document}

enter image description here

In fact you can add every possible option for \node.