3

I would like the orange dot to be a circle. How do I make that happen while keeping otherwise intuitive/straightforward numbers in the code? Or is there no easy way to do that?

This code

\documentclass{article}

\usepackage{amsmath,exsheets,tikz}

\begin{document}

\begin{question}
Put a dot on \(\frac{17}{6}\).

\vspace{0.3cm}
\noindent
\begin{tikzpicture}[xscale=2.5]
\draw (0,0)--(4,0);
\foreach \x in {0,...,24}
 \draw (\x/6,-0.15)--(\x/6,0.15);
\foreach \x in {0,1,...,4}
 \node[below] at (\x,-0.2) {\x};
\fill[orange,xscale=1] (17/6,0) circle (0.1cm);
  %obviously, this xscale adjustment didn't work...
\end{tikzpicture}

\end{question}

\end{document}

Yields this:

orange not quite dot

3

Set the yscale to the same as the xscale. Optionally, divide the circle diameter on the same number, i.e.

\fill[orange,yscale=2.5] (17/6,0) circle (0.1cm/2.5);

Another option would be to specify an ellipse, which due to the scaling becomes a circle:

\fill[orange] (17/6,0) circle[x radius=0.1cm/2.5,y radius=0.1cm];

And for good measure, a third workaround:

\fill[orange,xscale=1/2.5] (17/6*2.5,0) circle[radius=0.1cm];

If you don't like repeating the number, you can save it to a macro with e.g. \pgfmathsetmacro{\scalefactor}{2.5}, and use \scalefactor instead of 2.5.

  • Regarding the 1st option: I tried the yscale=2.5 part by itself and that seemed to work. But wouldn't dividing the diameter (radius?) by the same scale factor of 2.5, just shrink the circle along the x- and y-axes proportionally? – WeCanLearnAnything Sep 10 '15 at 6:05
  • Regarding the 3rd option: Did my first attempt in the OP fail because setting xscale=1 actually meant "Take the xscale defined on the begin{tikzpicture] line and multiply that by 1"? – WeCanLearnAnything Sep 10 '15 at 6:11
  • @WeCanLearnAnything 1) I don't follow. The result looks like a circle to me. 2) Yes, as far as I know/guess. – Torbjørn T. Sep 10 '15 at 6:12
  • Never mind my question regarding the 1st option, I understand it now. :) – WeCanLearnAnything Sep 10 '15 at 6:14

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.