无需附加软件包:

无需附加软件包:

在此处输入图片描述

我第一次使用 latex。我想画下面的图。该怎么做?

答案1

像这样:

在此处输入图片描述

主要思想是使用蒂克兹极坐标和循环:

\documentclass{article}
\usepackage{tikz}

\begin{document}

  \begin{tikzpicture}[bullet/.style={circle, fill, inner sep=2pt}]
    \foreach \lab [count=\c, 
                   evaluate=\c as \ang using {18+72*\c}] 
    in {a,b^2, ab^2, ab, b} {
       \node[bullet] (\c) at (\ang:10mm) {};
       \node at (\ang:14mm){$\lab$};
       \foreach \i in {1,...,\c} {
          \draw(\i)--(\c);
       }
    }
  \end{tikzpicture}

\end{document}

编辑 哎呀,我发现我多了一个边缘。如果真的不想要,可以给出以下修复方法:

在此处输入图片描述

使用:

\documentclass{article}
\usepackage{tikz}

\begin{document}

  \begin{tikzpicture}[bullet/.style={circle, fill, inner sep=2pt}]
    \foreach \lab [count=\c, evaluate=\c as \ang using {18+72*\c}] in {a,b^2, ab^2, ab, b} {
       \node[bullet] (\c) at (\ang:10mm) {};
       \node at (\ang:14mm){$\lab$};
    }
    \draw(5)--(1)--(2)--(3)--(4)--(5)--(3)--(1)--(4)--(2);
  \end{tikzpicture}

\end{document}

答案2

无需附加软件包:

\documentclass{article}

\begin{document}

\begin{picture}(100,100)
\put(50,100){\circle*{5}}
\put(98,65){\circle*{5}}
\put(79,10){\circle*{5}}
\put(21,10){\circle*{5}}
\put(2,65){\circle*{5}}

\put(48,105){$a$}
\put(103,65){$b$}
\put(84,10){$ab$}
\put(0,10){$ab^2$}
\put(-10,65){$b^2$}

\qbezier(79,10)(79,10)(21,10)
\qbezier(79,10)(79,10)(98,65)
\qbezier(79,10)(79,10)(50,100)
\qbezier(21,10)(21,10)(98,65)
\qbezier(21,10)(21,10)(50,100)
\qbezier(21,10)(21,10)(2,65)
\qbezier(2,65)(2,65)(50,100)
%\qbezier(2,65)(2,65)(98,65)
\qbezier(2,65)(2,65)(79,10)
\qbezier(50,100)(50,100)(98,65)

\end{picture}

\end{document}

在此处输入图片描述

渐近线

基于https://tex.stackexchange.com/a/152591/189040

\documentclass{article}
\usepackage{asymptote}
\begin{document}
\begin{asy}
size(3cm,0);   
pair[] vertices;
int n = 5; 
real r = 1.0; 

// Add the vertices to the array:
for (real angle = 18; angle < 378; angle += 360/n) {
    // The `push` command adds its argument to the end of the array.
    vertices.push(r*dir(angle));  // r*dir(angle) gives the point with polar coordinates (r, angle).
}

// Draw the vertices:
for (pair vertex : vertices)
    dot(vertex);

// Draw a couple lines in respective:
draw(vertices[0] -- vertices[1], black);
//draw(vertices[0] -- vertices[2], black);
draw(vertices[0] -- vertices[3], black);
draw(vertices[0] -- vertices[4], black);

draw(vertices[1] -- vertices[2], black);
draw(vertices[1] -- vertices[3], black);
draw(vertices[1] -- vertices[4], black);

draw(vertices[2] -- vertices[3], black);
draw(vertices[2] -- vertices[4], black);

draw(vertices[3] -- vertices[4], black);

label("b", vertices[0], align=E);
label("a", vertices[1], align=N);
label("$b^2$", vertices[2], align=W);
label("$ab^2$", vertices[3], align=SW);
label("ab", vertices[4], align=SE);

\end{asy}
\end{document}

在此处输入图片描述

技巧

基于https://tex.stackexchange.com/a/228371/189040

\documentclass{article}

\usepackage{pst-node,multido}

\begin{document}

\begin{pspicture}(5,5)
  \multido{\i=0+1}{7}{\rput{90}{\degrees[5]\pnode(1;\i){v\i}}}% Mark nodes
  \multido{\i=0+1}{5}{%
    \pcline(v\i)(v\number\numexpr\i+1)% C_5<1>
    \pscircle[fillstyle=solid,fillcolor=black](v\i){2pt}% node
  }
   \multido{\i=0+1}{4}{%
       \pcline(v\i)(v\number\numexpr\i+2)% C_5<2>
   } 
   
   
\uput[90](v0){a}   
\uput[180](v1){$b^2$}  
\uput[180](v2){$ab^2$}   
\uput[0](v3){$ab$}   
\uput[0](v4){$b$}    
 
\end{pspicture}

\end{document}

在此处输入图片描述

答案3

或者使用shapes.geometric

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{shapes.geometric}
\begin{document}
\begin{tikzpicture}
 \def\LstG{"","a","b^2","ab^2","ab","b"}
 \node[regular polygon,regular polygon sides=5,draw,minimum width=8em] (5gon){};
 \draw (5gon.corner 2) node[circle,fill,inner
 sep=1.5pt,label={18+72*2:{\pgfmathsetmacro{\lbl}{{\LstG}[2]}$\lbl$}}]{}  
 foreach \X in {4,1,3,5} {-- (5gon.corner \X)
 node[circle,fill,inner
 sep=1.5pt,label={18+72*\X:{\pgfmathsetmacro{\lbl}{{\LstG}[\X]}$\lbl$}}]{}};
\end{tikzpicture}
\end{document}

在此处输入图片描述

答案4

PSTricks 解决方案仅用于娱乐目的。它故意或故意地变得复杂,以普及 PSTricks 中隐藏的功能,例如:

  • \degrees
  • saveNodeCoors
  • \curvepnodes
  • \psnpolygon
  • PtoCrel
  • DegtoAny

\documentclass[pstricks,12pt]{standalone}
\usepackage{pst-plot}
\degrees[5]
\begin{document}
\begin{pspicture}[saveNodeCoors](-5,-5)(5,5)
    \curvepnodes[plotpoints=6]{0}{5}{4 t 1 4 div add PtoCrel}{A}
    \psnpolygon[showpoints,dotscale=2](0,\Anodecount){A}
    \foreach \i/\j in {0/b,1/a,2/{b^2},3/{ab^2},4/{ab}}
            {\uput{10pt}[!N-A\i.y N-A\i.x atan DegtoAny](A\i){$\j$}}
    \foreach \i/\j in {3/0,3/1,4/1,4/2}
            {\pcline(A\i)(A\j)}
\end{pspicture}
\end{document}

在此处输入图片描述

相关内容