音乐和枚举一起

音乐和枚举一起

我用它来musixtex创作音乐。我想使用环境。请参阅此代码 -musicenumerate

\documentclass{article}
\usepackage{musixtex}

\begin{document}
    \begin{enumerate}
        \item   \begin{music}
            \setclef{1}{\alto}
            \startextract
            \notes \wh{c} \en
            \endextract
        \end{music}
        \hrule
        \item   \begin{music}
            \setclef{1}{\alto}
            \startextract
            \notes \wh{g} \en
            \endextract
        \end{music}
        \hrule
        \item   \begin{music}
            \setclef{1}{\alto}
            \startextract
            \notes \wh{g} \en
            \endextract
        \end{music}
        \hrule
    \end{enumerate}
\end{document}

这将产生以下输出。显然,枚举发生了错误。这可能是什么原因造成的,如何解决?

在此处输入图片描述


@Piroooh 提供的解决方案和一些进一步的疑问。

\documentclass{article}
\usepackage{musixtex}

\begin{document}
\begin{enumerate}
\item\mbox{\null}

\begin{music}
\setclef{1}{\alto}
\startextract
\notes \wh{c} \en
\endextract
\end{music}
\hrule
\item\mbox{\null}

\begin{music}
\setclef{1}{\alto}
\startextract
\notes \wh{g} \en
\endextract
\end{music}
\hrule
\item\mbox{\null}

\begin{music}
\setclef{1}{\alto}
\startextract
\notes \wh{g} \en
\endextract
\end{music}
\hrule
\item\mbox{\null}

\begin{music}
\setclef{1}{\alto}
\startextract
\notes \wh{c} \en
\endextract
\end{music}
\hrule
\item\mbox{\null}

\begin{music}
\setclef{1}{\alto}
\startextract
\notes \wh{g} \en
\endextract
\end{music}
\hrule
\item\mbox{\null}

\begin{music}
\setclef{1}{\alto}
\startextract
\notes \wh{g} \en
\endextract
\end{music}
\hrule
\item\mbox{\null}

\begin{music}
\setclef{1}{\alto}
\startextract
\notes \wh{c} \en
\endextract
\end{music}
\hrule
\item\mbox{\null}

\begin{music}
\setclef{1}{\alto}
\startextract
\notes \wh{g} \en
\endextract
\end{music}
\hrule
\item\mbox{\null}

\begin{music}
\setclef{1}{\alto}
\startextract
\notes \wh{g} \en
\endextract
\end{music}
\hrule
\item\mbox{\null}

\begin{music}
\setclef{1}{\alto}
\startextract
\notes \wh{c} \en
\endextract
\end{music}
\hrule
\item\mbox{\null}

\begin{music}
\setclef{1}{\alto}
\startextract
\notes \wh{g} \en
\endextract
\end{music}
\hrule
\item\mbox{\null}

\begin{music}
\setclef{1}{\alto}
\startextract
\notes \wh{g} \en
\endextract
\end{music}
\hrule
\item\mbox{\null}

\begin{music}
\setclef{1}{\alto}
\startextract
\notes \wh{c} \en
\endextract
\end{music}
\hrule
\item\mbox{\null}

\begin{music}
\setclef{1}{\alto}
\startextract
\notes \wh{g} \en
\endextract
\end{music}
\hrule
\item\mbox{\null}

\begin{music}
\setclef{1}{\alto}
\startextract
\notes \wh{g} \en
\endextract
\end{music}
\hrule
\item\mbox{\null}

\begin{music}
\setclef{1}{\alto}
\startextract
\notes \wh{c} \en
\endextract
\end{music}
\hrule
\item\mbox{\null}

\begin{music}
\setclef{1}{\alto}
\startextract
\notes \wh{g} \en
\endextract
\end{music}
\hrule
\item\mbox{\null}

\begin{music}
\setclef{1}{\alto}
\startextract
\notes \wh{g} \en
\endextract
\end{music}
\hrule

\end{enumerate}
\end{document}

参见第 9 点和第 17 点。列举和要点位于不同的页面上。

答案1

原因 : 这是由于music环境的高度从 LaTeX 中的行底开始。对于命令旁边的每个环境,都有相同的问题\item。(Minipage、includegraphics……)


解决方案 : 您可以通过在命令\mbox{\null}后添加一个空行来避免此行为\item。这是实现您想要的最简单的方法。

\documentclass{article}
\usepackage{musixtex}

\begin{document}
    \begin{enumerate}
        \item   \mbox{\null}

        \begin{music}
            \setclef{1}{\alto}
            \startextract
            \notes \wh{c} \en
            \endextract
        \end{music}
        \hrule
        \item   \mbox{\null}

        \begin{music}
            \setclef{1}{\alto}
            \startextract
            \notes \wh{g} \en
            \endextract
        \end{music}
        \hrule
        \item   \mbox{\null}

        \begin{music}
            \setclef{1}{\alto}
            \startextract
            \notes \wh{g} \en
            \endextract
        \end{music}
        \hrule
    \end{enumerate}
\end{document}

输出

输出

答案2

这是我发现的最佳解决方案。感谢@Pirooh 和@egreg。

\documentclass{article}
\usepackage{musixtex}

\begin{document}
\begin{enumerate}
\item \mbox{}
\begin{minipage}{\textwidth}
\begin{music}
\setclef{1}{\alto}
\startextract
\notes \wh{c} \en
\endextract
\end{music}
\end{minipage}

\item \mbox{}
\begin{minipage}{\textwidth}
\begin{music}
\setclef{1}{\alto}
\startextract
\notes \wh{g} \en
\endextract
\end{music}
\end{minipage}

\item \mbox{}
\begin{minipage}{\textwidth}
\begin{music}
\setclef{1}{\alto}
\startextract
\notes \wh{g} \en
\endextract
\end{music}
\end{minipage}

\item \mbox{}
\begin{minipage}{\textwidth}
\begin{music}
\setclef{1}{\alto}
\startextract
\notes \wh{c} \en
\endextract
\end{music}
\end{minipage}

\item \mbox{}
\begin{minipage}{\textwidth}
\begin{music}
\setclef{1}{\alto}
\startextract
\notes \wh{g} \en
\endextract
\end{music}
\end{minipage}

\item \mbox{}
\begin{minipage}{\textwidth}
\begin{music}
\setclef{1}{\alto}
\startextract
\notes \wh{g} \en
\endextract
\end{music}
\end{minipage}

\item \mbox{}
\begin{minipage}{\textwidth}
\begin{music}
\setclef{1}{\alto}
\startextract
\notes \wh{c} \en
\endextract
\end{music}
\end{minipage}

\item \mbox{}
\begin{minipage}{\textwidth}
\begin{music}
\setclef{1}{\alto}
\startextract
\notes \wh{g} \en
\endextract
\end{music}
\end{minipage}

\item \mbox{}
\begin{minipage}{\textwidth}
\begin{music}
\setclef{1}{\alto}
\startextract
\notes \wh{g} \en
\endextract
\end{music}
\end{minipage}

\item \mbox{}
\begin{minipage}{\textwidth}
\begin{music}
\setclef{1}{\alto}
\startextract
\notes \wh{c} \en
\endextract
\end{music}
\end{minipage}

\item \mbox{}
\begin{minipage}{\textwidth}
\begin{music}
\setclef{1}{\alto}
\startextract
\notes \wh{g} \en
\endextract
\end{music}
\end{minipage}

\item \mbox{}
\begin{minipage}{\textwidth}
\begin{music}
\setclef{1}{\alto}
\startextract
\notes \wh{g} \en
\endextract
\end{music}
\end{minipage}

\item \mbox{}
\begin{minipage}{\textwidth}
\begin{music}
\setclef{1}{\alto}
\startextract
\notes \wh{c} \en
\endextract
\end{music}
\end{minipage}

\item \mbox{}
\begin{minipage}{\textwidth}
\begin{music}
\setclef{1}{\alto}
\startextract
\notes \wh{g} \en
\endextract
\end{music}
\end{minipage}

\item \mbox{}
\begin{minipage}{\textwidth}
\begin{music}
\setclef{1}{\alto}
\startextract
\notes \wh{g} \en
\endextract
\end{music}
\end{minipage}

\item \mbox{}
\begin{minipage}{\textwidth}
\begin{music}
\setclef{1}{\alto}
\startextract
\notes \wh{c} \en
\endextract
\end{music}
\end{minipage}

\item \mbox{}
\begin{minipage}{\textwidth}
\begin{music}
\setclef{1}{\alto}
\startextract
\notes \wh{g} \en
\endextract
\end{music}
\end{minipage}

\item \mbox{}
\begin{minipage}{\textwidth}
\begin{music}
\setclef{1}{\alto}
\startextract
\notes \wh{g} \en
\endextract
\end{music}
\end{minipage}
\end{enumerate}
\end{document}

相关内容