flalign 환경의 너비를 정의하는 방법은 무엇입니까?

flalign 환경의 너비를 정의하는 방법은 무엇입니까?

나는 flalign 환경의 방정식을 그 위에 있는 테이블 형식 환경의 텍스트와 왼쪽 정렬하고 동일한 너비(0.8\textwidth)를 갖도록 노력하고 있습니다. 방정식은 제약 조건이며 이상적으로는 위의 매개변수 줄과 비슷한 간격을 가지지만 이를 작동시키는 방법을 알 수 없습니다. 나는 미니페이지를 사용해 보았고 방정식을 표 형식 환경에 넣어 보았습니다.

지금은 어떤 모습인가

이것이 현재 보이는 모습입니다. "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}

데모

관련 정보