TeX - LaTeX Asked by GA316 on May 22, 2021
I need to draw the diagram similar to the one given below:
I haven’t drawn any diagrams in tex. So kindly suggest some methods in Latex to do it. Thank you.
This is a fast way to draw in TikZ
but it is not the right solution to draw. It is done with Mathcha.
documentclass[a4paper,12pt]{article}
usepackage{tikz}
usepackage{graphicx}
begin{document}
begin{figure}[h]
centering
tikzset{every picture/.style={line width=0.75pt}}
begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1]
draw (22,89) -- (228.5,89) ;
draw [dash pattern={on 0.84pt off 2.51pt}] (44.5,23.33) -- (44.5,89) ;
draw [dash pattern={on 0.84pt off 2.51pt}] (66.5,23.33) -- (66.5,89) ;
draw (48.25,52.42) .. controls (48.25,50.35) and (46.57,48.67) .. (44.5,48.67) .. controls (42.43,48.67) and (40.75,50.35) .. (40.75,52.42) .. controls (40.75,54.49) and (42.43,56.17) .. (44.5,56.17) .. controls (46.57,56.17) and (48.25,54.49) .. (48.25,52.42) -- cycle ;
draw [dash pattern={on 0.84pt off 2.51pt}] (88.5,23.33) -- (88.5,89) ;
draw [dash pattern={on 0.84pt off 2.51pt}] (110.5,23.33) -- (110.5,89) ;
draw [dash pattern={on 0.84pt off 2.51pt}] (132.5,23.33) -- (132.5,89) ;
draw (70.25,78.42) .. controls (70.25,76.35) and (68.57,74.67) .. (66.5,74.67) .. controls (64.43,74.67) and (62.75,76.35) .. (62.75,78.42) .. controls (62.75,80.49) and (64.43,82.17) .. (66.5,82.17) .. controls (68.57,82.17) and (70.25,80.49) .. (70.25,78.42) -- cycle ;
draw (70.25,78.42) -- (77.5,78.42) -- (84.75,78.42) ;
draw (92.25,78.42) .. controls (92.25,76.35) and (90.57,74.67) .. (88.5,74.67) .. controls (86.43,74.67) and (84.75,76.35) .. (84.75,78.42) .. controls (84.75,80.49) and (86.43,82.17) .. (88.5,82.17) .. controls (90.57,82.17) and (92.25,80.49) .. (92.25,78.42) -- cycle ;
draw (158.25,67.42) .. controls (158.25,65.35) and (156.57,63.67) .. (154.5,63.67) .. controls (152.43,63.67) and (150.75,65.35) .. (150.75,67.42) .. controls (150.75,69.49) and (152.43,71.17) .. (154.5,71.17) .. controls (156.57,71.17) and (158.25,69.49) .. (158.25,67.42) -- cycle ;
draw (158.25,67.42) -- (165.5,67.42) -- (172.75,67.42) ;
draw (180.25,67.42) .. controls (180.25,65.35) and (178.57,63.67) .. (176.5,63.67) .. controls (174.43,63.67) and (172.75,65.35) .. (172.75,67.42) .. controls (172.75,69.49) and (174.43,71.17) .. (176.5,71.17) .. controls (178.57,71.17) and (180.25,69.49) .. (180.25,67.42) -- cycle ;
draw [dash pattern={on 0.84pt off 2.51pt}] (154.5,23.33) -- (154.5,89) ;
draw [dash pattern={on 0.84pt off 2.51pt}] (176.5,23.33) -- (176.5,89) ;
draw [dash pattern={on 0.84pt off 2.51pt}] (198.5,23.33) -- (198.5,89) ;
draw (48.25,66.42) .. controls (48.25,64.35) and (46.57,62.67) .. (44.5,62.67) .. controls (42.43,62.67) and (40.75,64.35) .. (40.75,66.42) .. controls (40.75,68.49) and (42.43,70.17) .. (44.5,70.17) .. controls (46.57,70.17) and (48.25,68.49) .. (48.25,66.42) -- cycle ;
draw (48.25,66.42) -- (55.5,66.42) -- (62.75,66.42) ;
draw (70.25,66.42) .. controls (70.25,64.35) and (68.57,62.67) .. (66.5,62.67) .. controls (64.43,62.67) and (62.75,64.35) .. (62.75,66.42) .. controls (62.75,68.49) and (64.43,70.17) .. (66.5,70.17) .. controls (68.57,70.17) and (70.25,68.49) .. (70.25,66.42) -- cycle ;
draw (136.25,78.42) .. controls (136.25,76.35) and (134.57,74.67) .. (132.5,74.67) .. controls (130.43,74.67) and (128.75,76.35) .. (128.75,78.42) .. controls (128.75,80.49) and (130.43,82.17) .. (132.5,82.17) .. controls (134.57,82.17) and (136.25,80.49) .. (136.25,78.42) -- cycle ;
draw (180,78.42) .. controls (180,76.35) and (178.32,74.67) .. (176.25,74.67) .. controls (174.18,74.67) and (172.5,76.35) .. (172.5,78.42) .. controls (172.5,80.49) and (174.18,82.17) .. (176.25,82.17) .. controls (178.32,82.17) and (180,80.49) .. (180,78.42) -- cycle ;
draw (202.25,78.42) .. controls (202.25,76.35) and (200.57,74.67) .. (198.5,74.67) .. controls (196.43,74.67) and (194.75,76.35) .. (194.75,78.42) .. controls (194.75,80.49) and (196.43,82.17) .. (198.5,82.17) .. controls (200.57,82.17) and (202.25,80.49) .. (202.25,78.42) -- cycle ;
draw (243,89) -- (449.5,89) ;
draw [dash pattern={on 0.84pt off 2.51pt}] (265.5,23.33) -- (265.5,89) ;
draw [dash pattern={on 0.84pt off 2.51pt}] (287.5,23.33) -- (287.5,89) ;
draw (313.25,55.42) .. controls (313.25,53.35) and (311.57,51.67) .. (309.5,51.67) .. controls (307.43,51.67) and (305.75,53.35) .. (305.75,55.42) .. controls (305.75,57.49) and (307.43,59.17) .. (309.5,59.17) .. controls (311.57,59.17) and (313.25,57.49) .. (313.25,55.42) -- cycle ;
draw [dash pattern={on 0.84pt off 2.51pt}] (309.5,23.33) -- (309.5,89) ;
draw [dash pattern={on 0.84pt off 2.51pt}] (331.5,23.33) -- (331.5,89) ;
draw [dash pattern={on 0.84pt off 2.51pt}] (353.5,23.33) -- (353.5,89) ;
draw (313.25,78.42) .. controls (313.25,76.35) and (311.57,74.67) .. (309.5,74.67) .. controls (307.43,74.67) and (305.75,76.35) .. (305.75,78.42) .. controls (305.75,80.49) and (307.43,82.17) .. (309.5,82.17) .. controls (311.57,82.17) and (313.25,80.49) .. (313.25,78.42) -- cycle ;
draw (313.25,78.42) -- (320.5,78.42) -- (327.75,78.42) ;
draw (335.25,78.42) .. controls (335.25,76.35) and (333.57,74.67) .. (331.5,74.67) .. controls (329.43,74.67) and (327.75,76.35) .. (327.75,78.42) .. controls (327.75,80.49) and (329.43,82.17) .. (331.5,82.17) .. controls (333.57,82.17) and (335.25,80.49) .. (335.25,78.42) -- cycle ;
draw (335.25,67.42) .. controls (335.25,65.35) and (333.57,63.67) .. (331.5,63.67) .. controls (329.43,63.67) and (327.75,65.35) .. (327.75,67.42) .. controls (327.75,69.49) and (329.43,71.17) .. (331.5,71.17) .. controls (333.57,71.17) and (335.25,69.49) .. (335.25,67.42) -- cycle ;
draw (335.25,67.42) -- (342.5,67.42) -- (349.75,67.42) ;
draw (357.25,67.42) .. controls (357.25,65.35) and (355.57,63.67) .. (353.5,63.67) .. controls (351.43,63.67) and (349.75,65.35) .. (349.75,67.42) .. controls (349.75,69.49) and (351.43,71.17) .. (353.5,71.17) .. controls (355.57,71.17) and (357.25,69.49) .. (357.25,67.42) -- cycle ;
draw [dash pattern={on 0.84pt off 2.51pt}] (375.5,23.33) -- (375.5,89) ;
draw [dash pattern={on 0.84pt off 2.51pt}] (397.5,23.33) -- (397.5,89) ;
draw [dash pattern={on 0.84pt off 2.51pt}] (419.5,23.33) -- (419.5,89) ;
draw (291.25,67.42) .. controls (291.25,65.35) and (289.57,63.67) .. (287.5,63.67) .. controls (285.43,63.67) and (283.75,65.35) .. (283.75,67.42) .. controls (283.75,69.49) and (285.43,71.17) .. (287.5,71.17) .. controls (289.57,71.17) and (291.25,69.49) .. (291.25,67.42) -- cycle ;
draw (291.25,67.42) -- (298.5,67.42) -- (305.75,67.42) ;
draw (313.25,67.42) .. controls (313.25,65.35) and (311.57,63.67) .. (309.5,63.67) .. controls (307.43,63.67) and (305.75,65.35) .. (305.75,67.42) .. controls (305.75,69.49) and (307.43,71.17) .. (309.5,71.17) .. controls (311.57,71.17) and (313.25,69.49) .. (313.25,67.42) -- cycle ;
draw (379.25,78.42) .. controls (379.25,76.35) and (377.57,74.67) .. (375.5,74.67) .. controls (373.43,74.67) and (371.75,76.35) .. (371.75,78.42) .. controls (371.75,80.49) and (373.43,82.17) .. (375.5,82.17) .. controls (377.57,82.17) and (379.25,80.49) .. (379.25,78.42) -- cycle ;
% Text Node
draw (38,94.83) node [anchor=north west][inner sep=0.75pt] {$0$};
% Text Node
draw (60,94.83) node [anchor=north west][inner sep=0.75pt] {$1$};
% Text Node
draw (82,94.83) node [anchor=north west][inner sep=0.75pt] {$2$};
% Text Node
draw (127,94.83) node [anchor=north west][inner sep=0.75pt] {$4$};
% Text Node
draw (104,94.83) node [anchor=north west][inner sep=0.75pt] {$3$};
% Text Node
draw (150,94.83) node [anchor=north west][inner sep=0.75pt] {$5$};
% Text Node
draw (171,94.83) node [anchor=north west][inner sep=0.75pt] {$6$};
% Text Node
draw (195,94.83) node [anchor=north west][inner sep=0.75pt] {$7$};
% Text Node
draw (259,94.83) node [anchor=north west][inner sep=0.75pt] {$0$};
% Text Node
draw (281,94.83) node [anchor=north west][inner sep=0.75pt] {$1$};
% Text Node
draw (303,94.83) node [anchor=north west][inner sep=0.75pt] {$2$};
% Text Node
draw (348,94.83) node [anchor=north west][inner sep=0.75pt] {$4$};
% Text Node
draw (324,94.83) node [anchor=north west][inner sep=0.75pt] {$3$};
% Text Node
draw (371,94.83) node [anchor=north west][inner sep=0.75pt] {$5$};
% Text Node
draw (392.25,94.83) node [anchor=north west][inner sep=0.75pt] {$6$};
% Text Node
draw (412,94.83) node [anchor=north west][inner sep=0.75pt] {$7$};
end{tikzpicture}
caption{Two heaps of monomers and dimers}
end{figure}
end{document}
Answered by Sebastiano on May 22, 2021
A short code for the left diagram with pstricks
:
documentclass[svgnames]{article}
usepackage{pst-plot}%
usepackage{pst-node, multido}
begin{document}
begin{pspicture}
psaxes[yAxis = false, ticks=none]{-}(0,0)(-0.9,0)(7.9,0)
multido{i=0+1}{8}{psline[linestyle=dotted, linewidth=1pt](i,0)(i,2.4)}
pnodes{C}(0,1.4)(0,1)(1,1)(1,0.6)(2,0.6)(4,0.6)(5,1)(6,1)(6,0.6)(7,0.6)
foreach i in {0,1,...,8}{pscircle[linewidth=0.6pt, fillstyle=solid, fillcolor=white](Ci){0.15}}%
foreachi/j in {C1/C2,C3/C4,C6/C7} {ncline{i}{j}}
end{pspicture}
end{document}
Answered by Bernard on May 22, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP