flalign 環境の幅を定義するにはどうすればいいですか?

flalign 環境の幅を定義するにはどうすればいいですか?

私は、flalign 環境の数式を、その上にある tabular 環境のテキストと左揃えにし、同じ幅 (0.8\textwidth) にしようとしています。数式は制約であり、理想的には上のパラメータ行と同じ間隔にしたいのですが、どうしたらうまくいくのかわかりません。ミニページの使用を試したり、数式を tabular 環境に配置したりしてみました。

今の様子

現状では、"wqq_t" で始まる方程式が、上記の表形式環境と同じ幅内に収まるようにしたいと考えています。

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{tabular}{lp{0.8\textwidth}}
    & \\
    \multicolumn{2}{l}{\textbf{Sets and Parameters}} \\
    $\mathcal{B}$ & Description of this parameter\\
    \\
    \multicolumn{2}{l}{\textbf{Objective and Constraints}} 
\end{tabular}

\begin{minipage}{0.8\textwidth}
    \begin{flalign}
        &\wqq_t = k && \forall t \in \mathcal{B} \label{eq: br1}
    \end{flalign}
\end{minipage}

\end{document}

答え1

大きな問題は、表の内部と外部のどちらを一致させたいかということです。外部の場合は、表の幅を測るだけで済みます。内部の場合は、 と、\tabcolsepこの場合は\arrayrulewidth表によって自動的に追加される を考慮する必要があります。

\documentclass{article}
\usepackage{amsmath}

\newsavebox{\tempbox}

\begin{document}
\savebox\tempbox{% measure width
\begin{tabular}{|lp{0.8\textwidth}|}
    & \\
    \multicolumn{2}{|l|}{\textbf{Sets and Parameters}}  \\
    $\mathcal{B}$ & Description of this parameter\\
    &\\
    \multicolumn{2}{|l|}{\textbf{Objective and Constraints}} 
\end{tabular}}\usebox\tempbox

\begin{minipage}{\wd\tempbox}% match exterior
    \begin{flalign}
        &wqq_t = k && \forall t \in \mathcal{B} \label{eq: br1}
    \end{flalign}
\end{minipage}

\hspace*{\dimexpr \tabcolsep+\arrayrulewidth}%
\begin{minipage}{\dimexpr \wd\tempbox-2\tabcolsep-2\arrayrulewidth}
    \begin{flalign}
        &wqq_t = k && \forall t \in \mathcal{B} \label{eq: br1}
    \end{flalign}
\end{minipage}

\end{document}

デモ

関連情報