如何在乳胶中绘制下面的网络?

如何在乳胶中绘制下面的网络?

在此处输入图片描述

我是 Latex 新手,我必须在 Latex 中绘制上述图表。有人能帮我吗,如何在 Latex 中绘制上述网络图。

答案1

你可以用 来获得它。如果你用开关(MiKTeX) 或(TeX Live, MacTeX)启动它pstricks,它就可以被编译。pdflatex--enable-write18--shell-escape

\documentclass[border=3pt, x11names]{standalone}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}%
\usepackage{lmodern}
\usepackage{mathtools}
\usepackage{pstricks-add}
\usepackage{auto-pst-pdf}
\pagestyle{empty}

\begin{document}

\begin{pspicture}(-2,-6)(7,6)
    \everypsbox{\scriptsize}
    \psset{linewidth=0.5pt, dotsize=4pt, linecolor=SlateGray3, yunit=0.5, arrowinset=0.15, shortput=nab, linejoin =1}
    \multido{\i=2 + 1}{4}{\dotnode[href = 2ex, vref = 2ex](0,\i){A\i}}
    \multido{\i=2 + 1}{4}{\dotnode[href = 2ex, vref = 2ex](0,-\i){B\i}}
    \pnodes(-1ex,5){A’}(-1ex,-5){B’}
    \psset{yunit=1.33}
    \multido{\i=1+1}{4}{\dotnode(4,\i){C\i}}
    \pnodes(4.15,4){D}(4.15,1){C}
    \uput[u](0,4.5){\em item}
    \uput[u](4,4.5){\em container}
    \psset{linecolor=black, arrows=-> , arrowinset=0.15, labelsep=1pt, npos=0.6}
    \ncline{A5}{C4}\naput{$1$}
    \ncline{A5}{C3}\naput{$2$}
    \ncline{A5}{C2}\naput{$3$}
    \ncline{B5}{C1}\naput{$\mathrm {j\times i}$}
    \psset{braceWidthInner=3pt,braceWidthOuter=3pt, braceWidth =0.6pt, nodesepA =-5pt}
    \psbrace[rot=180](A’)(B’){$ j $}
    \psbrace[nodesepA=1pt](C)(D){$ i $}
    \psset{linestyle=dotted, linewidth=0.8pt, linecolor=black, arrows=-, nodesep=8pt}
    \ncline{A2}{B2}
    \pcline[offset=2.4cm, nodesep =-3pt](C1)(C2)
\end{pspicture}

\end{document} 

在此处输入图片描述

答案2

luamplib这是使用 TeX Gyre Termes 字体完成的版本。使用 进行处理lualatex

在此处输入图片描述

\documentclass[margin=5mm]{standalone}
\usepackage{fontspec}
\usepackage{unicode-math}
\setmainfont{TeX Gyre Termes}
\setmathfont{TeX Gyre Termes Math}
\usepackage{luamplib}
\begin{document}
\begin{mplibcode}
beginfig(1);
u := 20;
z0 = (u,u); z1 = (7u,u);
label(btex \textit{item}      etex, z0);
label(btex \textit{container} etex, z1);

path a[], c; picture dot;
a1 = (x0, 0)  -- (x1, 0);
a2 = (x0, 0)  -- (x1,-1.2u);
a3 = (x0, 0)  -- (x1,-2.4u);
a4 = (x0,-8u) -- (x1,-3.6u);
c = fullcircle scaled 4;
dot = image(fill c withcolor .67[blue, white]; draw c);

label.top(btex $1$ etex, point 0.6 of a1);
label.top(btex $2$ etex, point 0.6 of a2);
label.top(btex $3$ etex, point 0.6 of a3);
label.ulft(btex $j\times i$ etex, point 0.68 of a4);
label(btex $\vdots$ etex, 1/3[point 0.6 of a3, point 0.6 of a4]);
label(btex $\vdots$ etex, 1/2[point 0 of a1, point 0 of a4]);

for i=1 upto 4:
  drawarrow a[i] cutafter c shifted point 1 of a[i];
endfor
for i=1 upto 4:
  draw dot shifted point 1 of a[i];
  draw dot shifted point 0 of a1 shifted (0,u*(1-i));
  draw dot shifted point 0 of a4 shifted (0,u*(i-1));
endfor

vardef vbrace(expr a,b,n,m,s) =
  save offset, midpoint, bearing; 
  pair offset, midpoint, bearing; 
  offset = right scaled n;
  midpoint = 1/2[a,b] shifted (m,0);
  bearing = unitvector(b-a);
  label(s,midpoint+8unitvector(offset));
  (a {offset} ... 
  1/2[a,midpoint]{bearing} ... 
  {offset}
  midpoint 
  {-offset} ... 
  1/2[midpoint,b]{bearing} ...
  {-offset} b) shifted offset
enddef;

draw vbrace(point 0 of a1, point 0 of a4, -5, -12, btex $j$ etex);
draw vbrace(point 1 of a1, point 1 of a4,  5,  12, btex $i$ etex);

endfig;
\end{mplibcode}
\end{document}

相关内容