使用Beamer配合Musixtex需要为musix环境设置colorbox高亮和节点区域,基本代码如下:
\documentclass[aspectratio=169]{beamer}
\usepackage{musixtex}
\usepackage{minted}
\usemintedstyle{borland}
\usepackage[T1]{fontenc}
\usepackage{emerald}%Fuente tipo mano para pizarra en Beamer
\usepackage[spanish]{babel}
%Paquetes para Beamer
\usepackage{calc}
\usepackage{ifthen}
\usepackage{tikz}
\usepackage{pgf}
\usepackage{pgffor}
\usepackage{float} %Paquete para posicionar Tablas
\usepackage{adjustbox}%Para centrar tablas
\usepackage{xcolor}
\xdefinecolor{gray-undar}{RGB}{52,52,52}
\xdefinecolor{red-undar}{RGB}{179,35,79}
% set text colors for different objects
\setbeamercolor{frametitle}{fg=white}
\setbeamercolor{structure}{fg=white}
\setbeamercolor{normal text}{fg=white}
\setbeamercolor{alerted text}{fg=white}
\setbeamercolor{example text}{fg=white}
%% set fonts
\setbeamerfont{frametitle}{size=\Huge, series=\ECFAugie}
\setbeamerfont{framesubtitle}{size=\large, series=\ECFAugie}
\setbeamerfont{title}{size=\huge, series=\ECFAugie}
\setbeamerfont{author}{size=\large, series=\ECFAugie}
\setbeamerfont{date}{size=\large, series=\ECFAugie}
\setbeamerfont{institute}{size=\large, series=\ECFAugie}
\setbeamerfont{caption}{series=\ECFAugie}
%% Green Background Colour
\setbeamercolor{background canvas}{bg=green!18!black}
%% Random Dust Trails
\setbeamertemplate{background}{
\begin{tikzpicture}
\useasboundingbox (0,0) rectangle (\the\paperwidth, \the\paperheight);
\foreach \i in {1,...,30} {
\pgfmathsetmacro{\x}{random(0,10000)/5000-1}%
\pgfmathsetmacro{\y}{random(0,10000)/10000-0.1}%
\pgfmathsetmacro{\r}{random(0,10000)/1000-5}%
\rotatebox{\r}{
%\pgftext[at=\pgfpoint{\x\paperwidth}{\y\paperheight}, left, base]{\includegraphics[width=\textwidth]{LOGO_UNDAR_PNG_RGB.png}}
}
};
\end{tikzpicture}
}
%% use a small dash ('-') for a bulletpoint list
\setbeamertemplate{itemize item}{\usebeamercolor[fg]{item}\small\ECFAugie{-}}
%% Frametitle
\setbeamertemplate{frametitle}{
\begin{beamercolorbox}{frametitle}
\vskip17pt
\usebeamerfont{frametitle}
\insertframetitle \\
\usebeamerfont{framesubtitle}\insertframesubtitle
\end{beamercolorbox}
}
%% remove navigation symbols
\setbeamertemplate{navigation symbols}{}
%% Date in the Corner
\setbeamertemplate{headline}{
\rotatebox{30}{
\ifx\insertdate\empty\else
\hspace*{0.25cm}\ECFAugie\insertshortdate\hspace*{0.5cm}
\fi
}
\vspace*{-1cm}
}
\begin{document}
\ECFAugie
\begin{frame}[fragile,t]
\frametitle{\LARGE Codificando una partitura en Musixtex}
\normalfont
\setbeamercolor{normal text}{fg=black}
\usebeamercolor[fg]{normal text}
\centering
\begin{minipage}{0.65\linewidth}
\begin{minted}[
frame=lines,
framesep=2mm,
baselinestretch=1.2,
bgcolor=gray,%gray-undar,
fontsize=\footnotesize,
linenos,
escapeinside=@@,
highlightlines={2}%,highlightcolor=red
]{latex}
\begin{music}
@\colorbox{yellow}{\setclef1\treble}@ % Clave de la partitura
\nobarnumbers % Omite numeración en compases
\startextract % Se inicia el fragmento musical
\NOTEs\ql a\qu c\ql e\en\setdoubleBAR
\endextract % Se finaliza el fragmento musical
\end{music}
\end{minted}
%};
%\end{tikzpicture}
\end{minipage}
\hspace{0.05\linewidth}
\begin{minipage}{0.25\linewidth}
\begin{tikzpicture}
\node[anchor=south west,inner sep=0,scale=1,fill=white] (EjemClave) at (0,0) {
\scalebox{0.73}{\begin{music}
\setclef1\treble % Clave de la partitura
\nobarnumbers % Omite numeración compases
\startextract % Se inicia el fragmento musical
\NOTEs\ql a\qu c\ql e\en\setdoubleBAR
\endextract % Se finaliza el fragmento musical
\end{music}}
};
\end{tikzpicture}
\end{minipage}
\setbeamercolor{normal text}{fg=white}
\usebeamercolor[fg]{normal text}
\ECFAugie
\end{frame}
\end{document}
请注意,需要使用 Beamer 和 Minted 包来高亮显示代码行部分。还需要使用 Beamer 和 Tikz 包来扩展节点的绘图区域。
答案1
根据反馈,已经使用如下代码解决:
\documentclass[aspectratio=169]{beamer}
\usepackage{musixtex}
\usepackage{minted}
\usemintedstyle{borland}
\usepackage[T1]{fontenc}
\usepackage{emerald}%Fuente tipo mano para pizarra en Beamer
\usepackage[spanish]{babel}
%Paquetes para Beamer
\usepackage{calc}
\usepackage{ifthen}
\usepackage{tikz}
\usepackage{pgf}
\usepackage{pgffor}
\usepackage{float} %Paquete para posicionar Tablas
\usepackage{adjustbox}%Para centrar tablas
\usepackage{xcolor}
\xdefinecolor{gray-undar}{RGB}{52,52,52}
\xdefinecolor{red-undar}{RGB}{179,35,79}
% set text colors for different objects
\setbeamercolor{frametitle}{fg=white}
\setbeamercolor{structure}{fg=white}
\setbeamercolor{normal text}{fg=white}
\setbeamercolor{alerted text}{fg=white}
\setbeamercolor{example text}{fg=white}
%% set fonts
\setbeamerfont{frametitle}{size=\Huge, series=\ECFAugie}
\setbeamerfont{framesubtitle}{size=\large, series=\ECFAugie}
\setbeamerfont{title}{size=\huge, series=\ECFAugie}
\setbeamerfont{author}{size=\large, series=\ECFAugie}
\setbeamerfont{date}{size=\large, series=\ECFAugie}
\setbeamerfont{institute}{size=\large, series=\ECFAugie}
\setbeamerfont{caption}{series=\ECFAugie}
%% Green Background Colour
\setbeamercolor{background canvas}{bg=green!18!black}
%% Random Dust Trails
\setbeamertemplate{background}{
\begin{tikzpicture}
\useasboundingbox (0,0) rectangle (\the\paperwidth, \the\paperheight);
\foreach \i in {1,...,30} {
\pgfmathsetmacro{\x}{random(0,10000)/5000-1}%
\pgfmathsetmacro{\y}{random(0,10000)/10000-0.1}%
\pgfmathsetmacro{\r}{random(0,10000)/1000-5}%
\rotatebox{\r}{
%\pgftext[at=\pgfpoint{\x\paperwidth}{\y\paperheight}, left, base]{\includegraphics[width=\textwidth]{LOGO_UNDAR_PNG_RGB.png}}
}
};
\end{tikzpicture}
}
%% use a small dash ('-') for a bulletpoint list
\setbeamertemplate{itemize item}{\usebeamercolor[fg]{item}\small\ECFAugie{-}}
%% Frametitle
\setbeamertemplate{frametitle}{
\begin{beamercolorbox}{frametitle}
\vskip17pt
\usebeamerfont{frametitle}
\insertframetitle \\
\usebeamerfont{framesubtitle}\insertframesubtitle
\end{beamercolorbox}
}
%% remove navigation symbols
\setbeamertemplate{navigation symbols}{}
%% Date in the Corner
\setbeamertemplate{headline}{
\rotatebox{30}{
\ifx\insertdate\empty\else
\hspace*{0.25cm}\ECFAugie\insertshortdate\hspace*{0.5cm}
\fi
}
\vspace*{-1cm}
}
\begin{document}
\ECFAugie
\begin{frame}[fragile,t]
\frametitle{\LARGE Codificando una partitura en Musixtex}
\normalfont
\setbeamercolor{normal text}{fg=black}
\usebeamercolor[fg]{normal text}
\centering
\begin{minipage}{0.65\linewidth}
\begin{minted}[
frame=lines,
framesep=2mm,
baselinestretch=1.2,
bgcolor=gray,%gray-undar,
fontsize=\footnotesize,
linenos,
escapeinside=@@,
highlightlines={2}%,highlightcolor=red
]{latex}
\begin{music}
@\colorbox{yellow}{\textbackslash{setclef1}\textbackslash{treble}}@ % Clave de la partitura
\nobarnumbers % Omite numeración en compases
\startextract % Se inicia el fragmento musical
\NOTEs\ql a\qu c\ql e\en\setdoubleBAR
\endextract % Se finaliza el fragmento musical
\end{music}
\end{minted}
%};
%\end{tikzpicture}
\end{minipage}
\hspace{0.05\linewidth}
\begin{minipage}{0.25\linewidth}
\begin{tikzpicture}
\node[anchor=south west,inner sep=0,scale=1,fill=white,minimum width=4.5cm] (EjemClave) at (0,0) {
\scalebox{0.73}{\begin{music}
\setclef1\treble % Clave de la partitura
\nobarnumbers % Omite numeración compases
\startextract % Se inicia el fragmento musical
\NOTEs\ql a\qu c\ql e\en\setdoubleBAR
\endextract % Se finaliza el fragmento musical
\end{music}}
};
\end{tikzpicture}
\end{minipage}
\setbeamercolor{normal text}{fg=white}
\usebeamercolor[fg]{normal text}
\ECFAugie
\end{frame}
\end{document}