1

How do I align the fbox in the second column to the top so that the top rows of the two match? I have tried with minipage and makecell and a ton of other things but I can't make it work. Any ideas?

PS! The fboxes will be removed later, they are just for illustration purposes DS

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tabularx}
\usepackage{enumitem}
\usepackage{amsmath}

\begin{document}

\begin{tabularx}{\linewidth}{|>{\centering\arraybackslash}X|>{\centering\arraybackslash}X|}
    \hline
    \fbox{\parbox{0.9\linewidth}{
        \vspace{-4mm}
        \begin{flalign}
            &a + b  = 100 &&\\[2mm]
            &10c + e = 1000 &&\\[2mm]
            &a + b  = 100 &&\\[2mm]
            &c + e = 1000 &&
        \end{flalign}
        \vspace{-6mm}
    }}
    &
    \fbox{\parbox{0.9\linewidth}{
        \begin{itemize}[topsep=0pt, leftmargin=*]
            \item{B1}
        \end{itemize}
    }}\\
    \hline
  \end{tabularx}
\end{document}

The problem

10
  • 1
    Do you use flalign for anything else than alignment on the left side?
    – Bernard
    Aug 9, 2020 at 9:24
  • 1
    The \parbox command messes up the alignment here. If you use \parbox[t]{...} instead, bow boxes are to aligned. Since you mention the \fbox command just being for demonstration purposes, do you really need the \parbox commands in your actual document?
    – leandriis
    Aug 9, 2020 at 9:34
  • @Bernard Answer is no Aug 9, 2020 at 9:55
  • @leandriis Works like a charm! Thanks! Works with both fboxes and parboxes. I want the parbox on the left side to add padding to the flalign and I use it in the other as well for consistency... you have a better idea? Feel free to answer the question and I shall accept the answer. Thanks! Aug 9, 2020 at 9:59
  • Do you mean a vertical padding?
    – Bernard
    Aug 9, 2020 at 11:46

1 Answer 1

2

Probabl you're interested in something along the lines of the following:

enter image description here

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tabularx}
\usepackage{enumitem}
\usepackage{amsmath}

\begin{document}
\noindent
{
\setlength{\abovedisplayskip}{0pt}
\setlength{\belowdisplayskip}{0pt}
\begin{tabularx}{\linewidth}{|@{\hspace{0.5cm}}>{\centering\arraybackslash}X@{\hspace{0.5cm}}|>{\centering\arraybackslash}X|}
    \hline
        {\begin{flalign}
            &a + b  = 100 &&\\
            &10c + e = 1000 &&\\
            &a + b  = 100 &&\\
            &c + e = 1000 &&
        \end{flalign}}
    &
        \begin{itemize}[topsep=0pt, leftmargin=*]
            \item{B1}
        \end{itemize}
    \\
    \hline
  \end{tabularx}
}
\end{document}

You must log in to answer this question.

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