使用 Beamer 在 Musixtex 中演奏钢琴乐谱

使用 Beamer 在 Musixtex 中演奏钢琴乐谱

需要使用 Beamer 在 Musixtex 中实现钢琴乐谱,当使用 colorbox 命令时,Musixtex 似乎无法在 Beamer 上运行,但由于我使用了 Beamer 模板中的背景颜色,因此需要它;基本代码如下:

% !TeX program = txs:///arara
% arara: xelatex: {synctex: on, interaction: nonstopmode, shell: yes}
\documentclass[aspectratio=169]{beamer}
\usepackage{musixtex}
\usepackage{tikz}
\usepackage{xcolor}
\xdefinecolor{gray-undar}{RGB}{52,52,52}
\xdefinecolor{red-undar}{RGB}{179,35,79}

\begin{document}

\begin{frame}[fragile,t]
\frametitle{\LARGE Partes de una Partitura}
    
\begin{tikzpicture}
    \node[anchor=south west,inner sep=0,rotate=0,transform shape,scale=1] (partitura) at (0,0) {
        \colorbox{white}{\hspace*{-0.4cm}\begin{music}
        \setstaffs{1}{2}
        \setclef1\bass
        \nobarnumbers % Omite la numeración en los compases
        \generalsignature{2} % Una armadura en Fa y Do Sostenido
        \generalmeter{\meterfrac{4}{4}} %Compás en 4/4
        \startextract % Se inicia el fragmento musical
        %\scale{1.7}
        \Notes\hp\qu{C}|\ca e\en
        \Notes\qsk|\ca l\en
        \Notes\qp|\ibu0f2\qb0f\en
        \Notes\qsk|\tbu0\qb0g\en
        \NOTes\qp|\hp\en\bar
        \NOtes\pause|\pause\en
        \endextract % Se finaliza el fragmento musical
        \end{music}}};
    \begin{scope}[x={(partitura.south east)},y={(partitura.north west)}]
        % \draw[help lines,xstep=.1,ystep=.1] (0,0) grid (1,1);
        %     \foreach \x in {0,1,...,9} { \node [anchor=north] at (\x/10,0) {0.\x}; }
        %     \foreach \y in {0,1,...,9} { \node [anchor=east] at (0,\y/10) {0.\y}; }
        \draw[red-undar,ultra thick,rounded corners] (0.77,0.57) rectangle (0.85,0.86);%Figuras Musicales
        %\node[circle,draw=red-undar,ultra thick,minimum size=14] (c) at (0.545,0.4){};%Alteraciones        
    \end{scope}
\end{tikzpicture}
        
\end{frame}

\end{document}

当前输出如下(请注意,C 谱号的音符未根据该谱号对齐): 当前的

期望的输出如下: 期望

答案1

问题似乎来自\colorbox。您可以通过为 TikZ 节点设置填充颜色而不是使用 来避免此问题\colorbox

\documentclass[aspectratio=169]{beamer}
\usepackage{musixtex}
\usepackage{tikz}
\usepackage{xcolor}
\xdefinecolor{gray-undar}{RGB}{52,52,52}
\xdefinecolor{red-undar}{RGB}{179,35,79}

\begin{document}

\begin{frame}[fragile,t]
\frametitle{\LARGE Partes de una Partitura}
    
\begin{tikzpicture}
    \node[anchor=south west,inner sep=0,rotate=0,transform shape,scale=1,fill=green] (partitura) at (0,0) {
%        \colorbox{white}{
        \hspace*{-0.4cm}\begin{music}
        \setstaffs{1}{2}
        \setclef1\bass
        \nobarnumbers % Omite la numeración en los compases
        \generalsignature{2} % Una armadura en Fa y Do Sostenido
        \generalmeter{\meterfrac{4}{4}} %Compás en 4/4
        \startextract % Se inicia el fragmento musical
        %\scale{1.7}
        \Notes\hp\qu{C}|\ca e\en
        \Notes\qsk|\ca l\en
        \Notes\qp|\ibu0f2\qb0f\en
        \Notes\qsk|\tbu0\qb0g\en
        \NOTes\qp|\hp\en\bar
        \NOtes\pause|\pause\en
        \endextract % Se finaliza el fragmento musical
        \end{music}
%        }
        };
    \begin{scope}[x={(partitura.south east)},y={(partitura.north west)}]
        % \draw[help lines,xstep=.1,ystep=.1] (0,0) grid (1,1);
        %     \foreach \x in {0,1,...,9} { \node [anchor=north] at (\x/10,0) {0.\x}; }
        %     \foreach \y in {0,1,...,9} { \node [anchor=east] at (0,\y/10) {0.\y}; }
        \draw[red-undar,ultra thick,rounded corners] (0.67,0.57) rectangle (0.75,0.86);%Figuras Musicales
        %\node[circle,draw=red-undar,ultra thick,minimum size=14] (c) at (0.545,0.4){};%Alteraciones        
    \end{scope}
\end{tikzpicture}
        
\end{frame}

\end{document}

在此处输入图片描述

相关内容