0

I wanna make this in Overleaf. I've see many diagrams like this in 3b1b's video.
enter image description here


Any help will be appreciated. Thank you.

7
  • 1
    Welcome to TeX.SE! What do you mean with "3b1b's video"? Please explain your issue better, for example what have you tried?
    – Mensch
    May 29, 2022 at 16:36
  • (Just a comment: The style of the picture looks like the one in Needham's books. I think he uses some external tool.)
    – mickep
    May 29, 2022 at 16:59
  • @Mensch yeah Sir I'm talking about famous math channel "3Blue1Brown". He uses his own mathematical software Manim but Manim also uses latex. That's why I asked. May 29, 2022 at 18:38
  • @mickep Sir what is Needham's book I searched but got many books in result. I took this Image from the book called "Visual Complex Analysis". May 29, 2022 at 18:41
  • @Mensch Yeah and I tried like this using Tikz package :\overbrace{\draw (0,0) -- (3,3)} but didn't work :( May 29, 2022 at 18:41

2 Answers 2

3

A line can be braced in TikZ using decorations.pathreplacing. If the nodes are O and AB then the commands

\draw[very thick, -stealth](O)--(AB);
\draw[decorate, decoration={brace}](O.center)--(AB.center);

will draw the line (with stealth arrow) and then draw the brace. The brace can be shifted away from the nodes with raise= and the "height" of the brace can be controlled with amplitude=. You can then add a label to the brace by placing a node with the desired label using the sloped option (and shifting with yshift=) as in the code below.

enter image description here

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary {decorations.pathreplacing}

\begin{document}

\begin{tikzpicture}
\node[draw, circle, inner sep=1pt, label={180:0}] at (0,0)(O){};
\node[fill, circle, inner sep=1pt, label={0:$AB$}] at (1,4)(AB){};
\node[fill, circle, inner sep=1pt, label={0:$B$}] at (1,2)(B){};
\node[fill, circle, inner sep=1pt, label={0:$A$}] at (4,1)(A){};
\draw[very thick, -stealth](O)--(AB);
\draw[decorate, decoration={brace, raise=3pt, amplitude=6pt}](O.center)--
    node[sloped, yshift=15pt]{$(\mathrm{length}\,A)\cdot(\mathrm{length}\,B)$}(AB.center);
\draw[very thick, -stealth](O)--(B);
\draw[very thick, -stealth](O)--(A);
\draw[thick, dotted](O)--(4,0);
\end{tikzpicture}

\end{document}

The marked angles can be added using the angles library. The arrow tips in your example look like Triangle style, which requires arrows.meta, and the bending library will get the heads pointed in the right direction. Add the following code:

\usetikzlibrary {decorations.pathreplacing, angles, arrows.meta, bending} % in preamble

\draw pic [draw, angle radius=1.2cm, -Triangle] {angle=X--O--B};
\draw pic [draw, angle radius=1.2cm, -Triangle] {angle=X--O--AB};
\draw pic [draw, angle radius=1cm, -Triangle] {angle=X--O--A};
\draw pic [draw, angle radius=1cm, -Triangle] {angle=X--O--AB};

enter image description here

6
  • It would be better if the angle arrow heads were the same as the edge arrow heads.
    – M. Logic
    May 30, 2022 at 4:31
  • @M.Logic: That is not what appears in the image that OP provided.
    – Sandy G
    May 30, 2022 at 4:34
  • @SandyG Thank you very much sir !! Now it is clear. would you like to tell me "From where can I learn this types of packages ?" ? May 30, 2022 at 5:20
  • But a good improvement, and the bracket in your post is also improved. By the way, the line thickness of A, B and AB shouldn't be so large to a high aesthetical standard.
    – M. Logic
    May 30, 2022 at 6:26
  • @Luckychouhan: You're welcome. The TikZ/PGF manual is a good place to learn. Don't worry that it's so long. The first few chapters are nicely written tutorials. I recommend focussing on section I, chapters 1–5. Also, please remember the Code of Conduct instructs us to use gender-neutral language. Don't call users "sir". Some of the people helping you are women.
    – Sandy G
    May 30, 2022 at 15:04
2

It can be done with pstricks-add, using a relatively short code:

    \documentclass[border=12pt, svgnames]{standalone}%
    \usepackage{pstricks-add, pst-eucl}

    \begin{document}

    \psset{arrowinset=0.12, linejoin=1, unit=2cm, braceWidth=0.4pt}
    \begin{pspicture}(-0.5,-0.5)(2.5,2)
    \pstGeonode(2; 20){A}(1; 50){B}(2; 70){AB}
    \pstGeonode[PointSymbol=o, PosAngle=180](0,0){O}
    \pnode(2.2,0){X}\ncline[linestyle=dotted, dotsep=2pt, nodesepA=2pt]{O}{X}
    \psset{arrows=->, nodesepA=2pt, nodesepB=3pt}\ncline{O}{A}\ncline{O}{B}\ncline{O}{AB}
    \psbrace[rot=70, nodesep=-1pt](AB)(O){\makebox[0pt]{(length A)$\cdot$(length B)}}
     \end{pspicture}

    \end{document} 

enter image description here

2
  • Thank you very much sir !! May I know " from where can I learn this new packages ?" ? May 30, 2022 at 5:21
  • @Luckychouhan: well, you have the pstricks web site https://tug.org/PSTricks/main.cgi/, and the documentation of the pstricks packages, which has manyy examples.
    – Bernard
    May 30, 2022 at 6:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .