LaTeX forum ⇒ Graphics, Figures & TablesArrow box Topic is solved

Information and discussion about graphics, figures & tables in LaTeX documents.
bstex
Posts: 65
Joined: Mon Oct 23, 2017 10:22 am

Arrow box

Postby bstex » Sat Jun 16, 2018 4:57 pm

Hi.
I have created this arrow box,
Before.png
Before.png (18.95 KiB) Viewed 289 times

with this MWE:
  1. \documentclass[a4paper,11pt,openright]{book}
  2. \usepackage{tikz}
  3. \usetikzlibrary{positioning, shapes.arrows}
  4.  
  5. \begin{document}
  6.  
  7. \begin{tikzpicture}
  8. \tikzset{box/.style={arrow box, draw=blue}};
  9. \node[box, arrow box arrows={west:2cm}] at (0,0){\begin{minipage}{5em}This is a side note, like a post-it, which explains the text on the left side of the page.\end{minipage}};
  10. \end{tikzpicture}
  11.  
  12. \end{document}


but I need this:
After.png
After.png (18.84 KiB) Viewed 289 times


Any help?
Thank you very much.

rais
Posts: 170
Joined: Sun Nov 16, 2014 8:51 pm

Postby rais » Sun Jun 17, 2018 5:15 pm

well, I didn't see a way to adapt the arrow box directly...but where's the problem drawing the shape you want yourself?
  1. \documentclass[a4paper,11pt,openright]{book}
  2. \usepackage{tikz}
  3. %\usetikzlibrary{positioning, shapes.arrows}
  4.  
  5. \newlength\arrlength
  6. \newlength\arrheadlength
  7. \newlength\arrheadwidth
  8. \newlength\arrshaftwidth
  9. \newlength\arrdrop
  10. \setlength\arrlength{2cm}
  11. \setlength\arrheadlength{2mm}
  12. \setlength\arrshaftwidth{3mm}
  13. \setlength\arrheadwidth{2\arrshaftwidth}
  14. \setlength\arrdrop{6mm}
  15. \begin{document}
  16.  
  17. \begin{tikzpicture}
  18. \node[shape=rectangle, text width=5em] (x) at (0,0){This is a side note, like a post-it, which explains the text on the left side of the page.};
  19. \draw[blue] (x.south west) -- (x.south east) -- (x.north east) -- (x.north west) % the four corners
  20. -- ++(0pt, \dimexpr0.5\arrshaftwidth-\arrdrop) % start of the arrow's shaft
  21. -- ++(\dimexpr\arrheadlength-\arrlength, 0pt) %start of the arrow's neck
  22. -- ++(0pt, \dimexpr0.5\arrheadwidth-0.5\arrshaftwidth)
  23. -- ++(-\arrheadlength, -0.5\arrheadwidth) %the arrow's tip
  24. -- ++(\arrheadlength, -0.5\arrheadwidth)
  25. -- ++(0pt, \dimexpr0.5\arrheadwidth-0.5\arrshaftwidth)
  26. -- ++(\dimexpr\arrlength-\arrheadlength, 0pt) %back to the box
  27. -- cycle;
  28. \draw[red, <->] (x.north west) ++(0pt, -\arrdrop) -- ++(-\arrlength, 0pt);
  29. \end{tikzpicture}
  30.  
  31. \end{document}

KR
Rainer

bstex
Posts: 65
Joined: Mon Oct 23, 2017 10:22 am

Postby bstex » Sun Jun 17, 2018 5:23 pm

Nice. Thanks.


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 9 guests