编辑

编辑

我如何绘制这些(灵活的)节点和箭头?(像这样推介会

在此处输入图片描述

一位 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}

在此处输入图片描述

答案1

以下是我根据以下回答得出的结论:页边的手写评论和注释。在那里,我使用了 Teen SPirit 字体,这是一种手写字体(通过\fontfamily{fts}\selectfont)。查看该字体的字形集(第 2 页http://www.tug.dk/FontCatalogue/teenspirit/teenspirit.pdf),手绘线有几种选择(例如,字形 40、47、73、108、124 等)。我选择了字形 47

在此处输入图片描述

\handxform然后,我创建了用于旋转和缩放字形的宏,其中垂直比例由一个因子给出,水平比例由所需的长度给出(已编辑以解决缩放限制,以便遵守指定的实际宽度)。宏\handline[<thickness-scale>]{<length>}将字形 47 传递给\handxform,以及用户指定的缩放信息,以及将字形 47 转换为适当高度的水平方面所需的旋转。

以下 MWE 中的所有手绘线都是字形 47 的缩放、旋转版本。

\handstealthleftrightarrow[<thickness-scale>]{<length>}通过将字形 60 及其镜像串联起来,进行编辑以添加到混合中:

在此处输入图片描述

已编辑以添加\handbox[<thickness-scale>]{<length>}{<height>},其通过将 4 串在一起来实现\handline

\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}

在此处输入图片描述

在此处输入图片描述

讨论

下面有一些关于如何调整“嗖嗖”形状的问题。然而,这掩盖了对这里所做事情的根本误解。我所做的就是获取字体的字形,然后旋转/拉伸/重新旋转/平移/重新拉伸/重新平移它,以达到所需的大小和方向。嗖嗖的形状是由完全按所选的原始字形,在本答案中该字形来自 Teen Spirit 字体。

举个例子,如果我重新定义\handxform不使用 Teen Spirit 字体,并且用指定的字形代替,那么使用一个简单的\rule{1pt}{5pt}

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

\rule您将看到结果相应地发生变化,其中新的 swish 由转换后的字形 47 或 60 组成。

在此处输入图片描述

因此,如果要采用这种技术,为了获得其他形状,必须从其他字体中找到其他合适的字形。或者,有人可以使用它tikz设计所需的 swish,并将其合并到稍微重新定义的\handxform宏中。

作为一个说明性案例,我甚至可以使用 来\includegraphics作为 swish。理想情况下,它应该是透明的 png,但在这里,我只是截取了此页面顶部的图像,将其保存为 jpeg,尝试删除黑色文本,并将其用作 swish。显然,必须重新设计定义和参数以适应这一点(特别是因为纵横比不同),但结果看起来符合预期:

在此处输入图片描述

将图像的大版本保存为后greenswish.jpg,上述代码为:

\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}

答案2

这是对您可能做的事情的一个不完整且非常简单的演示,尽管它完全无法满足要求,但仍然相当耗时。

以下代码创建了一个相当简单的pic名为 的brush stroke。它接受一个键值选项列表。下面实现的选项是colourtextname

创建pic节点,然后根据 Lazur URH 作品中的描边矢量缩放范围和填充路径https://openclipart.org/detail/211152/brush-stroke-2,使用 Inkscape 提取并导出到 TikZ 代码。我稍微编辑了这段代码,并将填充颜色变成了一个变量,该变量拾取选项colour并使其部分透明。

\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}

结果相当平淡:

笔触

编辑

这是一个协调性较差的例子,仅用于演示,它将上面的内容与自定义箭头和pencil draw装饰结合在一起Claudio Fiandrino 的回答

协调性差的例子

\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}

编辑 编辑

这是一个版本,这次使用的代码来自Alain Matthes 的回答以获得手工雕刻的外观。如果您非常小心并且喜欢冒险,这种支持四舍五入的方式可以部分实现。(如果您的尺寸错误太大,则说明您已经超出了 TikZ 的限制。不出所料,这可能会随机变化。因此,一次运行成功并不能保证下一次使用相同代码也能成功!)

\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}

自由随意

查看答案这个问题(Alain 的答案只是众多优秀答案之一)介绍了使用 LaTeX 创造难以捉摸的“手工”外观的各种方法。并非所有答案都使用 TikZ,但很多答案都使用 TikZ。

注意Marc van Dongen 的回答显示了pencil draw应用于圆弧的方法。矩形角圆角的问题在于所需的圆弧非常小,这会产生各种复杂性,从而带来无穷无尽的麻烦。

相关内容