3
\documentclass{article}

\usepackage{enumitem,amssymb}
\usepackage{amsmath}
\usepackage{multicol}
\usepackage{hyperref}
\usepackage{multirow}
\usepackage{xcolor}
\usepackage{array}
\usepackage{makecell}
\usepackage{tabularx}
\usepackage{booktabs}

\newcolumntype{L}{>{\(} l <{\)}}

\begin{document}

\everymath{\displaystyle}
\renewcommand{\arraystretch}{2}
\begin{tabularx}{\textwidth}{|LLL|}
  \hline
  \sin 2x = 2 \cos x \sin x                       &
  \parbox{101pt}{
    \begin{flalign*}
      \cos 2x & = \cos^2 x - \sin^2 x \\
      & = 2\cos^2 x - 1       \\
      & = 1 - 2\sin^2 x
    \end{flalign*}
  }                                               &
  \tan 2x = \frac{2\tan x}{1 - \tan^2 x}            \\
  \hline
\end{tabularx}
\end{document}

(Only an important part of code is shown here for brevity.)

As is seen in the picture, I want align all the cells of the tabular to the top. How to do that?

Note: I think a tabular is needed because I have many rows of equations to show. See the picture below.

enter image description here

3
  • 1
    I still don't think you need a tabular: the framed encironment can break across pages, and as to the amsmath environments, you have the \allowdisplaybreaks directive.
    – Bernard
    Commented Aug 26, 2020 at 20:07
  • So, in what circumstances do you think I should use a tabular?
    – Neo
    Commented Aug 27, 2020 at 0:51
  • As far as I can imagine various situations, probably when you want to have vertical lines separating columns. Anyway, I always prefer the simpler code.
    – Bernard
    Commented Aug 27, 2020 at 7:58

1 Answer 1

4

You don't really need a tabular for that: a simple framed environment around a flalign* environment will do it:

\documentclass{article}
\usepackage{enumitem,amssymb}
\usepackage{amsmath}
\usepackage{multicol}
\usepackage{hyperref}
\usepackage{multirow}
\usepackage[svgnames]{xcolor}
\usepackage{makecell}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{framed} 
\newcolumntype{L}{>{\(} l <{\)}}

\begin{document}

\setlength{\FrameRule}{0.6pt}
\renewcommand{\FrameCommand}{\setlength{\fboxrule}{0.6pt}\fcolorbox{Coral}{white}}
\begin{framed}
\begin{flalign*}
   \sin 2x & = 2 \cos x \sin x & \cos 2x & = \cos^2 x - \sin^2 x & \tan 2x & = \smash{\frac{2\tan x}{1 - \tan^2 x}} \\
    & & & = 2\cos^2 x - 1 \\
     & & & = 1 - 2\sin^2 x
\end{flalign*}
\end{framed}

\end{document} 

enter image description here

1
  • 1
    Excellent suggestion! Thanks for reminding me this problem!
    – Bernard
    Commented Aug 26, 2020 at 12:56

You must log in to answer this question.

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