1

I am trying to get the equation in the flalign environment to be left aligned with the text in the tabular environment above it, and to have the same width -- 0.8\textwidth. The equation is a constraint, and ideally it would have similar spacing as the parameter lines above, but I just cannot figure out how to make it work. I have tried using a minipage, and have also tried putting the equation in the tabular environment.

How it look now

This is how it currently looks, I want the equation that starts "wqq_t" to be contained within the same width as the tabular environment above.

\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}
6
  • Can you please add a sketch of the desired alignment?
    – egreg
    Commented Apr 19 at 13:03
  • I included an image now! Thanks
    – vardo
    Commented Apr 19 at 13:06
  • What would be the reason to push the condition so far away from the equation?
    – egreg
    Commented Apr 19 at 16:11
  • I just like the way it looks. In another part of the paper I have like 25 constraints all together and I think its easier to read this way
    – vardo
    Commented Apr 20 at 20:33
  • Sorry, but I believe it's harder. Things that are strictly related to each other should be as near as possible.
    – egreg
    Commented Apr 20 at 20:38

1 Answer 1

0

The big question is whether you want to match the interior or the exterior of the tabular. For the exterior, one simply needs to measure the width of the tabular. For the interior, you need to account of the \tabcolsep and in this case \arrayrulewidth automatically added by the tabular.

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

demo

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .