Graphics, Figures & TablesArrow box

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

Arrow box

Post by bstex »

Hi.
I have created this arrow box,
Before.png
Before.png (18.95 KiB) Viewed 4210 times
with this MWE:

Code: Select all

\documentclass[a4paper,11pt,openright]{book}
\usepackage{tikz}
\usetikzlibrary{positioning, shapes.arrows}

\begin{document}

\begin{tikzpicture}
\tikzset{box/.style={arrow box, draw=blue}};
\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}};
\end{tikzpicture}

\end{document}
but I need this:
After.png
After.png (18.84 KiB) Viewed 4210 times
Any help?
Thank you very much.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
rais
Posts: 419
Joined: Sun Nov 16, 2014 8:51 pm

Arrow box

Post by rais »

well, I didn't see a way to adapt the arrow box directly...but where's the problem drawing the shape you want yourself?

Code: Select all

\documentclass[a4paper,11pt,openright]{book}
\usepackage{tikz}
%\usetikzlibrary{positioning, shapes.arrows}

\newlength\arrlength
\newlength\arrheadlength
\newlength\arrheadwidth
\newlength\arrshaftwidth
\newlength\arrdrop
\setlength\arrlength{2cm}
\setlength\arrheadlength{2mm}
\setlength\arrshaftwidth{3mm}
\setlength\arrheadwidth{2\arrshaftwidth}
\setlength\arrdrop{6mm}
\begin{document}
     
\begin{tikzpicture}
\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.};
\draw[blue] (x.south west) -- (x.south east) -- (x.north east) -- (x.north west) % the four corners
  -- ++(0pt, \dimexpr0.5\arrshaftwidth-\arrdrop) % start of the arrow's shaft
  -- ++(\dimexpr\arrheadlength-\arrlength, 0pt) %start of the arrow's neck
  -- ++(0pt, \dimexpr0.5\arrheadwidth-0.5\arrshaftwidth)
  -- ++(-\arrheadlength, -0.5\arrheadwidth) %the arrow's tip
  -- ++(\arrheadlength, -0.5\arrheadwidth)
  -- ++(0pt, \dimexpr0.5\arrheadwidth-0.5\arrshaftwidth)
  -- ++(\dimexpr\arrlength-\arrheadlength, 0pt) %back to the box
-- cycle;
\draw[red, <->] (x.north west) ++(0pt, -\arrdrop) -- ++(-\arrlength, 0pt);
\end{tikzpicture}

\end{document}
KR
Rainer
bstex
Posts: 69
Joined: Mon Oct 23, 2017 10:22 am

Arrow box

Post by bstex »

Nice. Thanks.
Post Reply