Vertically aligning text and equation in two minipages

by samirem   Last Updated July 17, 2017 10:23 AM

I have two minipages next to each other, the first one containing text that describes an equation, and the second one containing the actual equation. I want to align the text vertically so that the first line of text uses the same baseline as the equation.

This is what I've got so far, but as you can see, not really right. The small spacing error annoys me and I feel like I don't understand how it works with the vertical spacing.

\documentclass[a4paper, 11pt, fleqn]{article}

\usepackage{autobreak}
\usepackage[left=15mm,right=15mm]{geometry}
\usepackage{etoolbox}

\newcommand{\zerodisplayskips}{%
  \setlength{\abovedisplayskip}{0pt}%
  \setlength{\belowdisplayskip}{0pt}%
  \setlength{\abovedisplayshortskip}{0pt}%
  \setlength{\belowdisplayshortskip}{0pt}}
\appto{\normalsize}{\zerodisplayskips} % To omit vertical spacing in the align-environment

\newlength{\equationheight}
\setlength{\mathindent}{0pt}
\newcommand{\textWidth}{.17\linewidth}
\newcommand{\eqnWidth}{.81\linewidth}


\begin{document}

    \paragraph{Long-Term Load}\mbox{}\\[-1.4ex]
    \settoheight{\equationheight}{$\alpha_{\mathrm{long}}=\alpha(1+\varphi_{\mathrm{creep}})$}
    \addtolength{\equationheight}{-1ex}
    \begin{minipage}[t]{\textWidth}
        \vspace{0ex} \vspace{\equationheight} Stiffness Ratio, Long-term \raggedright
    \end{minipage}
    \hfill
    \begin{minipage}[t]{\eqnWidth}
        \begin{align*}
            \begin{autobreak}
                \alpha_{\mathrm{long}}=\alpha(1+\varphi_{\mathrm{creep}})=6.06(1+0)=6.06
            \end{autobreak}
        \end{align*}
    \end{minipage}\\[0.5ex]
    %
    \settoheight{\equationheight}{$\dfrac{\dfrac{b\,h^2}{2} + (\alpha_{\mathrm{long}}-1)A_{\mathrm{s}} \, d}{A_{\mathrm{I,long}}}$}
    \addtolength{\equationheight}{-1ex}
    \begin{minipage}[t]{\textWidth}
        \vspace{0ex} \vspace{\equationheight} Distance to C.o.G \raggedright
    \end{minipage}
    \hfill
    \begin{minipage}[t]{\eqnWidth}
        \begin{align*}
            \begin{autobreak}
                x_{\mathrm{I,long}}
                    =\dfrac{\dfrac{b\,h^2}{2} + (\alpha_{\mathrm{long}}-1)A_{\mathrm{s}} \, d}{A_{\mathrm{I,long}}}
                    =\dfrac{\dfrac{300\cdot600^2}{2} + (6.06-1)679 \cdot 564}{183434}
                    =304.9\text{ mm}
            \end{autobreak}
        \end{align*}
    \end{minipage}\\[0.5ex]
    %
    \settoheight{\equationheight}{$\dfrac{b \, h^3}{12} + b \, h (\dfrac{h}{2}-x_{\mathrm{I,long}})^2 + (\alpha_{\mathrm{long}}-1) A_{\mathrm{s}} \, (d-x_{\mathrm{I,long}})^2$}
    \addtolength{\equationheight}{-1ex}
    \begin{minipage}[t]{\textWidth}
        \vspace{0ex} \vspace{\equationheight} Second Moment of Area \raggedright
    \end{minipage}
    \hfill
    \begin{minipage}[t]{\eqnWidth}
        \begin{align*}
            \begin{autobreak}
                I_{\mathrm{I,long}}
                    =\dfrac{b \, h^3}{12} + b \, h (\dfrac{h}{2}-x_{\mathrm{I,long}})^2 + (\alpha_{\mathrm{long}}-1) A_{\mathrm{s}} \, (d-x_{\mathrm{I,long}})^2
                    =\dfrac{300\cdot600^3}{12} + 300\cdot600 (\dfrac{600}{2}-304.9)^2 + (6.06-1) 679 (564-304.9)^2
                    =5.63\cdot10^9 mm^4
            \end{autobreak}
        \end{align*}
    \end{minipage}\\[0.5ex]

\end{document}

Output: output

Can anyone here help me understand what I'm missing? I thought that

\settoheight{\equationheight}{...<equation>...}
...
\vspace{\equationheight} <text>

would be sufficient to get the same baseline for the text and the equation.

PS. The align* and autobreak environments are always there because I do not have full control over the input, and occasionally the equations are too long to fit a single line.



Related Questions


Turn off floats temporally

Updated June 04, 2015 03:10 AM