在文本中插入彩色音符

在文本中插入彩色音符

我想在文本中插入彩色音符。我尝试使用 Lilyglyphs 包(见下文),但似乎不可能。在 Lilyglyphs 中,音符是预编译的 PDF,只需插入即可。还有其他包可以在文本中插入音符吗?

\documentclass{report}

\usepackage{lilyglyphs}
\usepackage{color}

\begin{document}

  \textcolor{red}{Test of \quaver}.

\end{document}

百合雕文测试

答案1

这些音符在 unicode 文本字体中相当常见,尽管出于某种原因,默认的拉丁现代字体有八分音符但没有四分音符,我在这里选择了 Garamond 克隆版与 lualatex 或 xelatex 一起使用

在此处输入图片描述

\documentclass{article}
\usepackage{xcolor}
\usepackage{fontspec}
\setmainfont{Garamond Libre}

\begin{document}

\textcolor{red}{a red quaver ♪ and a crotchet ♩}

\end{document}

答案2

您可以使用wasysym

\documentclass{report}
\usepackage{wasysym}
\usepackage{color}

\begin{document}

\textcolor{red}{Test of \eighthnote\ \halfnote\ \quarternote}.

\end{document}

在此处输入图片描述

答案3

通过这个非常简短的文档,我得到了附加的结果:

    \documentclass{report}

\usepackage{musixtex}
\usepackage{color}

\begin{document}
  {\textcolor{red}{eight \tinynotesize\cl h~~}}.
  {\textcolor{green}{half \smallnotesize\hu f~~}}.
  {\textcolor{blue}{whole \wh f~~}}.
  {\textcolor{yellow}{no head \smallnotesize\nq f~~}}.
  {\textcolor{cyan}{rest \tinynotesize\raise-3mm\qp~}}.
  
\end{document}

为此,您无需启动音乐,也无需定义音符。看起来您可以使用 musixtex 包中的任何字符。

彩色笔记

答案4

我使用 MusixTex 实现了这个功能,虽然有点不靠谱,但确实有用。如果有人需要,这是我的解决方案。我认为也可以为连线音符实现这个功能。

%%%
% BEGIN: Single notes
%%%

% Whole note
\newcommand\myWh{%
  \hspace{-107pt}
  \raisebox{-09pt}[6pt][4pt]{%
  \scalebox{0.6}{%
    \begin{music}%
      \instrumentnumber{1}%
      \nobarnumbers%
      \setclefsymbol{1}\empty%
      \setlines{1}{0}%
      \nostartrule%
      \smallmusicsize%
      \def\afterruleskip{0\elemskip}
      \startextract%
        \znotes\wh{f}\en%
        \setemptybar%
      \endextract%
    \end{music}%
  }%
  }%
  \hspace{-103pt}
}

% Dotted whole note
\newcommand\myWhd{%
  \hspace{-107pt}
  \raisebox{-09pt}[6pt][4pt]{%
  \scalebox{0.6}{%
    \begin{music}%
      \instrumentnumber{1}%
      \nobarnumbers%
      \setclefsymbol{1}\empty%
      \setlines{1}{0}%
      \nostartrule%
      \smallmusicsize%
      \def\afterruleskip{0\elemskip}
      \startextract%
        \znotes\whp{f}\en%
        \setemptybar%
      \endextract%
    \end{music}%
  }%
  }%
  \hspace{-101pt}
}


% Half note, with upper stroke
\newcommand\myHu{%
  \hspace{-071pt}
  \raisebox{-06pt}[6pt][4pt]{%
  \scalebox{0.4}{%
    \begin{music}%
      \instrumentnumber{1}%
      \nobarnumbers%
      \setclefsymbol{1}\empty%
      \setlines{1}{0}%
      \nostartrule%
      \smallmusicsize%
      \def\afterruleskip{0\elemskip}
      \startextract%
        \znotes\hu{f}\en%
        \setemptybar%
      \endextract%
    \end{music}%
  }%
  }%
  \hspace{-069pt}
}

% Half note, with lower stroke
\newcommand\myHu{%
  \hspace{-071pt}
  \raisebox{-06pt}[6pt][4pt]{%
  \scalebox{0.4}{%
    \begin{music}%
      \instrumentnumber{1}%
      \nobarnumbers%
      \setclefsymbol{1}\empty%
      \setlines{1}{0}%
      \nostartrule%
      \smallmusicsize%
      \def\afterruleskip{0\elemskip}
      \startextract%
        \znotes\hl{l}\en%
        \setemptybar%
      \endextract%
    \end{music}%
  }%
  }%
  \hspace{-069pt}
}

% Dotted half note, with upper stroke
\newcommand\myHud{%
  \hspace{-071pt}
  \raisebox{-06pt}[6pt][4pt]{%
  \scalebox{0.4}{%
    \begin{music}%
      \instrumentnumber{1}%
      \nobarnumbers%
      \setclefsymbol{1}\empty%
      \setlines{1}{0}%
      \nostartrule%
      \smallmusicsize%
      \def\afterruleskip{0\elemskip}
      \startextract%
        \znotes\hup{f}\en%
        \setemptybar%
      \endextract%
    \end{music}%
  }%
  }%
  \hspace{-069pt}
}

% Dotted half note, with lower stroke
\newcommand\myHud{%
  \hspace{-071pt}
  \raisebox{-06pt}[6pt][4pt]{%
  \scalebox{0.4}{%
    \begin{music}%
      \instrumentnumber{1}%
      \nobarnumbers%
      \setclefsymbol{1}\empty%
      \setlines{1}{0}%
      \nostartrule%
      \smallmusicsize%
      \def\afterruleskip{0\elemskip}
      \startextract%
        \znotes\hlp{l}\en%
        \setemptybar%
      \endextract%
    \end{music}%
  }%
  }%
  \hspace{-069pt}
}


% Quarter note, with upper stroke
\newcommand\myQu{%
  \hspace{-071pt}
  \raisebox{-06pt}[6pt][4pt]{%
  \scalebox{0.4}{%
    \begin{music}%
      \instrumentnumber{1}%
      \nobarnumbers%
      \setclefsymbol{1}\empty%
      \setlines{1}{0}%
      \nostartrule%
      \smallmusicsize%
      \def\afterruleskip{0\elemskip}
      \startextract%
        \znotes\qu{f}\en%
        \setemptybar%
      \endextract%
    \end{music}%
  }%
  }%
  \hspace{-070pt}
}

% Quarter note, with lower stroke
\newcommand\myQu{%
  \hspace{-071pt}
  \raisebox{-06pt}[6pt][4pt]{%
  \scalebox{0.4}{%
    \begin{music}%
      \instrumentnumber{1}%
      \nobarnumbers%
      \setclefsymbol{1}\empty%
      \setlines{1}{0}%
      \nostartrule%
      \smallmusicsize%
      \def\afterruleskip{0\elemskip}
      \startextract%
        \znotes\ql{l}\en%
        \setemptybar%
      \endextract%
    \end{music}%
  }%
  }%
  \hspace{-070pt}
}

% Dotted quarter note, with upper stroke
\newcommand\myQud{%
  \hspace{-071pt}
  \raisebox{-06pt}[6pt][4pt]{%
  \scalebox{0.4}{%
    \begin{music}%
      \instrumentnumber{1}%
      \nobarnumbers%
      \setclefsymbol{1}\empty%
      \setlines{1}{0}%
      \nostartrule%
      \smallmusicsize%
      \def\afterruleskip{0\elemskip}
      \startextract%
        \znotes\qup{f}\en%
        \setemptybar%
      \endextract%
    \end{music}%
  }%
  }%
  \hspace{-069pt}
}

% Dotted quarter note, with lower stroke
\newcommand\myQud{%
  \hspace{-071pt}
  \raisebox{-06pt}[6pt][4pt]{%
  \scalebox{0.4}{%
    \begin{music}%
      \instrumentnumber{1}%
      \nobarnumbers%
      \setclefsymbol{1}\empty%
      \setlines{1}{0}%
      \nostartrule%
      \smallmusicsize%
      \def\afterruleskip{0\elemskip}
      \startextract%
        \znotes\qlp{l}\en%
        \setemptybar%
      \endextract%
    \end{music}%
  }%
  }%
  \hspace{-069pt}
}


% Quarver note, with upper stroke
\newcommand\myCu{%
  \hspace{-071pt}
  \raisebox{-06pt}[6pt][4pt]{%
  \scalebox{0.4}{%
    \begin{music}%
      \instrumentnumber{1}%
      \nobarnumbers%
      \setclefsymbol{1}\empty%
      \setlines{1}{0}%
      \nostartrule%
      \smallmusicsize%
      \def\afterruleskip{0\elemskip}
      \startextract%
        \znotes\cu{f}\en%
        \setemptybar%
      \endextract%
    \end{music}%
  }%
  }%
  \hspace{-069pt}
}

% Quarver note, with lower stroke
\newcommand\myCu{%
  \hspace{-071pt}
  \raisebox{-06pt}[6pt][4pt]{%
  \scalebox{0.4}{%
    \begin{music}%
      \instrumentnumber{1}%
      \nobarnumbers%
      \setclefsymbol{1}\empty%
      \setlines{1}{0}%
      \nostartrule%
      \smallmusicsize%
      \def\afterruleskip{0\elemskip}
      \startextract%
        \znotes\cl{l}\en%
        \setemptybar%
      \endextract%
    \end{music}%
  }%
  }%
  \hspace{-069pt}
}

% Dotted quarver note, with upper stroke
\newcommand\myCud{%
  \hspace{-071pt}
  \raisebox{-06pt}[6pt][4pt]{%
  \scalebox{0.4}{%
    \begin{music}%
      \instrumentnumber{1}%
      \nobarnumbers%
      \setclefsymbol{1}\empty%
      \setlines{1}{0}%
      \nostartrule%
      \smallmusicsize%
      \def\afterruleskip{0\elemskip}
      \startextract%
        \znotes\cup{f}\en%
        \setemptybar%
      \endextract%
    \end{music}%
  }%
  }%
  \hspace{-069pt}
}

% Dotted quarver note, with lower stroke
\newcommand\myCud{%
  \hspace{-071pt}
  \raisebox{-06pt}[6pt][4pt]{%
  \scalebox{0.4}{%
    \begin{music}%
      \instrumentnumber{1}%
      \nobarnumbers%
      \setclefsymbol{1}\empty%
      \setlines{1}{0}%
      \nostartrule%
      \smallmusicsize%
      \def\afterruleskip{0\elemskip}
      \startextract%
        \znotes\clp{l}\en%
        \setemptybar%
      \endextract%
    \end{music}%
  }%
  }%
  \hspace{-069pt}
}


% 2 quarver note, with upper stroke
\newcommand\myCCu{%
  \hspace{-071pt}
  \raisebox{-06pt}[6pt][4pt]{%
  \scalebox{0.4}{%
    \begin{music}%
      \instrumentnumber{1}%
      \nobarnumbers%
      \setclefsymbol{1}\empty%
      \setlines{1}{0}%
      \nostartrule%
      \smallmusicsize%
      \def\afterruleskip{0\elemskip}
      \startextract%
        \znotes\ccu{f}\en%
        \setemptybar%
      \endextract%
    \end{music}%
  }%
  }%
  \hspace{-069pt}
}

% 2 quarver note, with lower stroke
\newcommand\myCCu{%
  \hspace{-071pt}
  \raisebox{-06pt}[6pt][4pt]{%
  \scalebox{0.4}{%
    \begin{music}%
      \instrumentnumber{1}%
      \nobarnumbers%
      \setclefsymbol{1}\empty%
      \setlines{1}{0}%
      \nostartrule%
      \smallmusicsize%
      \def\afterruleskip{0\elemskip}
      \startextract%
        \znotes\ccl{l}\en%
        \setemptybar%
      \endextract%
    \end{music}%
  }%
  }%
  \hspace{-069pt}
}

% Dotted 2 quarver note, with upper stroke
\newcommand\myCcud{%
  \hspace{-071pt}
  \raisebox{-06pt}[6pt][4pt]{%
  \scalebox{0.4}{%
    \begin{music}%
      \instrumentnumber{1}%
      \nobarnumbers%
      \setclefsymbol{1}\empty%
      \setlines{1}{0}%
      \nostartrule%
      \smallmusicsize%
      \def\afterruleskip{0\elemskip}
      \startextract%
        \znotes\ccup{f}\en%
        \setemptybar%
      \endextract%
    \end{music}%
  }%
  }%
  \hspace{-069pt}
}

% Dotted 2 quarver note, with lower stroke
\newcommand\myCcud{%
  \hspace{-071pt}
  \raisebox{-06pt}[6pt][4pt]{%
  \scalebox{0.4}{%
    \begin{music}%
      \instrumentnumber{1}%
      \nobarnumbers%
      \setclefsymbol{1}\empty%
      \setlines{1}{0}%
      \nostartrule%
      \smallmusicsize%
      \def\afterruleskip{0\elemskip}
      \startextract%
        \znotes\cclp{l}\en%
        \setemptybar%
      \endextract%
    \end{music}%
  }%
  }%
  \hspace{-069pt}
}


% 3 quarver note, with upper stroke
\newcommand\myCccu{%
  \hspace{-071pt}
  \raisebox{-06pt}[6pt][4pt]{%
  \scalebox{0.4}{%
    \begin{music}%
      \instrumentnumber{1}%
      \nobarnumbers%
      \setclefsymbol{1}\empty%
      \setlines{1}{0}%
      \nostartrule%
      \smallmusicsize%
      \def\afterruleskip{0\elemskip}
      \startextract%
        \znotes\cccu{f}\en%
        \setemptybar%
      \endextract%
    \end{music}%
  }%
  }%
  \hspace{-069pt}
}

% 3 quarver note, with lower stroke
\newcommand\myCccu{%
  \hspace{-071pt}
  \raisebox{-06pt}[6pt][4pt]{%
  \scalebox{0.4}{%
    \begin{music}%
      \instrumentnumber{1}%
      \nobarnumbers%
      \setclefsymbol{1}\empty%
      \setlines{1}{0}%
      \nostartrule%
      \smallmusicsize%
      \def\afterruleskip{0\elemskip}
      \startextract%
        \znotes\cccl{l}\en%
        \setemptybar%
      \endextract%
    \end{music}%
  }%
  }%
  \hspace{-069pt}
}


% 4 quarver note, with upper stroke
\newcommand\myCcccu{%
  \hspace{-071pt}
  \raisebox{-06pt}[6pt][4pt]{%
  \scalebox{0.4}{%
    \begin{music}%
      \instrumentnumber{1}%
      \nobarnumbers%
      \setclefsymbol{1}\empty%
      \setlines{1}{0}%
      \nostartrule%
      \smallmusicsize%
      \def\afterruleskip{0\elemskip}
      \startextract%
        \znotes\ccccu{f}\en%
        \setemptybar%
      \endextract%
    \end{music}%
  }%
  }%
  \hspace{-069pt}
}

% 4 quarver note, with lower stroke
\newcommand\myCcccu{%
  \hspace{-071pt}
  \raisebox{-06pt}[6pt][4pt]{%
  \scalebox{0.4}{%
    \begin{music}%
      \instrumentnumber{1}%
      \nobarnumbers%
      \setclefsymbol{1}\empty%
      \setlines{1}{0}%
      \nostartrule%
      \smallmusicsize%
      \def\afterruleskip{0\elemskip}
      \startextract%
        \znotes\ccccl{l}\en%
        \setemptybar%
      \endextract%
    \end{music}%
  }%
  }%
  \hspace{-069pt}
}


% 5 quarver note, with upper stroke
\newcommand\myCccccu{%
  \hspace{-071pt}
  \raisebox{-06pt}[6pt][4pt]{%
  \scalebox{0.4}{%
    \begin{music}%
      \instrumentnumber{1}%
      \nobarnumbers%
      \setclefsymbol{1}\empty%
      \setlines{1}{0}%
      \nostartrule%
      \smallmusicsize%
      \def\afterruleskip{0\elemskip}
      \startextract%
        \znotes\cccccu{f}\en%
        \setemptybar%
      \endextract%
    \end{music}%
  }%
  }%
  \hspace{-069pt}
}

% 5 quarver note, with lower stroke
\newcommand\myCccccu{%
  \hspace{-071pt}
  \raisebox{-06pt}[6pt][4pt]{%
  \scalebox{0.4}{%
    \begin{music}%
      \instrumentnumber{1}%
      \nobarnumbers%
      \setclefsymbol{1}\empty%
      \setlines{1}{0}%
      \nostartrule%
      \smallmusicsize%
      \def\afterruleskip{0\elemskip}
      \startextract%
        \znotes\cccccl{l}\en%
        \setemptybar%
      \endextract%
    \end{music}%
  }%
  }%
  \hspace{-069pt}
}

%%%
% END: Single notes
%%%

相关内容