![\NiceMatrix 的奇怪矩阵](https://linux22.com/image/435928/%5CNiceMatrix%20%E7%9A%84%E5%A5%87%E6%80%AA%E7%9F%A9%E9%98%B5.png)
我遇到了麻烦\tikzpicture
:我的目标是只取 15 边形的边作为 tex 代码的第一部分,...但我不记得怎么做了。然后我想 \begin{matrix*}...
在两个多边形的中心有,可能会有所改进\nicematrix
。
代码:
\documentclass{article}
\usepackage[customcolors,shade]{hf-tikz}
\usepackage{extarrows}
\usepackage{nicematrix}
\usepackage{mathtools}
\begin{document}
\begin{center}
\rotatebox{90}{%
\begin{tikzpicture}
\def\R{2} \def\N{15}
\draw (0,0) circle(\R);
\foreach \i in {1,...,\N}
{\coordinate (P-\i) at (\i*360/\N:\R);
\draw (P-\i) circle(5pt);}
\pgfmathtruncatemacro\n{\N-1} \foreach \i in {1,...,\n}
{\pgfmathtruncatemacro\j{\i+1}
\foreach \k in {\j,...,\N} \draw (P-\i) -- (P-\k);} \end{tikzpicture}}
%\rotatebox{90}{%
\NiceMatrixOptions
{nullify-dots,code-for-first-col = \color{blue},code-for-first-col=\color{blue}}
$\begin{NiceMatrix}[first-row,first-col]
&\Ldots[line-style={solid,->},shorten=0pt]^{\text{Con le diagonali}} \\
&\mbox{Decapentagono}
\vspace{-2mm}\\&\Ldots[line-style={solid,<-},shorten=0pt]_{\text{Senza diagonali}}
\end{NiceMatrix}$
\rotatebox{90}{%
\begin{tikzpicture}
\def\R{2} \def\N{15}
\draw (0,0) circle(\R);
\foreach \i in {1,...,\N}
{\coordinate (P-\i) at (\i*360/\N:\R);
\draw (P-\i) circle(5pt);}
\pgfmathtruncatemacro\n{\N-1} \foreach \i in {1,...,\n}
{\pgfmathtruncatemacro\j{\i+1}
\foreach \k in {\j,...,\N} \draw (P-\i) -- (P-\k);}
\end{tikzpicture}}
\end{center}
\end{document}
答案1
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{center}
\def\R{2} \def\N{15}
\begin{tikzpicture}[baseline ={(0,0)}]
\foreach \i in {1,...,\N} { \coordinate (P-\i) at (\i*360/\N+90/\N:\R); }
\pgfmathtruncatemacro\n{\N-1}
\foreach \i in {1,...,\n}
{
\pgfmathtruncatemacro\j{\i+1}
\draw (P-\i) -- (P-\j) ;
}
\draw (P-\N) -- (P-1) ;
\fill (0,0) circle (0.5mm) ;
\end{tikzpicture}
\begin{tabular}{c}
\tiny Con le diagonali \\[-1mm]
\rightarrowfill \\
Decapentagono \\
\leftarrowfill \\[-2mm]
\tiny Senza diagonali
\end{tabular}
\begin{tikzpicture}[baseline={(0,0)}]
\draw (0,0) circle(\R);
\foreach \i in {1,...,\N} { \coordinate (P-\i) at (\i*360/\N+90:\R); }
\pgfmathtruncatemacro\n{\N-1}
\foreach \i in {1,...,\n}
{
\pgfmathtruncatemacro\j{\i+1}
\foreach \k in {\j,...,\N} \draw (P-\i) -- (P-\k);
}
\fill (0,0) circle (0.5mm) ;
\end{tikzpicture}
\end{center}
\end{document}