我怎样才能得到这张图?你能帮我一下吗?我很差劲@tkiz
启动 MWE:
\documentclass[border=3mm,tikz,preview]{standalone}
\usetikzlibrary{arrows.meta,%
backgrounds,%
calc,%
fit,%
positioning,
scopes,shadows}
\makeatletter
\def\tikzsavelastnodename#1{\let#1=\tikz@last@fig@name}
\makeatother
\begin{document}
%---------------------------------------------------------------%
\begin{tikzpicture}[
> = {Triangle[]},
node distance = 2mm and 7mm,
% for labels inside node shape
inlabel/.style args =
{#1:#2}{append after command=
{node[inner sep=1mm,anchor=#1] at (\tikzsavednodename.#1) {#2}}
},
% schemas' blocks
atomic/.style = {draw, thick, fill=white,
minimum size=1.5cm, drop shadow,
append after command= {\pgfextra{\tikzsavelastnodename\tikzsavednodename}},#1
},
io/.style = {draw, thick, fill=white, circle, drop shadow},
]
%---
\node[atomic,
inlabel=west:$X_A$,
inlabel=east:$Y_A$,
inlabel=south:$A$,
] (a) {};
\node[io,below right=of a.south east] (zn) {$Z_N$};
\node[atomic,
inlabel=west:$X_A$,
inlabel=east:$Y_A$,
inlabel=south:$B$,
below left=of zn] (b) {};
\node[io, left=of a] (za) {$Z_A$};
\node[io, left=of b] (zb) {$Z_B$};
%
\coordinate[left=of za.150] (xn');
\coordinate[left=of xn'] (xn);
\coordinate[left=4mm of zn.150] (zn');
\coordinate[right=of zn] (yn);
% lines connecting block A
\draw[->] (xn) node[left] {$X_N$} -- (za.150);
\draw[->] (za) edge (a);
\draw[->] (a.east) -| (zn') -| (xn' |- za.210) -- (za.210);
\draw[->] (zn') -- (zn.150);
% lines connecting block B
\draw[->] (zb) -- (b);
\draw[->] (b) -| (zn' |- zn.210) -- (zn.210);
\draw[->] (xn' |- zn') |- (zb);
\draw[->] (zn) -- (yn) node[right] {$Y_N$};
% outer block (N)
\scoped[on background layer]
\node[atomic,inner xsep=0mm,
fit=(xn) (a) (yn) (b),
inlabel=south west:$N$] {};
\end{tikzpicture}
%---------------------------------------------------------------%
\end{document}
答案1
我尝试了一些东西。也许你想使用\usepackage{tikzpeople}
。你可以从这个开始:我在这里找到了计算机的代码:
https://texample.net/tikz/examples/computer-diagram/
% Computer diagram
% Author: Elke Schubert
\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{positioning}
\usepackage{tikzpeople}
\usetikzlibrary{backgrounds,calc,shadings,shapes.arrows,shapes.symbols,shadows}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% taken from: https://texample.net/tikz/examples/computer-diagram/
\usetikzlibrary{fit}
\tikzset{
comp/.style = {
minimum width = 8cm,
minimum height = 4.5cm,
text width = 8cm,
inner sep = 0pt,
text = green,
align = center,
font = \Huge,
transform shape,
thick
},
monitor/.style = {draw = none, xscale = 18/16, yscale = 11/9},
display/.style = {shading = axis, left color = black!60, right color = black},
ut/.style = {fill = gray}
}
\tikzset{
computer/.pic = {
% screen (with border)
\node(-m) [comp, pic actions, monitor]
{\phantom{\parbox{\linewidth}{\tikzpictext}}};
% display (without border)
\node[comp, pic actions, display] {\tikzpictext};
\begin{scope}[x = (-m.east), y = (-m.north)]
% filling the lower part
\path[pic actions, draw = none]
([yshift=2\pgflinewidth]-0.1,-1) -- (-0.1,-1.3) -- (-1,-1.3) --
(-1,-2.4) -- (1,-2.4) -- (1,-1.3) -- (0.1,-1.3) --
([yshift=2\pgflinewidth]0.1,-1);
% filling the border of the lower part
\path[ut]
(-1,-2.4) rectangle (1,-1.3)
(-0.9,-1.4) -- (-0.7,-2.3) -- (0.7,-2.3) -- (0.9,-1.4) -- cycle;
% drawing the frame of the whole computer
\path[pic actions, fill = none]
(-1,1) -- (-1,-1) -- (-0.1,-1) -- (-0.1,-1.3) -- (-1,-1.3) --
(-1,-2.4) coordinate(sw)coordinate[pos=0.5] (-b west) --
(1,-2.4) -- (1,-1.3) coordinate[pos=0.5] (-b east) --
(0.1,-1.3) -- (0.1,-1) -- (1,-1) -- (1,1) -- cycle;
% node around the whole computer
\node(-c) [fit = (sw)(-m.north east), inner sep = 0pt] {};
\end{scope}
}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\begin{tikzpicture}[mylabel/.style={text width=8 mm, align=center}]
\node[draw] at (0,10.5) {closed room};
\node[police,minimum size=1.5cm] (B) at (0,4) {Interrogator};
\node[duck,minimum size=1.5cm,mirrored,good] (B) at (10,4) {User};
filldraw (0,4) node [below] {center here} circle (1pt);
\node [draw,dashed, very thick, shape=rectangle, minimum width=10cm, minimum height=10cm, anchor=center] at (0,5) {};
\pic(comp0) [draw,scale=0.4,fill = gray!20, pic text = {Supercomputer}] at (-8,2) {computer};
\node[draw,text width=4cm] at (-8,-1.5) {Supercomputer running an intelligent program};
\draw[thick] (-3,4) -- (-6.2,2.5);
\pic(comp0) [draw,scale=0.2,fill = gray!20, pic text = {something}] at (7,4) {computer};
\node[draw] at (7,2) {T3};
\pic(comp1) [draw,scale=0.2,fill = gray!20, pic text = {CAT}] at (3,4) {computer};
\node[draw] at (3,2) {T2};
\pic(comp0) [draw,scale=0.2,fill = gray!20, pic text = {DOG}] at (-3,4) {computer};
\node[draw] at (-3,2) {T1};
\draw[thick] (4,4) -- (6,3.5);
\node[draw] at (0,-1) {T1, T2, T3: Dumb Terminals};
\end{tikzpicture}
\end{document}