在图中插入方程式

在图中插入方程式

我是 LaTeX 新手。有人可以分享在 LaTeX 中实现下图的相关资料吗?

在此处输入图片描述

答案1

好吧,我例外地做到了这一点(到目前为止,你没有展示出任何努力,主要是为了好玩和锻炼:-)。

通过使用mathtools数学和纯粹的tikz其他方法:

\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{arrows.meta,
                positioning,
                shapes.arrows,
                shapes.multipart}
\usepackage{mathtools}

\begin{document}

    \begin{tikzpicture}[
    node distance = 4mm and 3mm,
                > = Straight Barb,
       arr/.style = {single arrow, draw=blue!60, thick, %fill=blue!30,
                     single arrow head extend=1.5mm, shape border rotate=180,
                     minimum height=7mm, minimum width=8mm,
                     node contents={}},
        NN/.style = {rectangle split, rectangle split parts=2,
                     draw=blue!60, thick,
                     rectangle split part fill={blue!40, white},
                     rectangle split part align={center,left}
                     },
       prm/.style = {rectangle, draw=blue!60, minimum size=8mm},
                        ]
\node (n1)  [NN, below] {\nodepart{one} \bfseries\textcolor{SHA-1 Operation}
                         \nodepart{two} $\begin{aligned}
                         a_t & = \mathsf{ROTL}^5(a_{t-1}) + \\
                             &  \qquad   f_t(_{t-1},c_{t-1}) + e_t + W_t + K_t\\
                         b_t & = a_{t-1}    \\
                         c_t & = \mathsf{ROTL}^{30}(B_{t-1})\\
                         d_t & = c_{t-1}\\
                         e_t & = d_{t-1}
                                         \end{aligned}$
                         };
\coordinate[above=of n1] (aux1);
\coordinate[left =of n1] (aux2);
\coordinate[below=of n1] (aux3);
\path[draw=blue!70,->, semithick] (n1) -- (aux3) -| (aux2) node[left] {80}
                           |- (aux1) -- (n1);
% right perimeter
\node (n2) [arr,above right=of n1.two east];
\node (n3) [prm,right=of n2] {$W^t$};
\node (n4) [arr,below right=of n1.two east];
\node (n5) [prm,right=of n4] {$K^t$};
% equations below
\node[align=left, below = of aux3]   {$\begin{aligned}
    W_t & = \begin{cases*}  xxxx    & if $80>t\geq 16$ \\
                            yyyy    & if $0 <t<    16$
            \end{cases*}    \\
    K_t & = \begin{cases*}  xxxx    & if $80>t\geq 16$ \\
                            yyyy    & if $0 <t<    16$ \\
                            zzzz    & if $0 <t<    16$ \\
                            wwww    & if $0 <t<    16$
            \end{cases*}    \\
f_t(b,c,d)
    & = \begin{cases*}  xxxx    & if $80>t\geq 16$ \\
                            yyyy    & if $0 <t<    16$ \\
                            zzzz    & if $0 <t<    16$ \\
                            wwww    & if $0 <t<    16$
            \end{cases*}
                                    \end{aligned}$
                    };
    \end{tikzpicture}
\end{document}

方程是符号的。正确的变量你应该自己写出来。

在此处输入图片描述

答案2

你可以这样做:

1)tcolorbox第一个箱子的包装

2)tikz通用解决方案和形状的包——shapes.arrows对于粗箭头也需要 tikzlibrary(代码来自这里: https://tex.stackexchange.com/a/247875/120578经过@安德鲁

3)amsmath数组包

4)可能需要caption包来包含图形或其他带有标题的环境,而这些标题不能包含在小页面中。

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes.arrows}%for the blue arrows
\usepackage{amsmath}%For array
\usepackage{caption}%For including figures or other not accepted environments in minipage
\usepackage{tcolorbox}%For the colorbox
\usepackage{lipsum}%for pseudo-random text


\begin{document}
\lipsum[1]
\vspace{\baselineskip}

\noindent\begin{tikzpicture}
    %Arrow style from here : https://tex.stackexchange.com/a/247875/120578
    \tikzset{>=stealth,->,shorten >=2pt,looseness=.5,auto,shape border rotate=180,
    fat arrow/.style={single arrow,
                          thick,draw=blue!70,fill=blue!30,
                          minimum height=13mm,minimum width=11mm}}
  \coordinate(TopLeft);
  \node[anchor=west,inner sep=0](First) at(TopLeft)
       {\begin{tcolorbox}
           [width=0.4\textwidth,title={Example for a box}]
           \begin{align*}a_t&=S(x)+f(3\cdot t)-5\\
             b_t&=(x-1)\cdot\frac{5}{t-4}
           \end{align*}\end{tcolorbox}};
       \coordinate (mbot)at (First.south);
       \coordinate (mtop)at (First.north);
       \coordinate (mleft)at (First.west);
       \coordinate (mright) at(First.east);
       \draw[thick,blue,->] (mbot)|-([yshift=-0.2cm]mbot)-|([xshift=-0.6cm]mleft)|-([yshift=0.5cm]mtop)-|(mtop);
       \node (J)at ([xshift=1cm,yshift=0.6cm]mright)[fat arrow]{};
       \node at ([xshift=1.2cm]J){$f_1(j)$};
       \node (K)at ([xshift=1cm,yshift=-0.6cm]mright)[fat arrow]{};
       \node at ([xshift=1.2cm]K){$\frac{m-1}{3}$};
       \node[anchor=west] at ([yshift=-3cm]TopLeft) {\begin{minipage}{0.4\textwidth}\[\left[\begin{array}{ccc}3 &4 &f(x-2)\\
               9 &-6& j+5\\
               45 &-f_3(H+\alpha)
             \end{array}\right.\]\end{minipage}};
      \node[anchor=west,inner sep=0] at ([yshift=-5cm]TopLeft) {\begin{minipage}{0.8\textwidth}\begin{equation}\left[\begin{array}{ccc}3 &4 &f(x-2)\\
               9 &-6& j+5\\
               45 &-f_3(H+\alpha)
              \end{array}\right]\end{equation}\end{minipage}};
      \node[anchor=west] at ([yshift=-8.5cm]TopLeft) {\begin{minipage}{\textwidth}\begin{center}\captionof{figure}{My figure here}\includegraphics[width=3cm]{example-image-a}\end{center}\end{minipage}};
                  \node[anchor=west] at ([yshift=-10cm]TopLeft) {\begin{minipage}{0.3\textwidth}\[F(z)=0\;\;\text{(continue math)}\]\end{minipage}};
\end{tikzpicture}

\end{document}

输出:

在此处输入图片描述

相关内容