3

I am new to LaTeX. I need to draw the following in TikZ or PSTricks. But TikZ is preferable.

enter image description here

  • 5
    What did you try or did find? – Sigur Dec 30 '17 at 15:34
  • How is it possible to vote 8 times for an answer and not vote for the question? As @egreg says, if the question deserves an answer, doesn't it deserve a vote?tex.meta.stackexchange.com/questions/6636/… – AndréC Jan 1 '18 at 11:55
  • @AndréC: An upvote indicates research effort and usefulness to other users. This question is more of a "please do this for me" request. OP should make an attempt with a Minimal Working Example or at least cite other questions that have parts of the diagram that are similar. Google "tikz angle" and many examples come up. – Sandy G Jan 2 '18 at 4:45
  • @SandyG This shows that the points system is not fully developed and needs to be improved. If each answer automatically assigned a vote to the question, those who answer questions that they feel are not worth a vote would abstain from answering. – AndréC Jan 2 '18 at 7:54
9

A pstricks solution, based od the pst-eucl module:

 \documentclass{article}

\usepackage{pst-eucl}
% \usepackage{auto-pst-pdf} for use with pdflatex --enablewrite18 (MiKTeX)
% or pdflatex --shell-escape (TeX Live, MacTeX)

\pagestyle{empty}

\begin{document}

\psset{unit=3, dotsize = 3pt, shortput = nab}
\begin{pspicture}(-1,-0.5)(1,1.5)
\pstGeonode[PosAngle = {-90,30,90,150}, PointName = {A, \rlap{$B_1\;(x_{b_1}{,}y_{b_1})$}, B, \llap{$(x_{b_2}{,}y_{b_2})\; B_2$}}, PointNameSep = 0.8em]
(0,0){A}(1; 65){B1}(1; 90){B}(1; 115){B2}
\uput{1.5em}[d](A){$ (x_ a ,y_a) $}
\uput{1.5em}[u](B){$ (x_ b ,y_b) $}
\pstArcOAB{A}{B1}{B2}
\ncline{A}{B}
\psline[linestyle = dashed, linewidth = 0.5pt](B1)(A)(B2)
\ncline[arrows = |<->|, offset = 10pt]{A}{B2}^{$ R $}
\psarc[linewidth = 0.5pt](A){0.25}{65}{90}\uput{0.3}[75](A){$\theta$}
\end{pspicture}

\end{document} 

enter image description here

  • \pstMarkAngle can simplify your code. – Money Oriented Programmer Jan 1 '18 at 10:00
  • @ArtificialStupidity: HappyNew Year! That's what I tried first, but it didn't work, for some reason. Does it for you? Anyway, I can't test anew, as the latest pstricks seems to have a bug. – Bernard Jan 1 '18 at 10:40
  • Happy New Year too! I will try in a couple of seconds. DONE! – Money Oriented Programmer Jan 1 '18 at 10:51
  • Fine! Just a last question: did you update pstricks to v. 2.80a? I have problems with this version and I suspect my problem with \pstMarkAngle might be linked. – Bernard Jan 1 '18 at 11:08
  • Not yet. I will try updating later. – Money Oriented Programmer Jan 1 '18 at 11:17
7

While waiting for a tikz solution after more details from the OP's previous attempts are given, the try below shows it can be a job for MetaPost as well. Code included in a LuaLaTeX program.

Update To prevent the Metafun bug discovered by Ulrike Fischer in the most recent TeX distributions, bug which produces empty arrow heads instead of the expected filled ones (see also the comments here below), I've loaded the mparrows package and set its setarrows parameter to default. This prevents the problem to appear.

\documentclass[border=3mm]{standalone}
\usepackage{luatex85, luamplib}
    \mplibsetformat{metafun}
\begin{document}
\begin{mplibcode}
u = 1.25cm; R = 3u; t = 25; 
input mparrows; setarrows(default);
beginfig(1);
    pair A, B, B[];
    A = origin; B = R*dir 90; B1 = B rotated -t; B2 = B rotated t; 
    draw B1 .. B .. B2; 
    draw A -- B; for P = B1, B2: draw A--P dashed evenly; endfor;
    for P = A, B, B1, B2: drawdot P withpen pencircle scaled 3bp; endfor;
    draw anglebetween(A--B1, A--B, btex $\theta$ etex);
    label.bot(btex $\begin{array}{c} A\\ (x_a, y_a) \end{array}$ etex, A);
    label.top(btex $\begin{array}{c} (x_b, y_b)\\ B \end{array}$ etex, B);
    path radius; radius = (A -- B2) shifted (.18u * unitvector B2 rotated 90);
    drawdblarrow radius; label.lft(btex $R$ etex, point .5 of radius);
    freelabeloffset := 5bp;
    freelabel(btex $B_1(x_{b_1}, y_{b_1})$ etex, B1, A);
    freelabel(btex $(x_{b_2}, y_{b_2})B_2$ etex, B2, A);
endfig;
\end{mplibcode}
\end{document}

enter image description here

  • I would shift down the arrow a bit. Do you have an idea why I don't get black filled arrow tips with your code? – Ulrike Fischer Dec 30 '17 at 17:13
  • @UlrikeFischer You're right about the arrow, I've just shifted it down. About the arrow tips, I've no idea at all, it's the first time I hear about this problem. Strange! – Franck Pastor Dec 30 '17 at 17:23
  • @UlrikeFischer I've just slightly changed the shifting of the arrow: it is now shifted along the direction orthogonal to the A--B2 radius, as Marmot did below. It seems the right way to do it. – Franck Pastor Dec 30 '17 at 18:34
  • Yes looks better. And I really get a non-filled arrow tip with metafun -- I'm at loss why, I think I will ask a question ;-). – Ulrike Fischer Dec 30 '17 at 18:38
  • Is your system up-to-date? I just realized that it works in TL15 but not in TL16 and TL17. – Ulrike Fischer Dec 30 '17 at 18:47
6

With TikZ. UPDATE: Shifted the double arrow by (-0.5 \cos\theta,-0.5 \sin\theta), thanks to Sigur.

\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}
\draw[dashed] (0,0) -- (110:5);
\draw[dashed] (0,0) -- (70:5);
\draw (0,5) arc (90:110:5) node [left,yshift=1.5mm] {$(x_{b2},y_{b2})~B_2$};
\draw (0,5) arc (90:70:5) node [right] {$B_1~(x_{b1},y_{b1})$};
\draw[-] node [below] {$\begin{array}{c}A\\ (x_a,y_a)\end{array}$} (0,0) -- (0,5) node [above] {$\begin{array}{c} (x_b,y_b)\\ B\end{array}$};
\draw (0,0) -- (0,1.5) arc (90:70:1.5) node[above,midway] {$\theta$};
\draw[latex-latex,transform canvas={xshift=-0.2165cm,yshift=-0.125em},thick] (0,0) -- (110:5)
node[left,midway] {$R$};
\end{tikzpicture}
\end{document}

enter image description here

  • Nice. But it would be better if the R arrow has length smaller, showing the radius. It is a little bit longer (maybe pointing to B_2 label). – Sigur Dec 30 '17 at 17:07
  • @sigur I'm not sure I understand what I mean. The double arrow has precisely the same length as the dashed lines. – marmot Dec 30 '17 at 17:10
  • Make the arc longer to left side and it should tangent the arrow. But it looks like going to cross the arrow. – Sigur Dec 30 '17 at 17:11
  • @Sigur Shifted the arrow correctly (I think). Thanks! However, I do not think that the continuation of the arc should hit the arrow at its tip. Rather, one should shift by -r (\cos \theta,\sin\theta), I think. – marmot Dec 30 '17 at 17:17
  • This could help you to understand what I mean: tex.stackexchange.com/q/14901/14757 – Sigur Dec 30 '17 at 17:22
3

Simplifying Bernard's code for fun!

\documentclass[pstricks,12pt]{standalone}
\usepackage{pst-eucl}

\psset{shortput = nab}

\begin{document}
\begin{pspicture}(-5,-2)(5,5)
\pstGeonode[PosAngle={-90,30,90,150},PointName={A, \rlap{$B_1\;(x_{b_1}{,}y_{b_1})$}, B, \llap{$(x_{b_2}{,}y_{b_2})\; B_2$}}, PointNameSep=12pt]
(0,0){A}(3; 65){B1}(3; 90){B}(3; 115){B2}
\uput{1.5em}[d](A){$ (x_ a ,y_a) $}
\uput{1.5em}[u](B){$ (x_ b ,y_b) $}
\pstArcOAB{A}{B1}{B2}
\ncline{A}{B}
\psline[linestyle = dashed, linewidth = 0.5pt](B1)(A)(B2)
\ncline[arrows = |<->|, offset = 10pt]{A}{B2}^{$ R $}
\pstMarkAngle[MarkAngleRadius=1,LabelSep=1.5]{B1}{A}{B}{$\theta$}
\end{pspicture}
\end{document} 

enter image description here

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.