9

I'm trying to make a image like this:

enter image description here

Here's how I'm CURRENTLY doing it:

\begin{tikzpicture}
    \draw[color=black, line width=2pt, -latex] (-3,2.5) -- (0, 2.5) +(0,\rad) coordinate (center) (0,2.5) arc[start angle=270, delta angle=30, radius=\rad];
    \foreach \a in {270, 280, 290}{
        \draw[draw=blue,-latex,thick] (center) ++(\a:\rad) -- +(\a-180:1cm) node at +(\a-180:1.5cm) {$F_m$};
    }
\end{tikzpicture}

Where \rad is just a given radius I defined. Currently this makes a dummy coordinate at the center of the "circle." This also means that Tikz makes a very large border with a lot of extra white space, and I'm trying to look for a solution that may eliminate this dummy variable or whitespace.

Sage M
  • 93

3 Answers3

13

I suggest doing this with pics, which are "little tikz pictures" inside tikz pictures. Note: you should never put a tikz picture inside another tikz picture. The pic construction is designed to avoid that situation.

Here we will design a pic in the shape of a blue arrow pointing up from (0,0), with a node above it containing the label. The same commands to make a tikzpicture are used in the pic. When we place the pic on a line or curve, (0,0) corresponds to the location on the segment. With the sloped option, it will adjust its coordinates so "up" is perpendicular to the segment.

enter image description here

The pic is named perp, and can be called at any point on a segment with the usage

...to pic[pos=<pct>,sloped]{perp=<label text>}(x,y)

where <pct> is the percentage along the current segment and <label text> is processed in math mode.

The pic is defined with tikzset in the preamble. I have the length set to .7cm, with the label 3mm above it at (0,1) (in the perpendicular coordinate system).

\documentclass{article}

\usepackage{tikz}

\tikzset{perp/.pic={\drawblue,-latex,thick--(0,.7); \node[text=black, font=\scriptsize] at(0,1){$#1$};}, perp/.default={}}

\begin{document}

\begin{tikzpicture} \drawthickto pic[sloped]{perp}(2,0) to[out=0,in=-120] pic[pos=.3,sloped]{perp=F_m} pic[pos=.8,sloped]{perp=F_m}(4,1);

\end{tikzpicture}

\end{document}

Note that to use pic with arc, you must use the "long form" of the arc command:

\draw[thick](0,0) arc[start angle=120,end angle=60,radius=2] pic[pos=.8,sloped]{perp=F_m};

enter image description here

Sandy G
  • 42,558
8

While you are waiting for tikz support, here is a version in Metapost, showing the useful direction .. of construct, which gives you a pair representing the direction at a particular time along the path.

enter image description here

Compile this with lualatex...

\documentclass[border=5mm]{standalone}
\usepackage{luamplib}
\begin{document}
\mplibtextextlabel{enable}
\begin{mplibcode}
beginfig(1);
path ramp;
ramp = origin -- 100 right {right}.. 300 right rotated 12;

for t = 0.9, 1.3, 1.7:
    path a;
    a = (origin -- 72 up) 
        rotated angle direction t of ramp
        shifted point t of ramp;
    drawarrow subpath(0, 0.8) of a withcolor 2/3 blue;
    label(&quot;$F_m$&quot;, point 1 of a);
endfor

drawarrow ramp withpen pencircle scaled 1;

endfig; \end{mplibcode} \end{document}

Thruston
  • 42,268
7

Here is an Asymptote way.

enter image description here

unitsize(1cm);
path p=(0,0) .. controls (3,.5) and (5,-3) .. (8,2);
real[] t={.3,.45,.65,.8,.9};
string[] Lt={"$F_a$","$F_b$","$F_c$","$F_d$","$F_e$"};
for(int i=0; i<t.length; ++i){
pair M=point(p,t[i]);       // before I was confusing with M=relpoint(p,t[i]);
pair Mn=rotate(90)*dir(p,t[i]);
draw(Label(Lt[i],EndPoint),M--M+.8Mn,blue,Arrow(TeXHead));
}

draw(p,magenta+1pt,Arrow);

Black Mild
  • 17,569