[Tex/LaTex] How to Align Equations to Top of Minipage

alignminipagetables

I have two align environments in 2 minipages and I want them to be aligned at the very top. I am usually able to do it with 2 regular equations, but it doesn't work when I tried doing it on the two align environment, I end up getting a gap on the left minipage so it looks a bit off. Below is my code and output.

\documentclass[a4paper, 11pt, letterpaper]{article}
\usepackage{comment} 
\usepackage{fullpage} 
\usepackage{amssymb}
\usepackage{mathtools,amsthm}
\usepackage{tabularx}
\begin{document}
\begin{minipage}[t]{0.6\textwidth}
\vspace{0pt}
\begin{align*}
    \f{dy}{dx} &= 1\cdot (2x-1)^2 + (x+3)\cdot 2 \cdot (2x-1) \cdot 2\\
    &= (2x-1)^2 + 4(x+3)(2x-1)\\
    &= (2x-1)[(2x-1)+4(x+3)]\\
    &= (2x-1)(2x-1+4x+12)\\
    &= (2x-1)(6x+11)
\end{align*}
\end{minipage}
\hfill
\begin{minipage}[t]{0.3\textwidth}
\vspace{0pt}
\begin{tabular}{|p{\textwidth}}
{$\!\begin{aligned}
    &u=x+3\\
    &v=(2x-1)^2\\
    &u'=1\\
    &v'=4(2x-1)
\end{aligned}$}
\end{tabular}
\end{minipage}
\end{document}

enter image description here

Thanks for any help!

Best Answer

This probably achieves what you want (I made the code compilable by replacing \f by \frac and changed the minipage alignment to [h]):

\documentclass[a4paper, 11pt, letterpaper]{article}
\usepackage{comment} 
\usepackage{fullpage} 
\usepackage{amssymb}
\usepackage{mathtools,amsthm}
\usepackage{tabularx}
\begin{document}
\begin{minipage}[h]{0.6\textwidth}
\vspace{0pt}
\begin{align*}
    \frac{dy}{dx} &= 1\cdot (2x-1)^2 + (x+3)\cdot 2 \cdot (2x-1) \cdot 2\\
    &= (2x-1)^2 + 4(x+3)(2x-1)\\
    &= (2x-1)[(2x-1)+4(x+3)]\\
    &= (2x-1)(2x-1+4x+12)\\
    &= (2x-1)(6x+11)
\end{align*}
\end{minipage}
\hfill
\begin{minipage}[h]{0.3\textwidth}
\vspace{0pt}
\begin{tabular}{|p{\textwidth}}
{$\!\begin{aligned}
    &u=x+3\\
    &v=(2x-1)^2\\
    &u'=1\\
    &v'=4(2x-1)
\end{aligned}$}
\end{tabular}
\end{minipage}
\end{document}

enter image description here

Just for the records: if I wanted to get the vertical line, I'd use

\documentclass[a4paper, 11pt]{article} % either letterpaper or a4paper
\usepackage{fullpage} 
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage{tikz}
\newcommand{\tikznode}[2]{%
\tikz[remember picture,baseline=(#1.base),inner sep=0pt] \node (#1) {$#2$};%
}%from https://tex.stackexchange.com/questions/402462/tikz-equivalent-of-pstricks-commands-ncbar-and-rnode/402466#402466
\begin{document}
\begin{align*}
   \frac{\mathrm{d}y}{\mathrm{d}x} &= 1\cdot (2x-1)^2 + (x+3)\cdot 2 \cdot (2x-1) \cdot 2
       & \tikznode{u}{\strut}u&=x+3\\
    &= (2x-1)^2 + 4(x+3)(2x-1)
       & v&=(2x-1)^2\\
    &= (2x-1)[(2x-1)+4(x+3)]
       &u'&=1\\
    &= (2x-1)(2x-1+4x+12)
      &  \tikznode{v}{\strut}~v'&=4(2x-1)\\
    &= (2x-1)(6x+11)
\end{align*}
\tikz[overlay,remember picture]{\draw (v|-u.north)--(v.south);}
\end{document}

enter image description here

Note that I kicked out some of the unnecessary packages and also removed one of the conflicting options (letterpaper).

Related Question