我正在尝试做一个图形,这个想法是
三角形 + 三角形 + 点
我做了三角形,但是加号和点没有对齐。
以下是我目前得到的信息
\begin{figure}[!htb]
\centering
\begin{tikzpicture}[scale = 0.5]
\foreach \x in {-1,0,1} \draw[fill] (\x,0) circle (4pt);
\draw[fill] (-.5,{sqrt(3)/2}) circle (4pt);
\draw[fill] (.5,{sqrt(3)/2}) circle (4pt);
\draw[fill] (0,{sqrt(3)}) circle (4pt);
\node at (0,-.75)
\end{tikzpicture}
%\end{figure}
\hspace{1cm}
$+$
\hspace{1cm}
%\begin{figure}[!htb]
%\centering
\begin{tikzpicture}[scale = 0.5]
\foreach \x in {-1,0,1} \draw[fill] (\x,0) circle (4pt);
\draw[fill] (-.5,{sqrt(3)/2}) circle (4pt);
\draw[fill] (.5,{sqrt(3)/2}) circle (4pt);
\draw[fill] (0,{sqrt(3)}) circle (4pt);
\node at (0,-.75)
\end{tikzpicture}
%\end{figure}
\hspace{1cm}
\begin{tikzpicture} %Here I tried differently from the above, but it was even worse
draw[fill] (0, sqrt(3)/2){+}
\end{tikzpicture}
\hspace{1cm}
%\begin{figure}[!htb]
%\centering
\begin{tikzpicture}[scale = 0.5]
\draw[fill] (0,sqrt(3)/2) circle (4pt);
\end{tikzpicture}
\end{figure}
提前致谢!
答案1
使用shapes
库,可以获得以下输出。
\documentclass[margin=3mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes}
\usetikzlibrary{positioning,calc}
\begin{document}
\begin{tikzpicture} [scale = 0.5,
triangle/.style = {fill=white, regular polygon, regular polygon sides=3,minimum size=2cm }
]
\node (tr1)[triangle] {};
\foreach \c in {1,2,3}{
\draw[fill] (tr1.corner \c) circle (4pt);}
\draw[fill] ($(tr1.corner 1)!0.5!(tr1.corner 2)$)circle (4pt);
\draw[fill] ($(tr1.corner 2)!0.5!(tr1.corner 3)$)circle (4pt);
\draw[fill] ($(tr1.corner 3)!0.5!(tr1.corner 1)$)coordinate (P1) circle (4pt);
\begin{scope}[shift={(8,0)}]
\node (tr2)[triangle] {};
\foreach \c in {1,2,3}{
\draw[fill] (tr2.corner \c) circle (4pt);}
\draw[fill] ($(tr2.corner 1)!0.5!(tr2.corner 2)$)coordinate (P2)circle (4pt);
\draw[fill] ($(tr2.corner 2)!0.5!(tr2.corner 3)$)circle (4pt);
\draw[fill] ($(tr2.corner 3)!0.5!(tr2.corner 1)$) circle (4pt);
\end{scope}
\node at ($(P1)!0.5!(P2)$) {$+$};
\end{tikzpicture}
\end{document}
答案2
\documentclass{standalone}
\usepackage{ tikz}
\begin{document}
\begin{tikzpicture}[scale = 0.5]
\foreach \x in {-1,0,1}
\draw[fill] (\x,0) circle (4pt);
\draw[fill] (-.5,{sqrt(3)/2}) circle (4pt);
\draw[fill] (.5,{sqrt(3)/2}) circle (4pt);
\draw[fill] (0,{sqrt(3)}) circle (4pt);
% \node at (0,-.75) {};
\end{tikzpicture}
\hspace{1cm}
$+$
\hspace{1cm}
%
\begin{tikzpicture}[scale = 0.5]
\foreach \x in {-1,0,1} \draw[fill] (\x,0) circle (4pt);
\draw[fill] (-.5,{sqrt(3)/2}) circle (4pt);
\draw[fill] (.5,{sqrt(3)/2}) circle (4pt);
\draw[fill] (0,{sqrt(3)}) circle (4pt);
% \node at (0,-.75) {};
\end{tikzpicture}
\end{document}