2

While editing my answer concerning centered arcs with Tikz, I realized that there might be an issue when arrows are created: the piece of arc is slightly distorted. This disappears for "normal" arcs.

\documentclass{standalone} 
\usepackage{tikz}

\def\centerarc[#1](#2)(#3:#4:#5);%
%Syntax: [draw options] (center) (initial angle:final angle:radius)
    {
    \draw[#1]([shift=(#3:#5)]#2) arc (#3:#4:#5);
    }

\begin{document}
\begin{tikzpicture}[>=stealth]
\draw[help lines] (0,0) grid (2,2);
\centerarc[thick,<->,blue](1,1)(70:195:1cm);
\centerarc[thick,blue](1,1)(-90:25:1cm);
\draw[thin,dashed,blue] (1,1) circle (1cm);
\end{tikzpicture}
\end{document}

enter image description here

  • 1
    Interesting. It is even worse if you use latex-latex instead of <->. – Peter Grill Nov 20 '18 at 7:57
2

better rendering provides use of tikz library arrows.meta with help of bending:

\documentclass[tikz, margin=3.141592mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,bending} % <--- added

\def\centerarc[#1](#2)(#3:#4:#5);%
%Syntax: [draw options] (center) (initial angle:final angle:radius)
    {
    \draw[#1]([shift=(#3:#5)]#2) arc (#3:#4:#5);
    }

\begin{document}
\begin{tikzpicture}[>=stealth]
\draw[help lines] (0,0) grid (2,2);
\centerarc[thick,<->, semitransparent,red](1,1)(70:195:1cm);
\centerarc[thick,blue](1,1)(-90:25:1cm);
\draw[thin,dashed,blue] (1,1) circle (1cm);
\end{tikzpicture}
\end{document}

enter image description here

from tikz & pgf manual:

  • "Remark: The libraries arrows and arrows.spaced are deprecated. Use arrows.meta instead/additionally, which allows you to do all that the old libraries offered, plus much more ...", and
  • "One common pitfall when arrow tips are added to a path should be addressed right here at the beginning: When TikZ positions an arrow tip at the start, for all its computations it only takes into account the first segment of the subpath to which the arrow tip is added. This “first segment” is the first line-to or curve-to operation (or arc or parabola or a similar operation) of the path; but note that decorations like snake will add many small line segments to paths. The important point is that if this first segment is very small, namely smaller that the arrow tip itself, strange things may result."
  • so essentially we have to call \usetikzlibrary{arrows.meta,bending} as soon as arrows are drawn. Looks a bit heavy but that's ok. – pluton Nov 20 '18 at 11:08
  • 1
    @pluton, as i said in answer :-). from tikz & pgf manual: Remark: The libraries arrows and arrows.spaced are deprecated. Use arrows.meta instead/additionally, which allows you to do all that the old libraries offered, plus much more. ... – Zarko Nov 20 '18 at 12:03

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.