绘制菱形格子

绘制菱形格子

我如何绘画
这个图?

\documentclass[12pt,a4paper]{article}  
\usepackage{graphicx}  
\usepackage{circuitikz}
\usepackage[utf8x]{inputenc}
\usepackage{tikz}
\begin{document}  
    \begin{circuitikz}
            \node (A) at (-1,0) {$a$};
            \node (1) at (0,1) {$1$};
            \node (C) at (0,0) {$c$};
            \node (B) at (1,0) {$b$};
            \node (0) at (0,-1) {$0$};
            \draw
              (A)  -- ++ to [short, o-*]       ++   (1)
                    to [short, o-*]       ++   (B)
                    to [short, o-*]       ++   (0)
              ; 
        \end{circuitikz}
\end{document}

我首先尝试用 绘制此图tikzpicture,但圆圈不可用tikzpicture(我认为)。所以接下来我尝试用circuitikz。但我无法连接节点。

答案1

使用纯净的tikz

\documentclass[12pt,margin=3.141592]{standalone}
\usepackage{tikz}

\begin{document}
    \begin{tikzpicture}[
C/.style = {circle, draw, fill=white, inner sep=1mm,
            label=#1,
            node contents={}},
every label/.append style = {inner sep=2pt, font=\small}
                        ]
\draw (-1,0) node       [C=left:$a$]    -- (0,1) 
             node (c1)  [C=$1$]         -- (1,0)
             node       [C=right:$b$]   -- (0,-1)
             node (c0)  [C=below:0]     -- cycle
             ;
\draw (c1)  --  (0,0) node[C=left:$c$]
            --  (c0);
    \end{tikzpicture}
\end{document}

在此处输入图片描述

答案2

使用pstricks,它需要一个非常短的代码:

\documentclass[border=6pt]{standalone}
\usepackage{pst-eucl}

\begin{document}

  \begin{pspicture}(-1.5,-1.5)(1.5,1.5)
    \pstGeonode[PointSymbol=o, PosAngle={180,180,180}](-1,0){a}(0,0){c}(1,0){b}
    \pstGeonode[PointSymbol=o, PointName={1,0}, PosAngle={90,-90}](0,1.1){i}(0,-1.1){j}
    \foreach \s/\t in{a/i, i/b, b/j, j/a, i/c, c/j}{\ncline[linewidth=0.4pt, nodesep=1.8pt]{\s}{\t}}
  \end{pspicture}

\end{document} 

在此处输入图片描述

答案3

使用纯 TikZ/Mathcha 编辑器:

%% Compile and read me!
\documentclass[a4paper,12pt]{article}
\usepackage{tikz}


\begin{document}


\tikzset{every picture/.style={line width=0.75pt}} %set default line width to 0.75pt        

\begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1]
%uncomment if require: \path (0,434); %set diagram left start at 0, and has height of 434

%Straight Lines [id:da20828161722683225] 
\draw    (226.89,86.8) -- (226.89,237.8) ;
%Shape: Diamond [id:dp9171337707281815] 
\draw   (226.89,86.8) -- (288.98,162.3) -- (226.89,237.8) -- (164.8,162.3) -- cycle ;
%Shape: Circle [id:dp20974285465516052] 
\draw  [fill={rgb, 255:red, 255; green, 255; blue, 255 }  ,fill opacity=1 ] (158.9,162.3) .. controls (158.9,159.04) and (161.54,156.4) .. (164.8,156.4) .. controls (168.06,156.4) and (170.7,159.04) .. (170.7,162.3) .. controls (170.7,165.56) and (168.06,168.2) .. (164.8,168.2) .. controls (161.54,168.2) and (158.9,165.56) .. (158.9,162.3) -- cycle ;
%Shape: Circle [id:dp8683918561204362] 
\draw  [fill={rgb, 255:red, 255; green, 255; blue, 255 }  ,fill opacity=1 ] (220.89,86.8) .. controls (220.89,83.54) and (223.53,80.9) .. (226.79,80.9) .. controls (230.05,80.9) and (232.69,83.54) .. (232.69,86.8) .. controls (232.69,90.06) and (230.05,92.7) .. (226.79,92.7) .. controls (223.53,92.7) and (220.89,90.06) .. (220.89,86.8) -- cycle ;
%Shape: Circle [id:dp39794595778692865] 
\draw  [fill={rgb, 255:red, 255; green, 255; blue, 255 }  ,fill opacity=1 ] (220.99,236.8) .. controls (220.99,233.54) and (223.63,230.9) .. (226.89,230.9) .. controls (230.15,230.9) and (232.79,233.54) .. (232.79,236.8) .. controls (232.79,240.06) and (230.15,242.7) .. (226.89,242.7) .. controls (223.63,242.7) and (220.99,240.06) .. (220.99,236.8) -- cycle ;
%Shape: Circle [id:dp9061896064627495] 
\draw  [fill={rgb, 255:red, 255; green, 255; blue, 255 }  ,fill opacity=1 ] (281.08,163.2) .. controls (281.08,159.94) and (283.73,157.3) .. (286.98,157.3) .. controls (290.24,157.3) and (292.88,159.94) .. (292.88,163.2) .. controls (292.88,166.46) and (290.24,169.1) .. (286.98,169.1) .. controls (283.73,169.1) and (281.08,166.46) .. (281.08,163.2) -- cycle ;
%Shape: Circle [id:dp9109747529820003] 
\draw  [fill={rgb, 255:red, 255; green, 255; blue, 255 }  ,fill opacity=1 ] (220.99,162.3) .. controls (220.99,159.04) and (223.63,156.4) .. (226.89,156.4) .. controls (230.15,156.4) and (232.79,159.04) .. (232.79,162.3) .. controls (232.79,165.56) and (230.15,168.2) .. (226.89,168.2) .. controls (223.63,168.2) and (220.99,165.56) .. (220.99,162.3) -- cycle ;

% Text Node
\draw (222,60.4) node [anchor=north west][inner sep=0.75pt]    {$1$};
% Text Node
\draw (222,249.4) node [anchor=north west][inner sep=0.75pt]    {$0$};
% Text Node
\draw (141,155) node [anchor=north west][inner sep=0.75pt]    {$a$};
% Text Node
\draw (205,155) node [anchor=north west][inner sep=0.75pt]    {$c$};
% Text Node
\draw (267,155) node [anchor=north west][inner sep=0.75pt]    {$b$};


\end{tikzpicture}

\end{document}

在此处输入图片描述

相关内容