0

I have the following minimal code

\documentclass{article}

\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
\draw[solid, thick]
(0,0) node [below]{0}
-- (2,0) node [below]{$n-k$}
-- (6,0) node [below]{$n$};
\end{tikzpicture}

\end{document}

This creates the image below: enter image description here

How can I get short vertical tick marks at the nodes? By this I mean, how can I get the image to appear like the one below? enter image description here

Note that the red colour is not necessary but it was just added to the image to make the desired result easier to understand.

3

The next code

\documentclass{article}

\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
\draw[solid,thick] (0,0) -- (6,0);
\draw[thick] (0,0.2) -- ++ (0,-0.4) node[below] {0};
\draw[thick] (2,0.2) -- ++ (0,-0.4) node[below] {$n-k$};
\draw[thick] (6,0.2) -- ++ (0,-0.4) node[below] {$n$};
\end{tikzpicture}

\end{document}

produces:

picture

3

You can draw tick in the \foreach loop:

\documentclass{article}
\usepackage{tikz}

\begin{document}
    \begin{tikzpicture}
\draw[thick] (0,0) -- (6,0);
\foreach \i/\j in {0/0, 2/n-k, 6/n}
\draw[draw=red] (\i,0.2) -- ++ (0,-0.4) node[below] {$\j$};
    \end{tikzpicture}
\end{document}

enter image description here

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.