I would like to create a command that allows me to create a number line and circle two given values.
I have the code for the number line:
\documentclass{article} \usepackage{tikz}
\newcommand{\NL}[2]{\begin{center} \begin{tikzpicture}[scale =
1.07] \draw[latex-latex] (#1-0.5,0) -- (#2+0.5,0) ; \foreach \x in {#1,...,#2} \draw[shift={(\x,0)},color=black] (0pt,3pt) -- (0pt,-3pt); \foreach \x in {#1,...,#2} \draw[shift={(\x,0)},color=black] (0pt,0pt) -- (0pt,-3pt) node[below] {$\x$}; \end{tikzpicture} \end{center}}
\begin{document} \NLTwo{1}{10}
\end{document}
And this code makes nice looking circles:
\documentclass{article}
\usepackage{tikz}
\newcommand*\circled[1]{\tikz[baseline=(char.base)]{
\node[shape=circle,draw,inner sep=2pt] (char) {#1};}}
\begin{document}
Numbers aligned with the text: \circled{1} \circled{2} \circled{3} end.
\end{document}
...and I'm hopeful these ideas can be combined.
For example, I would like to use a command like \NLTwo{1}{10}{3}{5} that produces a number line with numbers from 1 to 10 (inputs 1 and 2) and circles numbers 3 and 5 (inputs 3 and 4) looking something like
Thanks so much, Wendy





\NLbut use\NLTwo. Note that the use ofscale=1.07is probably a Bad Idea, typographically speaking. – cfr Mar 01 '24 at 00:43