如何在 LaTeX 文档中插入九角星?

如何在 LaTeX 文档中插入九角星?

我正在排版一本 Bahá'í 书,我想在其中插入一颗九角星。有没有办法即时生成它?否则最好的方法是什么?不幸的是,这是一个常见的星号,尚未出现在 Unicode 中,因此在字体中也未出现......

答案1

绘制如下形状的有趣方法:

在此处输入图片描述

\documentclass{article}
\usepackage{tikz}
\usepackage{expl3}

\begin{document}

\ExplSyntaxOn

% #1: radius
% #2: angle
% #3: scale
\cs_set:Npn \graph_circ_point:nnn #1#2#3 {
  \fp_eval:n {(#1) * cos(#2) * (#3)}, \fp_eval:n {(#1) * sin(#2) * (#3)}
}

\fp_new:N \l_graph_center_ang_fp
\fp_new:N \l_graph_step_ang_fp
\fp_new:N \l_graph_half_ang_fp
\fp_new:N \l_graph_current_ang_fp
\int_new:N \l_graph_node_count_int
\seq_new:N \l_graph_node_seq
\tl_new:N \l_graph_draw_tl
% #1: radius
% #2: number of vertices
% #3: scale
\newcommand{\drawshape}[3]{
  \fp_set:Nn \l_graph_half_ang_fp {2 * \c_pi_fp / (#2 * 2)}
  \fp_set:Nn \l_graph_step_ang_fp {2 * \c_pi_fp / (#2)}
  \fp_set:Nn \l_graph_current_ang_fp {\c_pi_fp / 2}
  \int_set:Nn \l_graph_node_count_int {1}
  \seq_clear:N \l_graph_node_seq
  \int_step_inline:nn {#2} {
    \coordinate (p-\int_use:N \l_graph_node_count_int) at (\graph_circ_point:nnn {#1}{\l_graph_current_ang_fp - \l_graph_half_ang_fp}{1.0});
    \seq_put_right:Nx \l_graph_node_seq {(p-\int_use:N \l_graph_node_count_int)}
    \int_incr:N \l_graph_node_count_int
    
    \coordinate (p-\int_use:N \l_graph_node_count_int) at (\graph_circ_point:nnn {#1}{\l_graph_current_ang_fp}{#3});
    \seq_put_right:Nx \l_graph_node_seq {(p-\int_use:N \l_graph_node_count_int)}
    \int_incr:N \l_graph_node_count_int
    
    \coordinate (p-\int_use:N \l_graph_node_count_int) at (\graph_circ_point:nnn {#1}{\l_graph_current_ang_fp + \l_graph_half_ang_fp}{1.0});
    \seq_put_right:Nx \l_graph_node_seq {(p-\int_use:N \l_graph_node_count_int)}
    \int_incr:N \l_graph_node_count_int
    
    \fp_add:Nn \l_graph_current_ang_fp {\l_graph_step_ang_fp}
  }
  \tl_set:Nx \l_graph_draw_tl {
    \exp_not:N \draw[linestyle] \seq_use:Nn \l_graph_node_seq {--};
  }
  \tl_use:N \l_graph_draw_tl
}

\ExplSyntaxOff


\newcommand{\settinga}{
  \tikzset{
    linestyle/.style={
      line width=1pt, % change line width
      line cap=round
    }
  }
}

\newcommand{\settingb}{
  \tikzset{
    linestyle/.style={
      line width=1pt, % change line width
      line cap=round,
      fill=black
    }
  }
}


\begin{center}

\settinga
\begin{tikzpicture}
\drawshape{1}{9}{1.3}
\end{tikzpicture}
\settingb
\begin{tikzpicture}
\drawshape{1}{9}{1.3}
\end{tikzpicture}

\settinga
\begin{tikzpicture}
\drawshape{1}{9}{2.0}
\end{tikzpicture}
\settingb
\begin{tikzpicture}
\drawshape{1}{9}{2.0}
\end{tikzpicture}

\settinga
\begin{tikzpicture}
\drawshape{1}{15}{1.5}
\end{tikzpicture}
\settingb
\begin{tikzpicture}
\drawshape{1}{15}{1.5}
\end{tikzpicture}
\end{center}


\end{document}

答案2

姆韦

\documentclass{article}
\usepackage{fontspec} % use xelatex or lualatex !
\begin{document}
\Huge
\newfontfamily{\estrellas}{PizzaDude Stars} % Free for personal use only
% https://www.1001fonts.com/pizzadude-stars-font.html
\makebox[8em][s]{\estrellas K L M \fbox{N} O P Q}
\end{document}

相关内容