5

I'm trying to allign a normal cell with text together with another one in which I have an equation. For instance, I want OB2B and SSMF to be aligned with their corresponding equations.

Here is my code:

\documentclass{article}
\usepackage{amsmath}
\usepackage{array}
\begin{document}
    
\begin{table}[h!]
    \caption{Current amplitude response at low frequencies in the mmW band (small signal regime)}
    \centering
    \small
    \renewcommand{\arraystretch}{2} % adjust row spacing
    \begin{tabular}{p{1.5cm}p{8cm}}
    \hline\hline
    & \centering\arraybackslash $i(2\omega_{RF}\pm\omega_{IF})$ \\
    \hline
    
    OB2B & 
    \begin{minipage}[t]{8cm}\vspace{0pt}
    \begin{equation}
    \Re P_0 m_{AM}m_{RF}^2 \sin^2 \varphi_{DC} 
    \label{gain_OB2B}
    \end{equation}
    \end{minipage} \\
    
    SSMF & 
    \begin{minipage}[t]{8cm}\vspace{0pt}
    \begin{equation}
    \Re P_0 m_{AM}m_{RF}^2 \sin^2 \varphi_{DC}
    \left(1 \pm j \alpha \kappa P_0 \beta L \omega_{RF}\right)
    \label{gain_SSMF}
    \end{equation}
    \end{minipage} \\
    
    \hline\hline
    \end{tabular}
    \label{gainTable1}
    \end{table}

\end{document}

Resulting table

7
  • 2
    Please can you do an edit put a complete minimal code? Commented yesterday
  • 2
    I added: \documentclass{article} \usepackage{amsmath} \begin{document} \end{document} Commented yesterday
  • 1
    @MartaBotellaCampos You are missing the array package, without it, your code does not compile. Commented yesterday
  • @samcarter_is_at_topanswers.xyz I actually don't have it on my main document though I added it here just in case. Commented yesterday
  • @MartaBotellaCampos You probably load it indirectly via other packages. Commented yesterday

2 Answers 2

5

Like this:

enter image description here

  • Instead of tabular I would rather use tblr of tabularray package and for equation term use X column type. By this I'm able to remove minipages.
  • For numbering and labeling of equation I would use separate columns (see MWE below)
  • I took a liberty and introduce some new packages (as tabularray libraries), which enable to write nicer table. Similar for caption I would use options of caption package (you can redesign it according to your taste or requirement):
\documentclass{article}
\usepackage{tabularray}
\UseTblrLibrary{amsmath,
                booktabs,
                counter,
                siunitx}
\usepackage[skip=1ex,
            font=small,
            labelfont=bf,
            hang]{caption}

\begin{document}
\begin{equation}
a^2 + b^2 = c^2
\end{equation}
    \begin{table}[!ht]
\caption{Current amplitude response at low frequencies in the \unit{\milli\meter\watt} % what is mmW?
         band (small signal regime)}
\label{gainTable1}
\small
\begin{tblr}{colspec = {Q[l, m, wd=1.5cm] 
                        X[c, m, mode=dmath] 
                        Q[r] @{}},
             cell{2-Z}{Z} = {cmd=\refstepcounter{equation}}
            }
    \toprule
        &   i(2\omega_{\mathrm{RF}}\pm\omega_{\mathrm{IF}})            
            &                  \\
    \midrule    
OB2B    &   \Re P_0 m_{AM}m_{RF}^2 \sin^2 \varphi_{DC}
            &   (\theequation)\label{gain_OB2B} \\
SSMF    &   \Re P_0 m_{AM}m_{RF}^2 \sin^2 \varphi_{DC}
            \bigl(1 \pm j \alpha \kappa P_0 \beta L \omega_{RF}\bigr)
            &   (\theequation)\label{gain_SSMF} \\
    \bottomrule
\end{tblr}
    \end{table}
\begin{equation}
c^2 - b^2 = a^2
\end{equation}    
See equations \eqref{gain_OB2B} and \eqref{gain_SSMF} \dots
\end{document}

Edit:
I extend first version MWE so, that show that equation numbering is correct and that referencing works as expected.

Addendum:
Some off-topic suggestions:

  • I would indices which are not variables write with with upright letters.
  • For a bit better positioning of indices I would use subdepth package.
  • For shorter write I also would declare a new math operators (using amsmath package):
\documentclass{article}
\usepackage{tabularray}
\UseTblrLibrary{amsmath,
                booktabs,
                counter,
                siunitx}
\DeclareMathOperator{\AM}{AM}   % new
\DeclareMathOperator{\RF}{RF}   % new
\DeclareMathOperator{\DC}{DC}   % new
\usepackage[low-sup]{subdepth}  % new, for subscript positioning

\usepackage[skip=1ex,
            font=small,
            labelfont=bf,
            hang]{caption}

\begin{document}
\begin{equation}
a^2 + b^2 = c^2
\end{equation}
    \begin{table}[!ht]
\caption{Current amplitude response at low frequencies in the \unit{\milli\meter\watt} % what is mmW?
         band (small signal regime)}
\label{gainTable1}
\small
\begin{tblr}{colspec = {Q[l, m, wd=1.5cm] 
                        X[c, m, mode=dmath] 
                        Q[r] @{}},
             cell{2-Z}{Z} = {cmd=\refstepcounter{equation}}
            }
    \toprule
        &   i(2\omega_{\RF}\pm\omega_{\mathrm{IF}})            
            &                  \\
    \midrule    
OB2B    &   \Re P_0 m_{\AM}m_{\RF}^2 \sin^2 \varphi_{\DC}
            &   (\theequation)\label{gain_OB2B} \\
SSMF    &   \Re P_0 m_{\AM}m_{\RF}^2 \sin^2 \varphi_{\DC}
            \bigl(1 \pm j \alpha \kappa P_0 \beta L \omega_{\RF}\bigr)
            &   (\theequation)\label{gain_SSMF} \\
    \bottomrule
\end{tblr}
    \end{table}
\begin{equation}
c^2 - b^2 = a^2
\end{equation}    
See equations \eqref{gain_OB2B} and \eqref{gain_SSMF} \dots
\end{document}

enter image description here

2
  • 2
    Wow, nice! Thank you so much! :) Commented yesterday
  • @MartaBotellaCampos, you are welcome! Commented yesterday
3

I'd fake an equation environment.

\documentclass{article}
\usepackage{amsmath}
\usepackage{array,booktabs}
\usepackage{caption} % for captions above tables

\newcounter{lequation}
\newcommand{\lequation}[1]{%
  \refstepcounter{equation}%
  \stepcounter{lequation}\label{leq\thelequation}%
  \hspace*{\fill}$\displaystyle{#1}$\hspace*{\fill}\eqref{leq\thelequation}%
}

\begin{document}
    
\begin{table}[htp!]
\centering
\small

\caption{Current amplitude response at low frequencies in the mmW band (small signal regime)}
\label{gainTable1}

\begin{tabular}{@{} l w{c}{8cm} @{}}
\toprule
    & $i(2\omega_{RF}\pm\omega_{IF})$ \\
\midrule
OB2B & \lequation{
         \Re P_0 m_{\mathrm{AM}}m_{\mathrm{RF}}^2 \sin^2 \varphi_{\mathrm{DC}}
         \label{gain_OB2B}
       } \\
\addlinespace
SSMF & \lequation{
         \Re P_0 m_{\mathrm{AM}}m_{\mathrm{RF}}^2 \sin^2 \varphi_{\mathrm{DC}}
         (1 \pm j \alpha \kappa P_0 \beta L \omega_{\mathrm{RF}})
         \label{gain_SSMF}
       } \\
\bottomrule
\end{tabular}

\end{table}

\eqref{gain_OB2B} and \eqref{gain_SSMF}

\end{document}

output

An internal label is set in order to be able to use \eqref independently on assigned labels.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.