TransWikia.com

Tikz curve node midway in-between curved lines while breaking line

TeX - LaTeX Asked on February 6, 2021

Is there are any easy way to insert a node in between a curved line as shown in the figure? Using node[midway] {$alpha$} would just place the text next to the curves.

Also, is it possible to make sure that these lines stay parallel to each other?

nodes between curved lines

EDIT:
The code I am using is:

defcenterarc[#1](#2)(#3:#4:#5)% Syntax: [draw options] (center) (initial angle:final angle:radius)
    { draw[#1] ($(#2)+({#5*cos(#3)},{#5*sin(#3)})$) arc (#3:#4:#5); }
    begin{tikzpicture}[scale=5]
    coordinate (A) at (0, 0);
    coordinate (B) at (0, .7);
    coordinate (C) at (2, 0);
    coordinate (D) at ($0.75*(B)+0.25*(C)$);
    coordinate (E) at ($0.6*(A)+.4*(B)$);
    scope[rotate=-19, shift=(D)]input{figures/clarky}endscope
    draw[thick] (B) -- (C);
    draw[thick] (A) -- (C);
    draw[dashed] (E) -- (C);
    centerarc[thick, <->, ](C)(179.5:161:2) node[loc=.5, fill=white] {$alpha$};
    centerarc[thick, <->, ](C)(179.5:172.5:1.8);
    centerarc[thick, <->, ](C)(171.5:161:1.8);
    begin{scope}[shift={(-.5, 0)}, scale=.17]
        draw[->] (0, 0) -- (1, 0) node[anchor=west] {x};
        draw[->] (0, 0) -- (0, 1) node[anchor=west] {z};
    end{scope}
        
    end{tikzpicture}

This way the arcs are parallel as suggested however, I did not find a way to use the coordinates in a nice way for this. Using node[midway, fill=white] {$alpha$} puts the node at the bottom of the arc.

One Answer

Unfortunately, your code snipped is not compilable (file clarky is unknown), so MWE below contain only part, which draw your angles. For this is used TikZ library angles and quotes (for details see TikZ & PGF manual, section 41 Angle Library, page 570--571 and section 18.2.1 The Quotes Syntax, page 267--268)):

documentclass[tikz, margin=3.141592]{standalone}
usetikzlibrary{angles,
                calc,
                quotes}
usepackage{amsmath}

begin{document}
defcenterarc[#1](#2)(#3:#4:#5)% Syntax: [draw options] (center) (initial angle:final angle:radius)
    { draw[#1] ($(#2)+({#5*cos(#3)},{#5*sin(#3)})$) arc (#3:#4:#5); }
    begin{tikzpicture}[scale=5,
my angle/.style = {draw, <->,
                   angle radius = #1,
                   angle eccentricity=1,
                   anchor=center,
                   },
every pic quotes/.style = {inner sep=1pt, fill=white}
                    ]

    coordinate (A) at (0, 0);
    coordinate (B) at (0, .7);
    coordinate (C) at (2, 0);
    coordinate (E) at ($0.6*(A)+.4*(B)$);
%
    draw[thick]    (A) -- (C) -- (B);
    draw[dashed]   (E) -- (C);
pic [my angle=88mm, "$alpha$"]     {angle = B--C--A};
pic [my angle=77mm, "$alpha_{text{eff}}$"]   {angle = E--C--A};
pic [my angle=77mm, "$alpha_i$"]   {angle = B--C--E};
    end{tikzpicture}
end{document}

enter image description here

Answered by Zarko on February 6, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP