TeX - LaTeX Asked on January 1, 2021
I need to produce a diagram where I can put a picture of a brain in the middle of the diagram as follows:
My working trial is as follows:
documentclass{article}
usepackage{tikz}
usetikzlibrary{matrix}
usetikzlibrary{arrows,matrix,positioning,shapes,arrows,fit,shapes.geometric,calc, intersections}
newcommand{tikznode}[2]{relax
ifmmode%
tikz[remember picture,baseline=(#1.base),inner sep=0pt] node (#1) {$#2$};
else
tikz[remember picture,baseline=(#1.base),inner sep=0pt] node (#1) {#2};%
fi}
%
begin{document}
begin{figure}[!h]
centering
begin{tikzpicture}
[
squarednode/.style={%
rectangle,
draw=black!60,
fill=white,
very thick,
minimum size=5mm,
text centered,
text width=1.5cm,
}
]
%Nodes
node[squarednode] (maintopic) {BM};
node[squarednode] (uppersquare) [above=of maintopic] {MC};
node[squarednode] (rightsquare) [right=2.5cm of maintopic] {FM};
node[squarednode] (lowersquare) [above=of rightsquare] {TM};
%Lines
draw[->] (uppersquare.south) -- node[anchor=east] {} (maintopic.north);
draw[->] (maintopic.east) -- node[anchor=south] {} (rightsquare.west);
draw[->] (rightsquare.north) -- node[anchor=west] {} (lowersquare.south);
draw[->] (uppersquare.east) -- (lowersquare.west);
end{tikzpicture}
caption{The model of $FTTM$.}
label{figure:FTTM}
end{figure}
end{document}
that produces:
The picture that I want to put in the middle of the diagram is:
How can I achieve this?
The following could get you started. I have added the image first and arranged the boxes reltive to the image:
documentclass{article}
usepackage{tikz}
usetikzlibrary{matrix}
usetikzlibrary{arrows,matrix,positioning,shapes,arrows,fit,shapes.geometric,calc, intersections}
newcommand{tikznode}[2]{relax
ifmmode%
tikz[remember picture,baseline=(#1.base),inner sep=0pt] node (#1) {$#2$};
else
tikz[remember picture,baseline=(#1.base),inner sep=0pt] node (#1) {#2};%
fi}
%
begin{document}
begin{figure}[!h]
centering
begin{tikzpicture}
[
squarednode/.style={%
rectangle,
draw=black!60,
fill=white,
very thick,
minimum size=5mm,
text centered,
text width=1.5cm,
node distance=0.25cm
}
]
%Nodes
node (brain) {includegraphics[width=3cm]{example-image}};
node[squarednode] (maintopic) [below left=of brain]{BM};
node[squarednode] (uppersquare) [above left=of brain] {MC};
node[squarednode] (rightsquare) [below right=of brain] {FM};
node[squarednode] (lowersquare) [above right=of brain] {TM};
%Lines
draw[->] (uppersquare.south) -- node[anchor=east] {} (maintopic.north);
draw[->] (maintopic.east) -- node[anchor=south] {} (rightsquare.west);
draw[->] (rightsquare.north) -- node[anchor=west] {} (lowersquare.south);
draw[->] (uppersquare.east) -- (lowersquare.west);
end{tikzpicture}
caption{The model of $FTTM$.}
label{figure:FTTM}
end{figure}
end{document}
Correct answer by leandriis on January 1, 2021
For compare purpose.
Compile with Asymptote.
settings.tex="pdflatex"; // This command is very important!
size(5cm,4cm,false);
defaultpen(fontsize(10pt));
label(graphic("brain.jpg" ,"width=3cm"),(0,0)); // in the same folder.
layer();
label("BM",(-10,-10));
label("MC",(-10,10));
label("TM",(10,10));
label("FM",(10,-10));
draw((-10,-10)--(10,-10),Arrow,Margin(7,7));
draw((10,-10)--(10,10),Arrow,Margin(7,7));
draw((-10,10)--(-10,-10),Arrow,Margin(7,7));
draw((-10,10)--(10,10),dashed,Arrow,Margin(7,7));
shipout(bbox(2mm,FillDraw(white)));
The output is .pdf
file and then using includegraphics
command normally.
Answered by Nguyen Van Chi on January 1, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP