25

How I can draw these (flexible) nodes and arrow? (as in this presentation)

enter image description here

A MWE:

\documentclass{beamer}
\usepackage{tikz}
\usetheme{CambridgeUS}
\usetikzlibrary{calc}
\usepackage[T1]{fontenc}
\usepackage{xcolor}
\usetikzlibrary{arrows.meta} %
\tikzset{ vnode/.style={draw,text=black , line width=4pt,color=gray!50!black!50},
          vvnode/.style={color=gray!50!black!50,text=black , line width=4pt}, 
          vfill/.style={color=black,text=black,fill=red!10!gray!30!blue!50,line width=4pt,},
          varrow/.style={Latex-Latex, text=black,line width=3pt,color=gray!50!black!50},
          vline/.style={line width=1.6pt,color=red!10!gray!30!blue!50},
          }
\newcommand{\uline}[1]{
    \tikz[baseline=(uline.base)]{
        \node[inner sep=1pt,outer sep=0pt] (uline) {#1};
        \draw[vline] (uline.south west) -- (uline.south east);
    }%
    }

\begin{document}
\begin{frame}{}
 \begin{tikzpicture}
    \node[vfill ] at (0,0) { $\left(\frac\delta{\delta h_0}-2m \frac\delta{\delta F_0} \right)S=0,\quad
    \left(\frac\delta{\delta \tau_0}-m \frac\delta{\delta \chi_0} \right)S=0 $};
 \end{tikzpicture}
\begin{tikzpicture}[]%remember picture
 \node[vnode] at (0,0) {
 \begin{tikzpicture}
    \node[ vvnode,name=bbb,align=left] at (-1,-2) {Operators\\
                      $\begin{aligned}\mathcal O=& O_\theta + \theta \uline{$O_\chi$} +\theta^2 \uline{$O_F$} \\
                                    \mathcal F\mathcal Z=& \left\{ \uline{$T_{\mu\nu}$}, \uline{$S_\mu$}, j_\mu\right\}  
                                      \end{aligned} $}; 
    \draw[varrow,] (1.6,-2) to (3.9,-2); 
    \node[ vvnode,align=left] at (5.9,-2) {$5d$ fields\\
                                 $\begin{aligned} \mathcal H=& \left\{ \phi, \uline{$\chi$}, \uline{$F$} \right\}  \\
                                      \mathcal G=&  \left\{ \uline{$g_{\mu\nu}$}, \uline{$\Psi_\mu$}, A_\mu\right\} 
                                  \end{aligned} $};
  \end{tikzpicture}
  };
\end{tikzpicture}
\end{frame}
\end{document}

enter image description here

Mohamed Vall
  • 1,166
  • 2
    Some ideas to start to investigate: http://tex.stackexchange.com/q/255916/1952, http://tex.stackexchange.com/q/268080/1952, http://tex.stackexchange.com/q/78044/1952, http://tex.stackexchange.com/q/74878/1952 – Ignasi Jul 19 '16 at 09:16
  • Which features are you hoping to emulate? – cfr Jul 19 '16 at 10:39
  • Thanks for your comments. @cfr, 1) customized fill in the first equation. 2) the customized rectangle node, 3) the customized arrow <-> , 4) the customized underline. – Mohamed Vall Jul 19 '16 at 10:47
  • In question you show two different images, your MWE gives third one, again different. Please decide, which one you like to have and remove others. – Zarko Jul 19 '16 at 13:30
  • @Zarko, I want to draw this one http://i.stack.imgur.com/ohV1n.png. the other is the MWE. – Mohamed Vall Jul 19 '16 at 13:37
  • Sorry, the first image I recognize as two separate, not related images :-( – Zarko Jul 19 '16 at 13:40
  • I edited the MWE. – Mohamed Vall Jul 19 '16 at 14:13
  • In working on a solution, I don't know enough tikz to get rid of the large gray rectangular box, so that I can replace it with a hand-drawn version. How do I get rid of the gray box? – Steven B. Segletes Jul 22 '16 at 12:47
  • @StevenB.Segletes; to get rid of it just delete draw in vnode/.style – Mohamed Vall Jul 22 '16 at 13:09
  • @cfr I thought this can be done by using TikZ but the "new shape" for the first (filled) node is not trivial :( . – Mohamed Vall Jul 22 '16 at 22:24
  • Could you explain what precisely you find unsatisfactory about the current solution? You say you want a TikZ solution, but I'm not clear why since the existing answer still uses TikZ and just adds some macros for use within or without TikZ pictures. You said earlier you were dissatisfied with the highlighting, but the last example given in the answer, which uses an image as a background for the equation, seems really very close to your target image. So I'm not entirely sure what you're looking for. Also, what computation price are you prepared to pay? Do you want randomness or lookalike? – cfr Jul 29 '16 at 15:42
  • @cfr , I like something very close to this, I thought he customized the node shape there and the filling pattern ?. I do not like to use a background image since [I thinke that maybe] there is another more flexible and elegant solution (I want something close to the highlighting pattern without using a background image) – Mohamed Vall Jul 29 '16 at 16:35
  • For example the curved arrow in page 7 is not easy by using the current answer approach – Mohamed Vall Jul 29 '16 at 16:56
  • I don't see any arrow on page 7. Besides, you didn't ask about that in your question. Of course, neat versions are easy. But patchy, untidy-looking arrow tips and things are a different issue. It seems to me that what you really want is a significant new package, but that is not a realistic thing to expect in an answer here and TikZ is not well-suited to it. Moreover, you did not answer my questions about computational price and randomness. You need to be a lot clearer about precisely what you want, including the flexibility you expect. Otherwise, people will just waste significant efforts. – cfr Jul 29 '16 at 17:05
  • @cfr, (the red arrow on the right pointed to "Goldstino"), if there are unavoidable prices to pay I will accept them. – Mohamed Vall Jul 29 '16 at 17:19
  • On page 12? There are loads of "page 7"s. But the issue remains: I'm not clear what the scope of what you want is or if you want randomness, for example, or what. – cfr Jul 29 '16 at 17:39
  • @cfr, yes slide 12. which randomness ? – Mohamed Vall Jul 29 '16 at 18:06
  • What I mean is that you say that using an external image isn't sufficiently flexible. You might want the patchiness to be randomised so it would be different each time. You might want e.g. to be able to change the colour but not mind it always looking alike. (Size etc. is consistent with using an external image as you can scale/stretch it to fit. So I'm assuming that's not the problem.) And it seems you also want a set of arrows or something but it isn't clear what the range of intended use is or what's needed. – cfr Jul 30 '16 at 02:12
  • @cfr, Yes that's what I want. For the arrows, I want just to be able to drow curved arrows e.g. to comment on some terms in an equation. In short, I want to be able to produce the same nodes, arrows, highlighting as in the presentation without using external images. – Mohamed Vall Jul 30 '16 at 09:12
  • @cfr, Is this seems feasible by TikZ ? – Mohamed Vall Jul 31 '16 at 16:05
  • I don't really know what kind of solution you envisage - what would count as satisfactory. If you have an image of the shapes you want, you could convert them to TikZ code and make the colouring configurable, for example. Then you could make pics from them for ease of use. But to make some of them into arrow tips and others into nodes proper is a different matter. I don't know enough about it to know how easy that might be. I doubt you will be satisfied with anything which might reasonably be provided in the form of an answer here :-). – cfr Jul 31 '16 at 23:23
  • 1
    For examples of custom arrow tips see, for example, http://tex.stackexchange.com/questions/159249/custom-arrow-tip-with-arrows-meta-tikz-library (where the question confusingly includes a modified form of the accepted answer), http://tex.stackexchange.com/questions/205230/how-to-obtain-a-custom-arrow-tip-in-tikz and similar questions. – cfr Aug 01 '16 at 00:28
  • @cfr, It seems that what I wanted so difficult so I will accept any answer which contains an approach which is different from the current answer (just for the sake of diversity of the ansers)... – Mohamed Vall Aug 01 '16 at 07:42

2 Answers2

22

Here's a start, based on my answer at Handwritten comments and annotations in margin. There, I make use of the Teen SPirit font, which is a handwritten font (by way of \fontfamily{fts}\selectfont). Looking at the glyph set of that font (page 2 of http://www.tug.dk/FontCatalogue/teenspirit/teenspirit.pdf), there are several choices for hand drawn line (e.g., glyphs 40, 47, 73, 108, 124, etc.). I chose glyph 47

enter image description here

Then, I created the macro \handxform for rotating and scaling a glyph, where the vertical scale is given by a factor and the horizontal scale is given by a desired length (EDITED to work around scaling limitation, so that actual width specified is honored). The macro \handline[<thickness-scale>]{<length>} passes glyph 47 to \handxform, along with the user-specified scaling information, and the rotations necessary to turn glyph 47 into a horizontal aspect at the proper elevation.

All of the handdrawn lines in the MWE below are scaled, rotated versions of glyph 47.

EDITED to add \handstealthleftrightarrow[<thickness-scale>]{<length>} to the mix, by stringing together glyph 60 and its mirror image:

enter image description here

EDITED to add \handbox[<thickness-scale>]{<length>}{<height>}, which works by stringing together 4 \handlines.

\documentclass{beamer}
\usepackage{tikz}
\usetheme{CambridgeUS}
\usetikzlibrary{calc}
\usepackage[T1]{fontenc}
\usepackage{xcolor}
\usetikzlibrary{arrows.meta} %
\tikzset{vvnode/.style={color=gray!50!black!50,text=black , line width=4pt}}
\newcommand{\uline}[2][blue!30!red]{
  \setbox0=\hbox{#2}%
  \stackunder[2pt]{\copy0}{\color{#1}\handline[2]{\wd0}}%
    }
\usepackage{emerald,scalerel,stackengine}
\usepackage[T1]{fontenc}
\newcommand\handline[2][1]{%
  \kern-.25ex\smash{\handxform{0ex}{-.32ex}{90}{15}{47}{#1}{#2}}}
\newcommand\handstealthrightarrow[2][1]{%
  \handxform{.51ex}{-0.2ex}{ 90}{ 80}{60}{#1}{#2}}
\newcommand\handstealthleftarrow [2][1]{%
  \handxform{.49ex}{0.40ex}{-90}{ 80}{60}{#1}{#2}}
\newcommand\handstealthleftrightarrow[2][1]{%
  \handstealthleftarrow[#1]{.5\dimexpr#2}\kern-0.11\dimexpr#2\relax%
    \handstealthrightarrow[#1]{.5\dimexpr#2}}
\newcommand\handbox[3][1]{%
  \rotatebox{90}{\handline[#1]{#3}}\kern-.006\dimexpr#1\dimexpr#2\relax\relax%
  \stackon[\dimexpr1\dimexpr#3\relax-\dimexpr.6ex]{\handline[#1]{#2}}{%
    \handline[#1]{#2}}%
  \kern-#1\dimexpr.3ex%
  \rotatebox{90}{\handline[#1]{#3}}%
}
\newcommand\handxform[7]{%
  \raisebox{#1}{\fontfamily{fts}\selectfont\scalebox{4}[#6]{%
  \raisebox{#2}{\rotatebox{#3}{\stretchto{\rotatebox{#4}{\char#5}}{.25\dimexpr#7}}}}}}
\begin{document}
\begin{frame}{}
 \begin{tikzpicture}
    \node[ ] at (0,0) {\rlap{\color{blue!20}\handline[24]{3.3in}}
    $\left(\frac\delta{\delta h_0}-2m \frac\delta{\delta F_0} \right)S=0,\quad
    \left(\frac\delta{\delta \tau_0}-m \frac\delta{\delta \chi_0} \right)S=0 $};
 \end{tikzpicture}\smallskip

\begin{tikzpicture}[]%remember picture
 \node at (0,0) {
 \begin{tikzpicture}
    \node[ vvnode,name=bbb,align=left] at (-1,-2) {Operators\\
                      $\begin{aligned}\mathcal O=& O_\theta + \theta \uline{$O_\chi$} +\theta^2 \uline{$O_F$} \\
                                    \mathcal F\mathcal Z=& \left\{ \uline{$T_{\mu\nu}$}, \uline{$S_\mu$}, j_\mu\right\}  
                                      \end{aligned} $}; 
    \node at (2.7,-2) {\color{gray}\handstealthleftrightarrow[2]{1in}};%
    \node at (2.2,-2) {\color{gray}\handbox[5]{4.7in}{1in}};
    \node[ vvnode,align=left] at (5.9,-2) {$5d$ fields\\
                                 $\begin{aligned} \mathcal H=& \left\{ \phi, \uline{$\chi$}, \uline{$F$} \right\}  \\
                                      \mathcal G=&  \left\{ \uline{$g_{\mu\nu}$}, \uline{$\Psi_\mu$}, A_\mu\right\} 
                                  \end{aligned} $};
  \end{tikzpicture}
  };
\end{tikzpicture}
\end{frame}
\begin{frame}
\handbox[3]{2.5in}{.7in}\quad
\handbox[1]{1in}{.7in}\medskip

\handbox[5]{4.5in}{.7in}

\handstealthleftrightarrow[1]{.5in}
\handstealthleftrightarrow[3]{3in}

\mbox{}\handline[1]{1in}
\handline[10]{1in}
\handline[5]{1in}

\the\textwidth

\noindent\fbox{\rule{.9\textwidth}{1pt}}

\noindent\fbox{\handline[1]{.9\textwidth}}
\end{frame}
\end{document}

enter image description here

enter image description here

DISCUSSION

There are some questions below on how to tune the particular shape of the "swish." However, that belies a fundamental misunderstanding of what is done here. All that I am doing is taking a font's glyph, and rotating/stretching/rerotating/translating/restretching/retranslating it, to achieve a desired size and orientation. The shape of the swish is driven totally by the original glyph selected, which in this answer came from the Teen Spirit font.

As an example, if I redefine \handxform to not use the Teen Spirit font, and to instead of the specified glyph, use a simple \rule{1pt}{5pt}:

\newcommand\handxform[7]{%
  \raisebox{#1}{\scalebox{4}[#6]{%
  \raisebox{#2}{\rotatebox{#3}{\stretchto{\rotatebox{#4}{\rule{1pt}{5pt}}}{.25\dimexpr#7}}}}}}

you will see the results change accordingly, where the new swish is comprised of a transformed \rule instead of a transformed glyph 47 or 60.

enter image description here

Therefore, to obtain other shapes, other suitable glyphs must be found from other fonts, if this technique is to be employed. Alternately, someone could use tikz to design a desired swish, and that could be incorporated into a slightly redefined \handxform macro.

As an illustrative case, I can even use an \includegraphics as the swish. Idealy it would be a transparent png, but here I just took the image at the top of this page, saved it as a jpeg, tried to expunge the black text, and used that as my swish. Obviously, the definitions and parameters had to be reworked to accommodate this (especially since the aspect ratio is different), but the result looks as expected:

enter image description here

After saving a large version of the image as greenswish.jpg, The code for the above is:

\documentclass{beamer}
\usepackage{tikz}
\usetheme{CambridgeUS}
\usetikzlibrary{calc}
\usepackage[T1]{fontenc}
\usepackage{xcolor}
\usetikzlibrary{arrows.meta} %
\tikzset{vvnode/.style={color=gray!50!black!50,text=black , line width=4pt}}
\newcommand{\uline}[2][blue!30!red]{
  \setbox0=\hbox{#2}%
  \stackunder[2pt]{\copy0}{\color{#1}\handline[.2]{\wd0}}%
    }
\usepackage{emerald,scalerel,stackengine}
\usepackage[T1]{fontenc}
\newcommand\handline[2][.1]{%
  \kern-.2ex\smash{\handxform{.0ex}{.6ex}{-90}{90}{%
    \includegraphics[scale=.1]{greenswish}}{#1}{#2}}}
\newcommand\handstealthrightarrow[2][1]{%
  \handxform{.51ex}{-0.2ex}{ 90}{ 80}{\char60}{#1}{#2}}
\newcommand\handstealthleftarrow [2][1]{%
  \handxform{.49ex}{0.40ex}{-90}{ 80}{\char60}{#1}{#2}}
\newcommand\handstealthleftrightarrow[2][1]{%
  \handstealthleftarrow[#1]{.5\dimexpr#2}\kern-0.11\dimexpr#2\relax%
    \handstealthrightarrow[#1]{.5\dimexpr#2}}
\newcommand\handbox[3][.1]{%
  \rotatebox{90}{\handline[#1]{#3}}\kern-.006\dimexpr#1\dimexpr#2\relax\relax%
  \stackon[\dimexpr1\dimexpr#3\relax+.4ex]{\handline[#1]{#2}}{%
    \handline[#1]{#2}}%
  \kern-#1\dimexpr.3ex%
  \rotatebox{90}{\handline[#1]{#3}}%
}
\newcommand\handxform[7]{%
  \raisebox{#1}{\fontfamily{fts}\selectfont\scalebox{4}[#6]{%
  \raisebox{#2}{\rotatebox{#3}{\stretchto{\rotatebox{#4}{#5}}{.25\dimexpr#7}}}}}}
\begin{document}
\begin{frame}{}
 \begin{tikzpicture}
    \node[ ] at (0,0) {\rlap{\color{blue!20}\handline[3]{3.42in}}
    $\left(\frac\delta{\delta h_0}-2m \frac\delta{\delta F_0} \right)S=0,\quad
    \left(\frac\delta{\delta \tau_0}-m \frac\delta{\delta \chi_0} \right)S=0 $};
 \end{tikzpicture}\smallskip

\begin{tikzpicture}[]%remember picture
 \node at (0,0) {
 \begin{tikzpicture}
    \node[ vvnode,name=bbb,align=left] at (-1,-2) {Operators\\
                      $\begin{aligned}\mathcal O=& O_\theta + \theta \uline{$O_\chi$} +\theta^2 \uline{$O_F$} \\
                                    \mathcal F\mathcal Z=& \left\{ \uline{$T_{\mu\nu}$}, \uline{$S_\mu$}, j_\mu\right\}  
                                      \end{aligned} $}; 
    \node at (2.7,-2) {\color{gray}\handstealthleftrightarrow[2]{1in}};%
    \node at (2.2,-2) {\color{gray}\handbox[.5]{4.7in}{1in}};
    \node[ vvnode,align=left] at (5.9,-2) {$5d$ fields\\
                                 $\begin{aligned} \mathcal H=& \left\{ \phi, \uline{$\chi$}, \uline{$F$} \right\}  \\
                                      \mathcal G=&  \left\{ \uline{$g_{\mu\nu}$}, \uline{$\Psi_\mu$}, A_\mu\right\} 
                                  \end{aligned} $};
  \end{tikzpicture}
  };
\end{tikzpicture}
\end{frame}
\begin{frame}
\handbox[.3]{2.5in}{.7in}\quad
\handbox[.1]{1in}{.7in}\medskip

\handbox[.1]{4.5in}{.7in}

\handstealthleftrightarrow[.1]{.5in}
\handstealthleftrightarrow[.3]{3in}

\mbox{}\handline[.1]{1in}
\handline[1.0]{1in}
\handline[.5]{1in}

\the\textwidth

\noindent\fbox{\rule{.9\textwidth}{1pt}}

\noindent\fbox{\handline[.1]{.9\textwidth}}
\end{frame}
\end{document}
  • 1
    Thanks a lot for your answer. I failed to understand your code in order to complete it :(... Would it be possible for you to add explications of your code, please? – Mohamed Vall Jul 20 '16 at 07:58
  • 1
    @LlavDem I have added some additional explanation of what I did. – Steven B. Segletes Jul 20 '16 at 09:53
  • Great!, Is there any possibility to fill the head of the arrow?. Is it possible to change the shape of the filling box of the first equation (the \rlap command) ? – Mohamed Vall Jul 22 '16 at 14:23
  • 1
    The blue highlighting is really far from the real thing. – Matsmath Jul 22 '16 at 14:23
  • @Matsmath Here I am just using a highly stretched glyph 47 from the Teen Spirit font. There is no reason another "swish" can't be substituted into the same logic, that looks more like what you might otherwise seek. – Steven B. Segletes Jul 22 '16 at 14:53
  • @LlavDem My answer to you is the same I gave Matsmath above. And that is that I am taking a glyph from another font and stretching it beyond recognition. The font I am using is Teen Spirit, whose glyph table can be found on page 2 of http://www.tug.dk/FontCatalogue/teenspirit/teenspirit.pdf. As you see, there are no arrows with filled heads, and the choice of lines is limited to a few basic shapes. However, there is no reason you cannot search other fonts for suitable glyphs and use the same technique as here. – Steven B. Segletes Jul 22 '16 at 15:03
  • @LlavDem I would add one additional point, if you look at the image at the top of your question. They do exactly the same thing as I, as you will note that the big green swish is identical in shape to the purple underlines. So, if you can find that glyph in a font somewhere, the process is tedious, but straightforward to change it in my code. – Steven B. Segletes Jul 22 '16 at 15:06
  • @LlavDem Please see my DISCUSSION added to my answer. – Steven B. Segletes Jul 22 '16 at 15:22
  • THANKS. I am happy with the recatngle that you drew, I have a problem just with the highlighting's shape. Concerning the arrow I think that one can combine \char1 and char60 by using \rlap to to fill its heads. I am trying to understand your code and this will take for me a while since it contains a lot of commands that I have to learn about. – Mohamed Vall Jul 22 '16 at 15:41
  • I accept this as a solution. But I am waiting for another complete solution (for the highlighting) – Mohamed Vall Jul 22 '16 at 20:54
  • 1
    Are you prepared to make the greenswish available? – cfr Jul 29 '16 at 17:00
  • @cfr I really can't, for several reasons: 1) I had it as a jpeg, but what would really be needed would be a transparent png; and 2) As you can see, I had to try to scrub out the over text with a similar, but different, color green. Quite ugly as it stands. – Steven B. Segletes Aug 01 '16 at 22:49
  • This is for sure the way to do it. TikZ isn't good for untidy-looking stuff in my opinion. It likes precise lines! – cfr Aug 02 '16 at 03:13
6

Here's an incomplete and very minimal demonstration of the kind of thing you might do, which is still rather time-consuming to achieve for all its abject failure to fulfil the desiderata.

The following code creates a fairly minimal pic called brush stroke. It accepts a list of key-value options. The options implemented below are colour, text and name.

The pic creates the node and then scales a scoped and filled path based on a stroke vector from Lazur URH's work at https://openclipart.org/detail/211152/brush-stroke-2, extracted and exported to TikZ code using Inkscape. I edited this code a bit and turned the filling colour into a variable which picks up the colour option and makes it partially transparent.

\documentclass[border=10pt,multi,tikz]{standalone}
\usetikzlibrary{backgrounds}
\makeatletter
\tikzset{%
  pics/brush stroke/.style={%
    code={%
      \tikzset{%
        brushes/.cd,
        #1,
      }
      \node (\brushes@name) [anchor=west, pic actions] {\brushes@text};
      \pgfmathsetmacro\brushes@textwidth{((width("\brushes@text"))+40pt)/112mm}
      \pgfmathsetmacro\brushes@texttotalheight{((height("\brushes@text")+depth("\brushes@text"))+10pt)/15mm}
      % based on stroke from Lazur URH's work at https://openclipart.org/detail/211152/brush-stroke-2, extracted and exported using Inkscape
      \begin{scope}[on background layer, y=0.8pt, x=0.8pt, xscale=\brushes@textwidth, yscale=\brushes@texttotalheight, yshift=-100+5pt, xshift=-10pt]
        \path [fill=\brushes@colour, fill opacity=.2, pic actions] (2.5,85.29) .. controls (1.1193,85.29) and (0,86.4093) .. (0,87.79) .. controls (0,89.1707) and (1.1193,90.29) .. (2.5,90.29) .. controls (72.08,90.29) and (316.55,88.4202) .. (400,87.79) .. controls (316.548,87.1598) and (72.08,85.29) .. (2.5,85.29) -- cycle(2.5,88.8614) .. controls (1.1193,88.8614) and (0,89.9807) .. (0,91.3614) .. controls (0,92.7421) and (1.1193,93.8614) .. (2.5,93.8614) .. controls (72.08,93.8614) and (316.55,91.9916) .. (400,91.3614) .. controls (316.548,90.7312) and (72.08,88.8614) .. (2.5,88.8614) -- cycle(2.5,92.4328) .. controls (1.1193,92.4328) and (0,93.5521) .. (0,94.9328) .. controls (0,96.3135) and (1.1193,97.4328) .. (2.5,97.4328) .. controls (72.08,97.4328) and (316.55,95.563) .. (400,94.9328) .. controls (316.548,94.3026) and (72.08,92.4328) .. (2.5,92.4328) -- cycle(2.5,96.0042) .. controls (1.1193,96.0042) and (0,97.1235) .. (0,98.5042) .. controls (0,99.8849) and (1.1193,101.0042) .. (2.5,101.0042) .. controls (72.08,101.0042) and (316.55,99.1344) .. (400,98.5042) .. controls (316.548,97.874) and (72.08,96.0042) .. (2.5,96.0042) -- cycle(2.5,99.5756) .. controls (1.1193,99.5756) and (0,100.6949) .. (0,102.0756) .. controls (0,103.4563) and (1.1193,104.5756) .. (2.5,104.5756) .. controls (72.08,104.5756) and (316.55,102.7058) .. (400,102.0756) .. controls (316.548,101.4454) and (72.08,99.5756) .. (2.5,99.5756) -- cycle(2.5,103.147) .. controls (1.1193,103.147) and (0,104.2663) .. (0,105.647) .. controls (0,107.0277) and (1.1193,108.147) .. (2.5,108.147) .. controls (72.08,108.147) and (316.55,106.2772) .. (400,105.647) .. controls (316.548,105.0168) and (72.08,103.147) .. (2.5,103.147) -- cycle(2.5,106.7184) .. controls (1.1193,106.7184) and (0,107.8377) .. (0,109.2184) .. controls (0,110.5991) and (1.1193,111.7184) .. (2.5,111.7184) .. controls (72.08,111.7184) and (316.55,109.8486) .. (400,109.2184) .. controls (316.548,108.5882) and (72.08,106.7184) .. (2.5,106.7184) -- cycle(2.5,110.2898) .. controls (1.1193,110.2898) and (0,111.4091) .. (0,112.7898) .. controls (0,114.1705) and (1.1193,115.2898) .. (2.5,115.2898) .. controls (72.08,115.2898) and (316.55,113.42) .. (400,112.7898) .. controls (316.548,112.1596) and (72.08,110.2898) .. (2.5,110.2898) -- cycle(2.5,113.8612) .. controls (1.1193,113.8612) and (0,114.9805) .. (0,116.3612) .. controls (0,117.7419) and (1.1193,118.8612) .. (2.5,118.8612) .. controls (72.08,118.8612) and (316.55,116.9914) .. (400,116.3612) .. controls (316.548,115.731) and (72.08,113.8612) .. (2.5,113.8612) -- cycle(2.5,117.4326) .. controls (1.1193,117.4326) and (0,118.5519) .. (0,119.9326) .. controls (0,121.3133) and (1.1193,122.4326) .. (2.5,122.4326) .. controls (72.08,122.4326) and (316.55,120.5628) .. (400,119.9326) .. controls (316.548,119.3024) and (72.08,117.4326) .. (2.5,117.4326) -- cycle(2.5,121.004) .. controls (1.1193,121.004) and (0,122.1233) .. (0,123.504) .. controls (0,124.8847) and (1.1193,126.004) .. (2.5,126.004) .. controls (72.08,126.004) and (316.55,124.1342) .. (400,123.504) .. controls (316.548,122.8738) and (72.08,121.004) .. (2.5,121.004) -- cycle(2.5,124.5754) .. controls (1.1193,124.5754) and (0,125.6947) .. (0,127.0754) .. controls (0,128.4561) and (1.1193,129.5754) .. (2.5,129.5754) .. controls (72.08,129.5754) and (316.55,127.7056) .. (400,127.0754) .. controls (316.548,126.4452) and (72.08,124.5754) .. (2.5,124.5754) -- cycle(2.5,128.1468) .. controls (1.1193,128.1468) and (0,129.2661) .. (0,130.6468) .. controls (0,132.0275) and (1.1193,133.1468) .. (2.5,133.1468) .. controls (72.08,133.1468) and (316.55,131.277) .. (400,130.6468) .. controls (316.548,130.0166) and (72.08,128.1468) .. (2.5,128.1468) -- cycle(2.5,131.7182) .. controls (1.1193,131.7182) and (0,132.8375) .. (0,134.2182) .. controls (0,135.5989) and (1.1193,136.7182) .. (2.5,136.7182) .. controls (72.08,136.7182) and (316.55,134.8484) .. (400,134.2182) .. controls (316.548,133.588) and (72.08,131.7182) .. (2.5,131.7182) -- cycle(2.5,135.2896) .. controls (1.1193,135.2896) and (0,136.4089) .. (0,137.7896) .. controls (0,139.1703) and (1.1193,140.2896) .. (2.5,140.2896) .. controls (72.08,140.2896) and (316.55,138.4198) .. (400,137.7896) .. controls (316.548,137.1594) and (72.08,135.2896) .. (2.5,135.2896) -- cycle;
      \end{scope}
    },
  },
  brushes/.search also={/tikz},
  brushes/.cd,
  name/.store in=\brushes@name,
  colour/.store in=\brushes@colour,
  text/.store in=\brushes@text,
  name=brush node,
  colour=green,
  text=,
}
\makeatother
\begin{document}
\begin{tikzpicture}
  \pic at (0,0) {brush stroke={text=This is some text.}};
  \pic [font=\sffamily\large] at (0,1) {brush stroke={text=This is some more text., colour=blue, blue}};
\end{tikzpicture}
\end{document}

The rather pedestrian result:

brush strokes

EDIT

Here's a rather poorly coordinated example, just for demonstration, which combines the above with customised arrows and the pencil draw decoration from Claudio Fiandrino's answer.

poorly coordinated example

\documentclass[border=10pt,multi,tikz]{standalone}
\usetikzlibrary{backgrounds,decorations.pathmorphing,fit,arrows.meta,bending}

\tikzset{pencil draw/.style={% code from Claudio Fiandrino's answer at https://tex.stackexchange.com/a/95333/
    draw,
    decorate,
    decoration={random steps, segment length=3mm, amplitude=0.2mm}
  },
}
\makeatletter
\tikzset{%
  pics/brush stroke/.style={%
    code={%
      \tikzset{%
        brushes/.cd,
        #1,
      }
      \begin{scope}[local bounding box/.expanded=\brushes@name]
        \node (\brushes@name-text) [anchor=west, pic actions] {\brushes@text};
        \pgfmathsetmacro\brushes@textwidth{((width("\brushes@text"))+40pt)/112mm}
        \pgfmathsetmacro\brushes@texttotalheight{((height("\brushes@text")+depth("\brushes@text"))+10pt)/15mm}
        % based on stroke from Lazur URH's work at https://openclipart.org/detail/211152/brush-stroke-2, extracted and exported using Inkscape
        \begin{scope}[on background layer, y=0.8pt, x=0.8pt, xscale=\brushes@textwidth, yscale=\brushes@texttotalheight, yshift=-100+5pt, xshift=-10pt]
          \path [fill=\brushes@colour, fill opacity=.2, pic actions] (2.5,85.29) .. controls (1.1193,85.29) and (0,86.4093) .. (0,87.79) .. controls (0,89.1707) and (1.1193,90.29) .. (2.5,90.29) .. controls (72.08,90.29) and (316.55,88.4202) .. (400,87.79) .. controls (316.548,87.1598) and (72.08,85.29) .. (2.5,85.29) -- cycle(2.5,88.8614) .. controls (1.1193,88.8614) and (0,89.9807) .. (0,91.3614) .. controls (0,92.7421) and (1.1193,93.8614) .. (2.5,93.8614) .. controls (72.08,93.8614) and (316.55,91.9916) .. (400,91.3614) .. controls (316.548,90.7312) and (72.08,88.8614) .. (2.5,88.8614) -- cycle(2.5,92.4328) .. controls (1.1193,92.4328) and (0,93.5521) .. (0,94.9328) .. controls (0,96.3135) and (1.1193,97.4328) .. (2.5,97.4328) .. controls (72.08,97.4328) and (316.55,95.563) .. (400,94.9328) .. controls (316.548,94.3026) and (72.08,92.4328) .. (2.5,92.4328) -- cycle(2.5,96.0042) .. controls (1.1193,96.0042) and (0,97.1235) .. (0,98.5042) .. controls (0,99.8849) and (1.1193,101.0042) .. (2.5,101.0042) .. controls (72.08,101.0042) and (316.55,99.1344) .. (400,98.5042) .. controls (316.548,97.874) and (72.08,96.0042) .. (2.5,96.0042) -- cycle(2.5,99.5756) .. controls (1.1193,99.5756) and (0,100.6949) .. (0,102.0756) .. controls (0,103.4563) and (1.1193,104.5756) .. (2.5,104.5756) .. controls (72.08,104.5756) and (316.55,102.7058) .. (400,102.0756) .. controls (316.548,101.4454) and (72.08,99.5756) .. (2.5,99.5756) -- cycle(2.5,103.147) .. controls (1.1193,103.147) and (0,104.2663) .. (0,105.647) .. controls (0,107.0277) and (1.1193,108.147) .. (2.5,108.147) .. controls (72.08,108.147) and (316.55,106.2772) .. (400,105.647) .. controls (316.548,105.0168) and (72.08,103.147) .. (2.5,103.147) -- cycle(2.5,106.7184) .. controls (1.1193,106.7184) and (0,107.8377) .. (0,109.2184) .. controls (0,110.5991) and (1.1193,111.7184) .. (2.5,111.7184) .. controls (72.08,111.7184) and (316.55,109.8486) .. (400,109.2184) .. controls (316.548,108.5882) and (72.08,106.7184) .. (2.5,106.7184) -- cycle(2.5,110.2898) .. controls (1.1193,110.2898) and (0,111.4091) .. (0,112.7898) .. controls (0,114.1705) and (1.1193,115.2898) .. (2.5,115.2898) .. controls (72.08,115.2898) and (316.55,113.42) .. (400,112.7898) .. controls (316.548,112.1596) and (72.08,110.2898) .. (2.5,110.2898) -- cycle(2.5,113.8612) .. controls (1.1193,113.8612) and (0,114.9805) .. (0,116.3612) .. controls (0,117.7419) and (1.1193,118.8612) .. (2.5,118.8612) .. controls (72.08,118.8612) and (316.55,116.9914) .. (400,116.3612) .. controls (316.548,115.731) and (72.08,113.8612) .. (2.5,113.8612) -- cycle(2.5,117.4326) .. controls (1.1193,117.4326) and (0,118.5519) .. (0,119.9326) .. controls (0,121.3133) and (1.1193,122.4326) .. (2.5,122.4326) .. controls (72.08,122.4326) and (316.55,120.5628) .. (400,119.9326) .. controls (316.548,119.3024) and (72.08,117.4326) .. (2.5,117.4326) -- cycle(2.5,121.004) .. controls (1.1193,121.004) and (0,122.1233) .. (0,123.504) .. controls (0,124.8847) and (1.1193,126.004) .. (2.5,126.004) .. controls (72.08,126.004) and (316.55,124.1342) .. (400,123.504) .. controls (316.548,122.8738) and (72.08,121.004) .. (2.5,121.004) -- cycle(2.5,124.5754) .. controls (1.1193,124.5754) and (0,125.6947) .. (0,127.0754) .. controls (0,128.4561) and (1.1193,129.5754) .. (2.5,129.5754) .. controls (72.08,129.5754) and (316.55,127.7056) .. (400,127.0754) .. controls (316.548,126.4452) and (72.08,124.5754) .. (2.5,124.5754) -- cycle(2.5,128.1468) .. controls (1.1193,128.1468) and (0,129.2661) .. (0,130.6468) .. controls (0,132.0275) and (1.1193,133.1468) .. (2.5,133.1468) .. controls (72.08,133.1468) and (316.55,131.277) .. (400,130.6468) .. controls (316.548,130.0166) and (72.08,128.1468) .. (2.5,128.1468) -- cycle(2.5,131.7182) .. controls (1.1193,131.7182) and (0,132.8375) .. (0,134.2182) .. controls (0,135.5989) and (1.1193,136.7182) .. (2.5,136.7182) .. controls (72.08,136.7182) and (316.55,134.8484) .. (400,134.2182) .. controls (316.548,133.588) and (72.08,131.7182) .. (2.5,131.7182) -- cycle(2.5,135.2896) .. controls (1.1193,135.2896) and (0,136.4089) .. (0,137.7896) .. controls (0,139.1703) and (1.1193,140.2896) .. (2.5,140.2896) .. controls (72.08,140.2896) and (316.55,138.4198) .. (400,137.7896) .. controls (316.548,137.1594) and (72.08,135.2896) .. (2.5,135.2896) -- cycle;
        \end{scope}
      \end{scope}
    },
  },
  brushes/.search also={/tikz},
  brushes/.cd,
  name/.store in=\brushes@name,
  colour/.store in=\brushes@colour,
  text/.store in=\brushes@text,
  name=brush node,
  colour=green,
  text=,
  /tikz/.cd,
  thin pencil/.style={draw=#1!75!gray, pencil draw},
  thick pencil/.style={draw=#1!75!gray!50, pencil draw, line width=1pt},
  thin arrow/.style={draw=#1!75!gray, >={Triangle[bend]}},
  thick arrow/.style={draw=#1!75!gray, >={Triangle[bend]}, line width=1pt},
}
\makeatother

\begin{document}
\begin{tikzpicture}
  \pic at (0,0) {brush stroke={name=this, text=This is some text.}};
  \pic [font=\sffamily\large] at (0,1) {brush stroke={name=that, text=This is some more text., colour=blue, blue}};
  \node [thick pencil=blue, fit=(that)] {};
  \node [thick pencil=green, fit=(this)] {};
  \draw [thin arrow=blue, ->] (that-text.east) [bend left=45] to ++(.5,-.75) node [thin pencil=blue, anchor=north] {$c^2$};
  \draw [thick arrow=magenta, <->] ([xshift=3pt]this-text.west) [out=180, in=180] to ([xshift=3pt]that-text.west);
  \node [fit=(current bounding box), pencil draw, line width=1pt, double=gray!10, draw=gray] {};
\end{tikzpicture}
\end{document}

EDIT EDIT

Here is a version which this time uses code from Alain Matthes's answer for the hand-hewn look. This kind-of-partially-supports-rounding-if-you-are-very-careful-and-like-to-live-dangerously. (If you get too large dimension errors, you've exceeded TikZ's limits. Unsurprisingly, this can vary randomly. Hence, success on one run does not guarantee success on the next with the same code!)

\documentclass[border=10pt,multi,tikz]{standalone}
\usetikzlibrary{backgrounds,decorations.pathmorphing,fit,arrows.meta,bending}
\makeatletter
\tikzset{%
  pics/brush stroke/.style={%
    code={%
      \tikzset{%
        brushes/.cd,
        #1,
      }
      \begin{scope}[local bounding box/.expanded=\brushes@name]
        \node (\brushes@name-text) [anchor=west, pic actions] {\brushes@text};
        \pgfmathsetmacro\brushes@textwidth{((width("\brushes@text"))+40pt)/112mm}
        \pgfmathsetmacro\brushes@texttotalheight{((height("\brushes@text")+depth("\brushes@text"))+10pt)/15mm}
        % based on stroke from Lazur URH's work at https://openclipart.org/detail/211152/brush-stroke-2, extracted and exported using Inkscape
        \begin{scope}[on background layer, y=0.8pt, x=0.8pt, xscale=\brushes@textwidth, yscale=\brushes@texttotalheight, yshift=-100+5pt, xshift=-10pt]
          \path [fill=\brushes@colour, fill opacity=.2, pic actions] (2.5,85.29) .. controls (1.1193,85.29) and (0,86.4093) .. (0,87.79) .. controls (0,89.1707) and (1.1193,90.29) .. (2.5,90.29) .. controls (72.08,90.29) and (316.55,88.4202) .. (400,87.79) .. controls (316.548,87.1598) and (72.08,85.29) .. (2.5,85.29) -- cycle(2.5,88.8614) .. controls (1.1193,88.8614) and (0,89.9807) .. (0,91.3614) .. controls (0,92.7421) and (1.1193,93.8614) .. (2.5,93.8614) .. controls (72.08,93.8614) and (316.55,91.9916) .. (400,91.3614) .. controls (316.548,90.7312) and (72.08,88.8614) .. (2.5,88.8614) -- cycle(2.5,92.4328) .. controls (1.1193,92.4328) and (0,93.5521) .. (0,94.9328) .. controls (0,96.3135) and (1.1193,97.4328) .. (2.5,97.4328) .. controls (72.08,97.4328) and (316.55,95.563) .. (400,94.9328) .. controls (316.548,94.3026) and (72.08,92.4328) .. (2.5,92.4328) -- cycle(2.5,96.0042) .. controls (1.1193,96.0042) and (0,97.1235) .. (0,98.5042) .. controls (0,99.8849) and (1.1193,101.0042) .. (2.5,101.0042) .. controls (72.08,101.0042) and (316.55,99.1344) .. (400,98.5042) .. controls (316.548,97.874) and (72.08,96.0042) .. (2.5,96.0042) -- cycle(2.5,99.5756) .. controls (1.1193,99.5756) and (0,100.6949) .. (0,102.0756) .. controls (0,103.4563) and (1.1193,104.5756) .. (2.5,104.5756) .. controls (72.08,104.5756) and (316.55,102.7058) .. (400,102.0756) .. controls (316.548,101.4454) and (72.08,99.5756) .. (2.5,99.5756) -- cycle(2.5,103.147) .. controls (1.1193,103.147) and (0,104.2663) .. (0,105.647) .. controls (0,107.0277) and (1.1193,108.147) .. (2.5,108.147) .. controls (72.08,108.147) and (316.55,106.2772) .. (400,105.647) .. controls (316.548,105.0168) and (72.08,103.147) .. (2.5,103.147) -- cycle(2.5,106.7184) .. controls (1.1193,106.7184) and (0,107.8377) .. (0,109.2184) .. controls (0,110.5991) and (1.1193,111.7184) .. (2.5,111.7184) .. controls (72.08,111.7184) and (316.55,109.8486) .. (400,109.2184) .. controls (316.548,108.5882) and (72.08,106.7184) .. (2.5,106.7184) -- cycle(2.5,110.2898) .. controls (1.1193,110.2898) and (0,111.4091) .. (0,112.7898) .. controls (0,114.1705) and (1.1193,115.2898) .. (2.5,115.2898) .. controls (72.08,115.2898) and (316.55,113.42) .. (400,112.7898) .. controls (316.548,112.1596) and (72.08,110.2898) .. (2.5,110.2898) -- cycle(2.5,113.8612) .. controls (1.1193,113.8612) and (0,114.9805) .. (0,116.3612) .. controls (0,117.7419) and (1.1193,118.8612) .. (2.5,118.8612) .. controls (72.08,118.8612) and (316.55,116.9914) .. (400,116.3612) .. controls (316.548,115.731) and (72.08,113.8612) .. (2.5,113.8612) -- cycle(2.5,117.4326) .. controls (1.1193,117.4326) and (0,118.5519) .. (0,119.9326) .. controls (0,121.3133) and (1.1193,122.4326) .. (2.5,122.4326) .. controls (72.08,122.4326) and (316.55,120.5628) .. (400,119.9326) .. controls (316.548,119.3024) and (72.08,117.4326) .. (2.5,117.4326) -- cycle(2.5,121.004) .. controls (1.1193,121.004) and (0,122.1233) .. (0,123.504) .. controls (0,124.8847) and (1.1193,126.004) .. (2.5,126.004) .. controls (72.08,126.004) and (316.55,124.1342) .. (400,123.504) .. controls (316.548,122.8738) and (72.08,121.004) .. (2.5,121.004) -- cycle(2.5,124.5754) .. controls (1.1193,124.5754) and (0,125.6947) .. (0,127.0754) .. controls (0,128.4561) and (1.1193,129.5754) .. (2.5,129.5754) .. controls (72.08,129.5754) and (316.55,127.7056) .. (400,127.0754) .. controls (316.548,126.4452) and (72.08,124.5754) .. (2.5,124.5754) -- cycle(2.5,128.1468) .. controls (1.1193,128.1468) and (0,129.2661) .. (0,130.6468) .. controls (0,132.0275) and (1.1193,133.1468) .. (2.5,133.1468) .. controls (72.08,133.1468) and (316.55,131.277) .. (400,130.6468) .. controls (316.548,130.0166) and (72.08,128.1468) .. (2.5,128.1468) -- cycle(2.5,131.7182) .. controls (1.1193,131.7182) and (0,132.8375) .. (0,134.2182) .. controls (0,135.5989) and (1.1193,136.7182) .. (2.5,136.7182) .. controls (72.08,136.7182) and (316.55,134.8484) .. (400,134.2182) .. controls (316.548,133.588) and (72.08,131.7182) .. (2.5,131.7182) -- cycle(2.5,135.2896) .. controls (1.1193,135.2896) and (0,136.4089) .. (0,137.7896) .. controls (0,139.1703) and (1.1193,140.2896) .. (2.5,140.2896) .. controls (72.08,140.2896) and (316.55,138.4198) .. (400,137.7896) .. controls (316.548,137.1594) and (72.08,135.2896) .. (2.5,135.2896) -- cycle;
        \end{scope}
      \end{scope}
    },
  },
  brushes/.search also={/tikz},
  brushes/.cd,
  name/.store in=\brushes@name,
  colour/.store in=\brushes@colour,
  text/.store in=\brushes@text,
  name=brush node,
  colour=green,
  text=,
}
\makeatother
% code from Alain Matthes's answer at https://tex.stackexchange.com/a/49272/
\pgfdeclaredecoration{free hand}{start}
{
  \state{start}[width = +0pt,
  next state=step,
  persistent precomputation = \pgfdecoratepathhascornerstrue]{}
  \state{step}[auto end on length    = 3pt,
  auto corner on length = 3pt,
  width=+2pt]
  {
    \pgfpathlineto{
      \pgfpointadd
      {\pgfpoint{2pt}{0pt}}
      {\pgfpoint{rand*0.15pt}{rand*0.15pt}}
    }
  }
  \state{final}
  {}
}
\tikzset{free hand/.style={
    decorate,
    decoration={free hand}
  }
}
\newcommand\freedraw{\draw [free hand]}

\tikzset{%
  thin arrow/.style={draw=#1!75!gray, >={Triangle[bend]}},
  thick arrow/.style={draw=#1!75!gray, >={Triangle[bend]}, line width=1pt},
  thin free hand/.style={draw=#1!75!gray, free hand},
  thick free hand/.style={draw=#1!71!gray!50, free hand, line width=1pt},
}
\begin{document}
\begin{tikzpicture}
  \pic at (0,0) {brush stroke={name=this, text=This is some text.}};
  \pic [font=\sffamily\large] at (0,1) {brush stroke={name=that, text=This is some more text., colour=blue, blue}};
  \node [thick free hand=blue, fit=(that)] {};
  \node [thick free hand=green, fit=(this)] {};
  \draw [thin arrow=blue, ->] (that-text.east) [bend left=45] to ++(.5,-.75) node [thin free hand=blue, anchor=north] {$c^2$};
  \draw [thick arrow=magenta, <->] ([xshift=3pt]this-text.west) [out=180, in=180] to ([xshift=3pt]that-text.west);
  \node [fit=(current bounding box), rounded corners=5pt, free hand, line width=1.5pt, draw=gray, postaction={draw=gray!10, line width=.75pt, opacity=.5}] {};
\end{tikzpicture}
\end{document}

free handed randomness

See the answers to this question (of which Alain's is just one of many excellent ones) for a variety of approaches to creating that elusive 'hand-hewn' look with LaTeX. Not all of the answers use TikZ, but many do.

Note that Marc van Dongen's answer shows the pencil draw approach applied to arcs. The issue with rounding the corners of rectangles is that the arcs wanted are very small and this creates various kinds of complexities which cause no end of trouble.

cfr
  • 198,882
  • Please see edit, also. If you want roughened and patchified arrow tips which behave nicely, this won't do it. But they do bend, which looks much better if you use them on tight curves. (At least, I prefer it and sometimes you get nonsense otherwise.) Just to give a sense of what you might do, if determined. By the way, why do you want your presentation to look like Keynote anyway?! – cfr Aug 03 '16 at 01:57
  • I like your arrows. Is there a way to make the regtangles "rounded" ? – Mohamed Vall Aug 03 '16 at 05:53
  • You can make the rectangles rounded if you do away with the hand-drawn effect created by pencil draw, but rounded corners and pencil draw do not get on at all well together. – cfr Aug 03 '16 at 12:44
  • That is, you can combine them but you get very, very odd results. I think this is because the rounding must break the path down into pieces and the decoration ends up causing the pieces not to join up properly, but I'm not sure. – cfr Aug 03 '16 at 12:50
  • Please see edit edit for a possible alternative which allows you to use something roundish in at least some cases. (Kind of.) Also, take a look at the question and answers I linked to. Not all of the answers use TikZ, but many do. Perhaps something there will suit your needs. – cfr Aug 03 '16 at 23:28
  • 1
    Personally, if you want to develop a custom Beamer theme with TikZ 'bling', I would think first about whether you want your audience to be looking at the bling or the content. If you are sure about the bling factor, I would recommend perhaps starting by thinking about something you like and which TikZ does well or something you've seen done in TikZ which impressed you, and then think about how to create presentation elements based around that inspiration. I think that starting from something some other software does rarely ends well. (It never looks quite the same - and why should it?) – cfr Aug 03 '16 at 23:34