1

If I compile this (with lualatex):

\documentclass[a4paper,12pt]{article}

\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[scale=1]
% Declare Points
\coordinate (C) at (-0.085,0.318);
\coordinate (B) at (0.868,0.868);
\coordinate (A) at (0.868,-0.232);

% Draw EquilateralTriangle
\draw[thick] (C)
-- (B) node[midway, sloped, scale=0.5] {O}
-- (A) node[midway, sloped, scale=0.5] {O}
-- cycle node[midway, sloped, scale=0.5] {O};

\end{tikzpicture}

\end{document}

I get this correct result: enter image description here

But if I set the scale to something else, like 3, then I get: enter image description here

The last "O" is floating anywhere...

Is there an obvious problem in my code? Is this a bug? (If yes, is there any workaround?).

3

You can simply draw to C and then cycle. This will scale flawlessly.

Edit: The problem should be that cycle closes the current part of the path what might cause some problems if the current part is used later on.

\documentclass[a4paper,12pt]{article}

\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[scale=1]
% Declare Points
\coordinate (C) at (-0.085,0.318);
\coordinate (B) at (0.868,0.868);
\coordinate (A) at (0.868,-0.232);

% Draw EquilateralTriangle
\draw[thick] (C)
-- (B) node[midway, sloped, scale=0.5] {O}
-- (A) node[midway, sloped, scale=0.5] {O}
-- (C) node[midway, sloped, scale=0.5] {O} -- cycle;

\end{tikzpicture}

\end{document}
  • OK, thanks! And so I guess this is a workaround? (note that actually when drawing to C, then it's not useful to cycle any longer to get the correct picture) And that the problem is an actual bug? (i.e. one can expect the code I posted to work) – zezollo Jan 5 '18 at 17:31
  • The last cycle does make a difference. Zoom in the corner to see it. – Ulrike Fischer Jan 5 '18 at 17:44

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.