How to draw regular polygons in math mode
Welcome! TikZ has those built in in the library shapes.geometric
.
\documentclass[fleqn]{article}
\usepackage{mathtools}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}
\newcommand{\Ngon}[2][]{\vcenter{\hbox{\begin{tikzpicture}
\node[regular polygon,regular polygon sides=#2,draw,minimum size=1cm,#1](#2-gon){};
\foreach \X in {1,...,#2}{\fill (#2-gon.corner \X) circle[radius=2pt];}
\end{tikzpicture}}}}
\begin{document}
\[
\mathcal{Z}_X=\sum_{n=3}^\infty t_n
=\Ngon{3}+\Ngon{4}+\Ngon{5}+\cdots
\]
or
\begin{align*}
\mathcal{Z}_X&=\sum_{n=3}^\infty t_n\\
&=\Ngon{3}+\Ngon{4}+\Ngon{5}+\cdots
\end{align*}
\end{document}
or
\documentclass[fleqn]{article}
\usepackage{mathtools}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}
\newcommand{\Ngon}[2][]{\vcenter{\hbox{\begin{tikzpicture}
\node[regular polygon,regular polygon sides=#2,draw,minimum size=1cm,#1](#2-gon){};
\foreach \X in {1,...,#2}{\fill (#2-gon.corner \X) circle[radius=2pt];}
\end{tikzpicture}}}}
\begin{document}
\[
\mathcal{Z}_X=\sum_{n=3}^\infty t_n
=\foreach \Y in {3,4,5}
{\unless\ifnum\Y=3 +\fi
\Ngon{\Y}
}+\cdots
\]
or
\begin{align*}
\mathcal{Z}_X&=\sum_{n=3}^\infty t_n\\
&=\foreach \Y in {3,4,5}
{\unless\ifnum\Y=3 +\fi
\Ngon{\Y}
}+\cdots
\end{align*}
\end{document}
Or
\documentclass[fleqn]{article}
\usepackage{mathtools}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}
\newcommand{\Ngon}[2][]{\vcenter{\hbox{\begin{tikzpicture}
\node[regular polygon,regular polygon sides=#2,draw,minimum size=1cm,#1](#2-gon){};
\draw plot[only marks,mark=*,samples at={1,...,#2}] (#2-gon.corner \x);
\end{tikzpicture}}}}
\begin{document}
\[
\mathcal{Z}_X=\sum_{n=3}^\infty t_n
=\foreach \Y in {3,4,5}
{\unless\ifnum\Y=3 +\fi
\Ngon{\Y}
}+\cdots
\]
or
\begin{align*}
\mathcal{Z}_X&=\sum_{n=3}^\infty t_n\\
&=\foreach \Y in {3,4,5}
{\unless\ifnum\Y=3 +\fi
\Ngon{\Y}
}+\cdots
\end{align*}
\end{document}
While I did not explicitly test it, I am pretty sure that this will work on arXiv. I have submitted several papers with TikZ code successfully there. Only if you use very recent libraries it may not work, but shapes.geometric
is rather old.
This answer of mine can easily be adapted to your case, with the help of the curve2e
package to enable the use of polar coordinates inside picture
environments. The symbols are automatically scaled as appropriate when used in first- and higher-order superscripts or subscripts, and honor the bold
math version.
Here is a compilable example. For details and explanations, see the cited answer.
% My standard header for TeX.SX answers:
\documentclass[a4paper]{article} % To avoid confusion, let us explicitly
% declare the paper format.
\usepackage[T1]{fontenc} % Not always necessary, but recommended.
% End of standard header. What follows pertains to the problem at hand.
\usepackage{halloweenmath} % also loads "amsmath" and "pict2e"
\usepackage{curve2e} % for polar coordinate in "picture" environments
%== \BEGIN { WIZARDRY } ========================================
\makeatletter
\@ifdefinable\SuCmathpictvertex{} % check that this name can be used
\@ifdefinable\@SuC@reserved@dimen{\newdimen\@SuC@reserved@dimen}
% The code that implements the following environment could also be
% in-lined inside the definition of "\@SuC@general@pict"; however,
% providing an additional layer might prove helpful in the future.
\newenvironment*{@SuC@math@picture}[8]{%
% #1 := height of the symbol, in picture coordinate units
% #2 := depth of the symbol, in picture coordinate units
% #3 := width of the symbol, in picture coordinate units
% #4 := x-coordinate of leftmost point of the symbol
% #5 := font selector (e.g., "\textfont")
% #6 := diameter of the vertices
% #7 := width of sidebearings, in picture coordinate units
% #8 := thickness of the edges
\def\SuCmathpictvertex{\circle*{#6}}%
\setlength\unitlength{\fontdimen 22 #5\tw@}%
\setlength\@SuC@reserved@dimen{#7\unitlength}%
\kern\@SuC@reserved@dimen
\@HwM@d@pict@strut{#2}%
\picture(#3,#1)(#4,-1)%
\roundcap
\roundjoin
\linethickness{#8\@HwM@thickness@units@for #5}%
}{%
\endpicture
\kern\@SuC@reserved@dimen
}
\newcommand*\@SuC@general@pict[9]{%
% #1 := code that draws the tree
% #2 := height of the symbol, in picture coordinate units
% #3 := depth of the symbol, in picture coordinate units
% #4 := width of the symbol, in picture coordinate units
% #5 := x-coordinate of leftmost point of the symbol
% #6 := font selector (e.g., "\textfont")
% #7 := diameter of the vertices
% #8 := width of sidebearings, in picture coordinate units
% #9 := thickness of the edges
\begin{@SuC@math@picture}%
{#2}{#3}% height / depth
{#4}{#5}% width / min-x
#6% font selector (e.g., "\textfont")
{#7}% diameter of the vertices
{#8}% width of sidebearings
{#9}% thickness of the edges
#1%
\end{@SuC@math@picture}%
}
\newcommand*\@SuC@math@version@shunt[7]{%
% #1 := code that draws the tree
% #2 := height of the symbol, in picture coordinate units
% #3 := depth of the symbol, in picture coordinate units
% #4 := width of the symbol, in picture coordinate units
% #5 := x-coordinate of leftmost point of the symbol
% #6 := style selector (e.g., "\displaystyle"), here unused
% #7 := font selector (e.g., "\textfont")
\@HwM@choose@thicknesses{\@SuC@general@pict {#1}{#2}{#3}{#4}{#5}#7}%
% Two lists of parameters follow, each in the form
%
% {{<diam.>}{<sidebearing>}{<line thickn.>}}
%
% where:
% <diam.> is the diameter of the vertices, in picture
% coordinate units ("\unitlength");
% <sidebearing> is the width of an extra space that goes
% at both sides of the symbol, in the same units as above;
% <line thickn.> is the thickness of the edges, in units of
% the default-rule-thickness "\fontdimen" (note that "{}"
% can be used to mean "{1}").
% The second list is used when the "bold" math version is in
% force, the first pair in all other cases (usually, this means
% that the "normal" math version is in force).
{{.8}{.4}{}}% for "normal" (actually, non-"bold") math version
{{1}{.5}{1.5}}% for "bold" math version
}
% The user-level command:
\newcommand*\DeclareNewSuCMathPict[6]{%
% #1 := control sequence being defined (e.g., "\SuCTreeOne")
% #2 := height of the symbol, in picture coordinate units
% #3 := depth of the symbol, in picture coordinate units
% #4 := width of the symbol, in picture coordinate units
% #5 := x-coordinate of leftmost point of the symbol
% #6 := code that draws the tree
\newcommand*{#1}{%
\@HwM@general@ordinary@symbol
{\@SuC@math@version@shunt {#6}{#2}{#3}{#4}{#5}}%
}%
}
\makeatother
%== \END { WIZARDRY } ==========================================
% Now we use our new declaration:
\DeclareNewSuCMathPict{\trigon}
{3}{1} % height / depth
{4}{-2} % width / min-x
{% code that draws the picture
\polygon(90:2)(210:2)(330:2)%
\put (90:2){\SuCmathpictvertex}%
\put(210:2){\SuCmathpictvertex}%
\put(330:2){\SuCmathpictvertex}%
}
\DeclareNewSuCMathPict{\tetragon}
{3}{1} % height / depth
{4}{-2} % width / min-x
{% code that draws the picture
\polygon(45:2)(135:2)(225:2)(315:2)%
\put (45:2){\SuCmathpictvertex}%
\put(135:2){\SuCmathpictvertex}%
\put(225:2){\SuCmathpictvertex}%
\put(315:2){\SuCmathpictvertex}%
}
\DeclareNewSuCMathPict{\pentagon}
{3}{1} % height / depth
{4}{-2} % width / min-x
{% code that draws the picture
\polygon(90:2)(162:2)(234:2)(306:2)(378:2)%
\put (90:2){\SuCmathpictvertex}%
\put(162:2){\SuCmathpictvertex}%
\put(234:2){\SuCmathpictvertex}%
\put(306:2){\SuCmathpictvertex}%
\put(378:2){\SuCmathpictvertex}%
}
\DeclareNewSuCMathPict{\hexagon}
{3}{1} % height / depth
{4}{-2} % width / min-x
{% code that draws the picture
\polygon(0:2)(60:2)(120:2)(180:2)(240:2)(300:2)%
\put (0:2){\SuCmathpictvertex}%
\put (60:2){\SuCmathpictvertex}%
\put(120:2){\SuCmathpictvertex}%
\put(180:2){\SuCmathpictvertex}%
\put(240:2){\SuCmathpictvertex}%
\put(300:2){\SuCmathpictvertex}%
}
\begin{document}
The polygons:
\( \trigon + \tetragon + \pentagon + \hexagon \).
\begingroup \bfseries \boldmath
Bold math:
\( \trigon + \tetragon + \pentagon + \hexagon \).
\endgroup
Note that both the vertices and the edges get thicker.
A formula with subscripts, etc.; compare the diameter of the poygons
and the height-plus-depth of the parentheses.
\begin{gather*}
f(\trigon) + g(\tetragon) + h(\hexagon) = 0 \\
\sum_{i=\trigon}^{\hexagon} H_{i}(x)
= H_{\trigon}(x) + H_{\tetragon}(x)
+ H_{\pentagon}(x) + H_{\hexagon}(x)
= \varOmega(\trigon * \tetragon * \pentagon * \hexagon)
\end{gather*}
And here is an example with a double script:
\( \mathit{T}^{\mathit{S}_{\hexagon}} \).
\end{document}
This is the output:
Note that, in this example, for simplicity all four polygons are regarded as having the same width, height, and depth as their circumscribed circle: this may not be entirely appropriate. In particular, you might want to fine-tune the values in the fourth and fifth arguments of \DeclareNewSuCMathPict
.