0

Triangle

Hi guys, I'm new to tikz package. I read a lot, but didn't understand (my bad) some processes. I need to draw this image, dimension are not important. My questions are: - How do I draw the triangle without doing the math? - How do I draw the little portion for the angles?

Thanks a lot to whoever will spend time on this.

  • 1
    Welcome to TeX.SX. Questions about how to draw specific graphics that just post an image of the desired result are really not reasonable questions to ask on the site. Please post a minimal compilable document showing that you've tried to produce the image and then people will be happy to help you with any specific problems you may have. See minimal working example (MWE) for what needs to go into such a document. – BambOo Apr 22 at 13:20
  • Take a look at Minimal TikZ, it explains enough of TikZ to get along until you really need this site's help. – vonbrand Apr 22 at 13:27
  • i am really really sorry. Till now I only did basically boxes, so it it was easy. The triangle I am trying to work on is the following: \begin{figure}[h!] \begin{tikzpicture} %lati \draw [ultra thick] (0,0)--(2.5,5)--(7,0); \draw [->][ultra thick] (0,0)--(7,0); \end{tikzpicture} \caption{Angoli incidenza diffusore} \end{figure} – Noob_Latex Apr 22 at 13:32
1

If the problem is that you don't want to do the math you should let Tikz take care of that. You have a lot of help in e.g. coordinates and the calc library. To start with draw your triangle and put coordinates in the corners:

\documentclass[border=3mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc,quotes,angles}
\begin{document}
\begin{tikzpicture}[>=latex]
  \draw[thick] (0,0) coordinate(A) -- (2.5,5) coordinate(B) -- (7,0)coordinate(C) -- cycle; 
\end{tikzpicture}
\end{document}

Then you have the coordinates (A) in the left corner, B in the top and (C) in the right corner. Then you can draw the arrow along the base as

\draw [->][thick] (A)--(C);

To get the line from the base to the top I would set a coordinate at the base. You can find the place of it by using \coordinate (ACmid) at (A -| B);. That means you set a coordinate at a position horizontal from (A) and vertical from (B). Then you want a coordinate half way from the base to the top: \coordinate (Hmid) at ($(ACmid)!0.5!(B)$);.

Next you want to do the angular mark. Use angleslibrary (and quotes library. That will define a \pic that draws it for you. Just insert the coordinates.

Now you can draw the whole picture. The last angle \alpha_{2b} ended up at the line (A)--(Hmid) so I moved it a bit.

\begin{tikzpicture}[>=latex]
  \draw[thick] (0,0) coordinate(A) -- (2.5,5) coordinate(B) -- (7,0)coordinate(C) -- cycle; 
  \draw [->][thick] (A)--(C); 
  \coordinate (ACmid) at (A -| B);
  \coordinate (Hmid) at ($(ACmid)!0.5!(B)$);
  \coordinate (ABmid) at ($(A)!0.5!(B)$);
  \draw[->] ($(A)+(0,-5pt)$)--($(ACmid) +(0,-5pt)$) node[below,pos=0.5]{$C_{\theta2}$};
  \draw (ACmid) -- (Hmid);
  \draw[dashed] (Hmid) -- (B);
  \draw[->] (A) -- (Hmid);
  \draw[->] (A) -- (ABmid) node[anchor=-30,pos=0.5]{$C_{2b}$};
  \draw[->] (ABmid) -- (Hmid) node[above,pos=0.5]{$C_{2i}$};
  \pic["$\alpha_i$",draw, angle eccentricity=1.2,angle radius=15mm] {angle = Hmid--A--B};
  \pic["$\alpha_2$",draw, angle eccentricity=1.2,angle radius=15mm] {angle = C--A--Hmid};
  \pic["$\alpha_{2b}$",draw, angle eccentricity=1.4,angle radius=7mm,pic text options={shift={(4pt,-4pt)}}] {angle = C--A--B};
\end{tikzpicture}

enter image description here

| improve this answer | |
  • very nicely explained-- may like to add U2 at the triangle base and Ca2 between ABmid and Hmid – js bibra Apr 22 at 15:29
  • StefaH, this is insane. It's terriffic. I really don't know how to thank you. I've saved your post and I am already using it to draw other pictures like that. Really thank you man. – Noob_Latex Apr 22 at 15:48
  • Do you have any guide I can study where I can find the explanation for this commands. I have many but none of those uses the same commands. – Noob_Latex Apr 23 at 10:50
  • @Noob_Latex There are several example both on this site and others that can be used. But the best guide is probably the Tikz pgf manual that can be found at ctan.org/pkg/pgf. It is extensive, about 1300 pages, but also good explained. For example Chapter 41 (version 3.1.5b) is about the Angle Library. – StefanH Apr 25 at 10:05

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.