Skip to content

Using turn coordinate specification syntax in combination with (global) transforms produces wrong result #1433

@d-sacre

Description

@d-sacre

Brief outline of the bug

Using the TikZ ([turn]<ANGLE>:<DISTANCE>) syntax in combination with any transforms (global or scope, so far tested for shift and scale) leads to a faulty drawing (angle between and distance from the newly created point to the old point wrong).

% ORIGINALLY POSTED: https://tex.stackexchange.com/questions/758036/how-to-use-turn-coordinate-specification-in-combination-with-global-transforms-l
\documentclass{standalone}

\usepackage{tikz}

\begin{document}
	\begin{tikzpicture}
		% DESCRIPTION: Plain, no modification
		% STATUS: WORKING
		\draw[black]
			(0,0)
			arc(0:90:-1.5 and 1.5)
			arc(90:135:-2.0 and 2.0)
			--([turn]0:0.5)
			node[below]{plain}
		;
		
		% DESCRIPTION: Scale
		% STATUS: FAIL
		\begin{scope}[scale=0.5]
			\draw[red]
				(0,0)
				arc(0:90:-1.5 and 1.5)
				arc(90:135:-2.0 and 2.0)
				--([turn]0:0.5)
				node[below]{scale}
			;
		\end{scope}
		
		% DESCRIPTION: Shift
		% STATUS: FAIL
		\begin{scope}[xshift=5cm]
			\draw[red]
				(0,0)
				arc(0:90:-1.5 and 1.5)
				arc(90:135:-2.0 and 2.0)
				--([turn]0:0.5)
				node[below]{xshift}
			;
		\end{scope}
	\end{tikzpicture}
\end{document}
Image

Tested with

  • TeX Live 2025.2-3 (Arch Linux)
  • TeX Live 2025 (Overleaf)
  • TeX Live 2024 (Overleaf)
  • TeX Live 2023 (Overleaf)
  • TeX Live 2022 (Overleaf)
  • TeX Live 2020 (Overleaf)

Partial Workaround

Using transform canvas instead of standard transforms does produce the correct output.

% AUTHOR: jlab
% SOURCE: https://tex.stackexchange.com/a/758038
% LICENSE: CC BY-SA 4.0

\documentclass{article}

\usepackage{tikz}

\begin{document}
  \begin{tikzpicture}
    % DESCRIPTION: Plain, no modification
    \draw[black]
      (0,0)
      arc(0:90:-1.5 and 1.5)
      arc(90:135:-2.0 and 2.0)
      --([turn]0:0.5)
      node[below]{plain}
    ;
    
    % DESCRIPTION: Scale
    \begin{scope}[transform canvas={scale=0.5}]
      \draw[red]
        (0,0)
        arc(0:90:-1.5 and 1.5)
        arc(90:135:-2.0 and 2.0)
        --([turn]0:0.5)
        node[below]{scale}
      ;
    \end{scope}
    
    % DESCRIPTION: Shift
    \begin{scope}[transform canvas={xshift=5cm}]
      \draw[red]
        (0,0)
        arc(0:90:-1.5 and 1.5)
        arc(90:135:-2.0 and 2.0)
        --([turn]0:0.5)
        node[below]{xshift}
      ;
    \end{scope}
  \end{tikzpicture}
\end{document}
Image

Caveats:

  • It also scales font sizes, nodes, etc. (with standard method not affected), which might be undesirable
  • It does not work with all document classes out of the box (e. g. for standalone, one cannot use shift or over unity scale in combination with transform canvas without manual resizing of the bounding box, as this does not happen automatically)

Minimal working example (MWE)

\documentclass{standalone}

\usepackage{tikz}

\begin{document}
	\begin{tikzpicture}
		% DESCRIPTION: Plain, no modification
		% STATUS: WORKING
		\draw[black]
			(0,0)
			arc(0:90:-1.5 and 1.5)
			arc(90:135:-2.0 and 2.0)
			--([turn]0:0.5)
			node[below]{plain}
		;
		
		% DESCRIPTION: Scale
		% STATUS: FAIL
		\begin{scope}[scale=0.5]
			\draw[red]
				(0,0)
				arc(0:90:-1.5 and 1.5)
				arc(90:135:-2.0 and 2.0)
				--([turn]0:0.5)
				node[below]{scale}
			;
		\end{scope}
		
		% DESCRIPTION: Shift
		% STATUS: FAIL
		\begin{scope}[xshift=5cm]
			\draw[red]
				(0,0)
				arc(0:90:-1.5 and 1.5)
				arc(90:135:-2.0 and 2.0)
				--([turn]0:0.5)
				node[below]{xshift}
			;
		\end{scope}
	\end{tikzpicture}
\end{document}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions