2

It is needed to set colorbox highlight and node area for musix environment using Beamer with Musixtex, the basic code is as follow:

\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}

The current output is as follow: current

Note that is needed to highline a code line part using Beamer and Minted package. Also is needed to extend the plotting area of the node using Beamer and Tikz package.

3
  • Can you clarify what changes you'd like to make to the yellow square? Feb 15 at 13:27
  • 1
    You can make the white box on the right bigger with \node[anchor=south west,inner sep=0,scale=1,fill=white,minimum width=4cm] Feb 15 at 13:28
  • Regarding the yellow square, I handle it with the following code: @\colorbox{yellow}{\textbackslash{setclef1}\textbackslash{treble}}@ % Clave de la partitura
    – ABV
    Feb 15 at 13:34

1 Answer 1

3

According feedback, It has been solved using the following code:

\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}

The solved output is as follow: solved

1
  • \setlength{\fboxsep}{0pt}%Color boxes start with a small but noticeable space, which can be annoying when highlighting whole lines of Python where indentation matters, this command prevent it.
    – ABV
    Feb 16 at 0:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.