MusiXTex抽出の幅を自動的に調整する

MusiXTex抽出の幅を自動的に調整する

十分ではあるが最適ではない答えが見つかりました。改善点があれば歓迎します。

いくつかのMusiXTeX抜粋が、ドキュメントのサブ図としていくつかのフロート内に配置されます。図環境内でのこれらの抜粋の幅の変化は、見た目に好ましくないかもしれません。幅はあまり変化しません。したがって、幅を均一にすると効果的かもしれません。これを自動的に実現する方法はありますか? その場合、幅は各図環境で個別に調整する必要があります。おそらく、同じページ上の異なるフロート内の複数の抜粋の幅を調和させるように質問を拡張するのが妥当でしょう。

次の MWE は問題を示しており、私の手動アプローチは回答に記載されています。

\documentclass{article}
\usepackage{subfig,musixtex}

\begin{document}

\begin{figure}
\subfloat[narrow example]{%
\begin{music}%
\nobarnumbers%
\startextract%
\NOTEs\wh{cdefg}\enotes%
\endextract%
\end{music}}

\subfloat[wide example]{%
\begin{music}%
\nobarnumbers%
\startextract%
\NOTes\ha{cdef}\enotes\bar%
\NOTes\ha{ghi}\enotes%
\endextract%
\end{music}}

%\subfloat[test]{%from p. 116 of the manual, most like useless for this problem
%\begin{music}%
%\let\extractline\hbox
%\hbox to \hsize{%
%\hss\startextract\NOTes\hu{cd}\enotes\endextract\hss%
%\hss\startextract\NOTEs\wh{cd}\enotes\endextract\hss}%
%\end{music}
%}
\caption{Can these two examples automatically have the same width?}
\end{figure}

\end{document}

ここに画像の説明を入力してください

述べる。タイトルの駄洒落についてはあらかじめお詫びします。

答え1

以下は手動アプローチです。これで質問は解決しました。自動的な側面を除いて。

カプセル化にはや を使用するよりもを使用する方が\hsize=\musicwidth自然で効率的かもしれません。言うまでもなく、幅のグローバルで不変の定義は、複数の環境内の同じページで幅が一定であるという要件を満たしますが、すべての抜粋に適切であるとは限りません。ただし、ほとんどの図に適したサイズが存在する可能性があります。\parboxminipagefigure

\documentclass{article}
\usepackage{subfig,musixtex}

\newlength{\musicwidth}%new
\setlength{\musicwidth}{0.75\textwidth}%new, can be set for each instance of a figure environment 

\begin{document}

\begin{figure}
\centering%new

\subfloat[narrow example]{
%\fbox
{\begin{music}
\hsize=\musicwidth%new
\nobarnumbers%
\startpiece%new
\NOTEs\wh{cdefg}\enotes%
\endpiece%new
\end{music}}}

\subfloat[wide example]{
%\fbox
{\begin{music}
\hsize=\musicwidth%new
\nobarnumbers%
\startpiece%new
\NOTes\ha{cdef}\enotes\bar%
\NOTes\ha{ghi}\enotes%
\endpiece%new
\end{music}}}

\caption{This manual approach by try and error works. But there might be room for improvement.}
\end{figure}

\end{document}

ここに画像の説明を入力してください

述べる。おそらく、の微妙なコメントには\startpiece%new追加の説明が必要でしょう。MusiXTex抽出の幅を自動的に調整する*.mx2この提案では、マニュアルに記載されているファイル の生成が必要です。https://ctan.org/pkg/musixtex「3 パス システム」のセクション (詳細なマニュアルを読んでください、RTFM)。

関連情報