LaTeX forum ⇒ Graphics, Figures & TablesTiKz (\foreach): reversing arrows Topic is solved

Information and discussion about graphics, figures & tables in LaTeX documents.
Sundial
Posts: 57
Joined: Thu Apr 19, 2012 7:28 pm

Re: TiKz (\foreach): reversing arrows

Postby Sundial » Mon Apr 20, 2015 6:34 pm

Gift to Latex community forum, for the help received today. Fine drifts quickly applied in next code. Best wishes

  1. % --------- trench.tex -------- Apr.20,2015
  2. % Scheme of loads for soil trench
  3. % (1-vertical; 2-vertical, shifted from origin along x-axis
  4. % 3-horizontal)
  5. \documentclass{article}
  6. \usepackage{tikz}
  7. \usepackage[active,tightpage]{preview}
  8. \PreviewEnvironment{center}
  9. \setlength\PreviewBorder{10pt}
  10.  
  11. \tikzstyle{axis} = [-latex,blue!55]
  12.  
  13. \tikzstyle{two}=[x={(0.75cm,0cm)},y={(0cm,0.75cm)}]
  14.  
  15. \begin{document}
  16. \begin{center}
  17. \begin{tikzpicture}[two]
  18. \coordinate (O) at (0,0);
  19. \draw[axis] (O) -- ++(8,0) node[right] {$x$};
  20. \draw[axis] (O) -- ++(0,6) node[above] {$y$};
  21.  
  22. % 1) --- right triangle loads + wall ----
  23. \foreach \y in {0, 0.25,...,4.5} { % full height triangle shaped arrows
  24. \draw[-latex] (6-\y/2.5,\y) -- (4,\y);}
  25. % Contour
  26. \draw [red] (4,5) -- (6,0); % closing queues arrows
  27. \draw [blue] (4,5) -- (4, 0); % drawing wall
  28. %
  29. % 2) --- left load triangle + wall on y-axis ----
  30. \foreach \y in {0, 0.25,...,4.5} { % full height triangle shaped arrows
  31. \draw[-latex] (-2+\y/2.5,\y) -- (0,\y);}
  32. % Contour
  33. \draw [red] (0,5) -- (-2,0); % closing queues arrows
  34.  
  35. % 3) trench lines
  36. \draw [blue] (4,5) -- (6, 5);
  37. \draw [blue] (0,5) -- (-2, 5);
  38.  
  39. % 4) soil reaction
  40. \foreach \x in {0,0.25,...,4} {
  41. \draw[-latex] (\x,-1.5) -- ++(0,1.5); }
  42. % Contour
  43. \draw [red] (0,-1.5) -- (4,-1.5); % closing vertical arrows queues
  44.  
  45. %
  46. % Caption
  47. \draw (0.2,7) -- ++(0,0) node[right,midway] {Loads on Trench};
  48.  
  49. \end{tikzpicture}
  50. \end{center}
  51. \end{document}
  52. %
  53. % ---- EOF: trench.tex ----------
  54. %
Attachments
02.png
02.png (17.56 KiB) Viewed 1895 times

Tags:

Sundial
Posts: 57
Joined: Thu Apr 19, 2012 7:28 pm

Postby Sundial » Tue Apr 21, 2015 8:27 pm

One more help, please!
In some frequent circumstances [application of Mohr's theorems] they need to have the beam loaded with parabolic shape, as shown in the att'd code+screenshot. Thanks in advance for drifts.

  1. % --------- d2.tex --------- Apr.21,2015 ---------
  2. \documentclass{article}
  3. \usepackage{tikz}
  4.  
  5. \usepackage{verbatim}
  6. \usepackage[active,tightpage]{preview}
  7. \PreviewEnvironment{center}
  8. \setlength\PreviewBorder{10pt}%
  9.  
  10. \tikzstyle{load} = [thick,-latex]
  11. \tikzstyle{stress} = [-latex]
  12. \tikzstyle{dim} = [latex-latex]
  13. \tikzstyle{axis} = [-latex,blue!55]
  14.  
  15. \tikzstyle{two}=[x={(1cm,0cm)},y={(0cm,1cm)}]
  16.  
  17. \begin{document}
  18. \begin{center}
  19. \begin{tikzpicture}[two]
  20. \coordinate (O) at (0,0);
  21. \draw[axis] (O) -- ++(6,0) node[right] {$x$};
  22. \draw[axis] (O) -- ++(0,6) node[above] {$y$};
  23. %
  24. \foreach \x in {0,0.25,...,4} {
  25. \draw[-latex] (\x,5.5) -- ++(0,-0.5); % To be replaced with parabolic shape
  26. }
  27. \draw (0,5.5) -- ++(4,0); % closing arrows to be modified in parabolic diagram
  28. \draw (0,5) -- ++(4,0); % beam
  29. %
  30. \draw[dim] (4.5,0) -- ++(0,5) node[midway,right] {$h$}; % column dimension
  31. \draw (4.25,5) -- ++(0.5,0);
  32. %
  33. \draw[dim] (0,-0.5) -- ++(4,0) node[midway,above] {$\ell$}; % beam dimension
  34. \draw (4,-0.75) -- ++(0,0.5);
  35. \draw (0,-0.75) -- ++(0,0.5);
  36.  
  37. \end{tikzpicture} %
  38. \end{center}
  39. \end{document}
  40. %
  41. % ---- EOF: d2.tex ----
Attachments
00.png
00.png (60.38 KiB) Viewed 1885 times

Sundial
Posts: 57
Joined: Thu Apr 19, 2012 7:28 pm

Postby Sundial » Wed Apr 22, 2015 9:50 am

Last step to finalize the matter! Cheers
  1. % --------- d3.tex --------- Apr.22,2015 ---------
  2. \documentclass{article}
  3. \usepackage{tikz}
  4.  
  5. \usepackage{verbatim}
  6. \usepackage[active,tightpage]{preview}
  7. \PreviewEnvironment{center}
  8. \setlength\PreviewBorder{10pt}%
  9.  
  10. \tikzstyle{load} = [thick,-latex]
  11. \tikzstyle{stress} = [-latex]
  12. \tikzstyle{dim} = [latex-latex]
  13. \tikzstyle{axis} = [-latex,blue!55]
  14.  
  15. \tikzstyle{two}=[x={(1cm,0cm)},y={(0cm,1cm)}]
  16.  
  17. \begin{document}
  18. \begin{center}
  19. \begin{tikzpicture}[two]
  20. \coordinate (O) at (0,0);
  21. \draw[axis] (O) -- ++(6,0) node[right] {$x$};
  22. \draw[axis] (O) -- ++(0,6) node[above] {$y$};
  23. %
  24. % p value amplified
  25. \foreach \x in {0.25,0.5,...,3.75} {%
  26. \draw[-latex] (\x,4*\x*3/8-\x*\x*3/8+5) -- (\x,5);
  27. }
  28.  
  29. % Tentative to close arrows queues ... it doesn't produce nothing!
  30. % \foreach \x in {0,0.25,...,4} {%
  31. % \draw (\x,4*\x*3/8-\x*\x*3/8+5);
  32. % }
  33.  
  34.  
  35. \draw (0,5) -- ++(4,0); % beam
  36. %
  37. \draw[dim] (4.5,0) -- ++(0,5) node[midway,right] {$h$}; % column dimension
  38. \draw (4.25,5) -- ++(0.5,0);
  39. %
  40. \draw[dim] (0,-0.5) -- ++(4,0) node[midway,above] {$\ell$}; % beam dimension
  41. \draw (4,-0.75) -- ++(0,0.5);
  42. \draw (0,-0.75) -- ++(0,0.5);
  43.  
  44. \end{tikzpicture} %
  45. \end{center}
  46. \end{document}
  47. %
  48. % ---- EOF: d3.tex ----
Attachments
03.png
03.png (11.95 KiB) Viewed 1879 times

Sundial
Posts: 57
Joined: Thu Apr 19, 2012 7:28 pm

Postby Sundial » Wed Apr 22, 2015 10:57 am

End of story ... via parabola bend. All the best!

  1. % --------- d4.tex --------- Apr.22,2015 ---------
  2. \documentclass{article}
  3. \usepackage{tikz}
  4.  
  5. \usepackage{verbatim}
  6. \usepackage[active,tightpage]{preview}
  7. \PreviewEnvironment{center}
  8. \setlength\PreviewBorder{10pt}%
  9.  
  10. \tikzstyle{load} = [thick,-latex]
  11. \tikzstyle{stress} = [-latex]
  12. \tikzstyle{dim} = [latex-latex]
  13. \tikzstyle{axis} = [-latex,blue!55]
  14.  
  15. \tikzstyle{two}=[x={(1cm,0cm)},y={(0cm,1cm)}]
  16.  
  17. \begin{document}
  18. \begin{center}
  19. \begin{tikzpicture}[two]
  20. \coordinate (O) at (0,0);
  21. \draw[axis] (O) -- ++(6,0) node[right] {$x$};
  22. \draw[axis] (O) -- ++(0,6) node[above] {$y$};
  23. %
  24. % p value amplified
  25. \foreach \x in {0.25,0.5,...,3.75} {%
  26. \draw[-latex] (\x,4*\x*3/8-\x*\x*3/8+5) -- (\x,5);
  27. }
  28.  
  29. % Contour of arrows queues
  30. \draw [red] (0,5) parabola bend (2,6.5) (4,5);
  31.  
  32. \draw (0,5) -- ++(4,0); % beam
  33. %
  34. \draw[dim] (4.5,0) -- ++(0,5) node[midway,right] {$h$}; % column dimension
  35. \draw (4.25,5) -- ++(0.5,0);
  36. %
  37. \draw[dim] (0,-0.5) -- ++(4,0) node[midway,above] {$\ell$}; % beam dimension
  38. \draw (4,-0.75) -- ++(0,0.5);
  39. \draw (0,-0.75) -- ++(0,0.5);
  40.  
  41. \end{tikzpicture} %
  42. \end{center}
  43. \end{document}
  44. %
  45. % ---- EOF: d4.tex ----
Attachments
04.png
04.png (12.7 KiB) Viewed 1874 times


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 5 guests