1
\documentclass{article}
\usepackage{tabularx}
\usepackage{natbib}
\bibpunct{(}{)}{;}{a}{,}{,} % I added this

\usepackage{verbatim}  % for commenting

\usepackage{float}
\usepackage{array}
\usepackage{multirow}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{cite}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage{algorithmic}
\usepackage{graphicx}
\usepackage{textcomp}
\usepackage{xcolor}
\usepackage{verbatim}  % for commenting

\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{caption}
\usepackage{amsmath}
\usepackage{siunitx}


\newcommand{\stone}{\theta_1}

\newcommand{\sx}{x}
\newcommand{\sy}{y}

\begin{document}

\begin{table} [tbp]
\centering
  \caption{Equations}
  \label{table:Equations}
  \begin{tabular}{p{0.45in} p{0.5in} p{2.4in}} % {@{}ll@{}}
    \toprule
    \textbf{Inputs} & \textbf{Output} & \textbf{Equation} \\
    \midrule
    
   \rotatebox[origin=c]{0}{$\stone$}
    & $\sx$ & \begin{equation}\tag{1}
        0.5 \cos(2\pi\stone) + 0.5
    \end{equation}  \\%\hline

   \rotatebox[origin=c]{0}{$\stone$}
    & $\sy$ & \begin{equation}\tag{2} 0.5\sin(2\pi\stone) + 0.5 
    \end{equation}\\%\hline
    
\bottomrule
\end{tabular}
\end{table}

\end{document}

This is how the table looks after the above code is executed:

enter image description here

In this, the columns of the table are not aligned properly. I need the equations to be labeled.

1
  • 2
    What's the reason for \rotatebox with a zero angle?
    – egreg
    Jun 18 at 21:56

4 Answers 4

2

Why \rotatebox[origin=c]{0}{$\stone$}?

You can manually step the equation counter.

\documentclass{article}
\usepackage{amsmath}
\usepackage{booktabs}

% not sure what's the purpose of these commands
\newcommand{\stone}{\theta_1}
\newcommand{\sx}{x}
\newcommand{\sy}{y}

\begin{document}

\begin{table}[htbp]
\centering

\caption{Equations}
\label{table:Equations}

\begin{tabular}{lllr}
\toprule
\textbf{Inputs} & \textbf{Output} & \textbf{Equation} \\
\midrule
$\stone$ & $\sx$ & $0.5 \cos(2\pi\stone) + 0.5$ &
  \refstepcounter{equation}\thetag{\theequation}\label{eq:first}
\\
$\stone$ & $\sy$ & $0.5\sin(2\pi\stone) + 0.5$ &
  \refstepcounter{equation}\thetag{\theequation}\label{eq:second}
\\
\bottomrule
\end{tabular}

\end{table}

\eqref{eq:first} and \eqref{eq:second}

\end{document}

enter image description here

1

Whether something like this is better, or something like WinnieNotThePooh's answer might depend on how compact you want the table, but if you want something more compact, you could just manually increase the equation counter:

\documentclass{article}
\usepackage{tabularx}
\usepackage{natbib}
\bibpunct{(}{)}{;}{a}{,}{,} % I added this

\usepackage{verbatim}  % for commenting

\usepackage{float}
\usepackage{array}
\usepackage{multirow}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{cite}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage{algorithmic}
\usepackage{graphicx}
\usepackage{textcomp}
\usepackage{xcolor}
\usepackage{verbatim}  % for commenting

\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{caption}
\usepackage{amsmath}
\usepackage{siunitx}

\newcommand{\stone}{\theta_1}

\newcommand{\sx}{x}
\newcommand{\sy}{y}

\begin{document}

\begin{table}[tbp]
\centering
  \caption{Equations}
  \label{table:Equations}
  \begin{tabular}{p{0.45in} p{0.5in} p{2.2in} r@{}} % {@{}ll@{}}
    \toprule
    \textbf{Inputs} & \textbf{Output} & \textbf{Equation} & \\
    \midrule
    $\stone$
    & $\sx$
    & $0.5 \cos(2\pi\stone) + 0.5$
    & \refstepcounter{equation}(\theequation)\label{eq:one}
    \\
    $ \stone$
    & $\sy$
    & $0.5\sin(2\pi\stone) + 0.5$
    & \refstepcounter{equation}(\theequation)\label{eq:two}
    \\
\bottomrule
\end{tabular}
\end{table}

\end{document}

You should still be able to refer to them with \ref, etc., in the normal way.

equation table

1

With use of the tabularray packages: two possible solutions

\documentclass{article}
\usepackage{tabularray}
\UseTblrLibrary{amsmath, booktabs, counter, varwidth}


\begin{document}
\addtocounter{equation}{-1}
\begin{tblr}{colspec = {*{2}{Q[l,m, mode=math]}
                             X[c,m, mode=dmath]
                             Q[r, cmd=\refstepcounter{equation}]},
              row{1} = {font=\bfseries, c, mode=text},
             measure = vbox,
             }
    \toprule
Inputs      &   Output  &   Equation    &           \\
    \midrule
\theta_1    &   y   &   %
                        0.5 \cos(2\pi\theta_1) + 0.5  & \thetag{\theequation}\label{eq:first}   \\
\theta_1    &   y   &   %
                        0.5 \cos(2\pi\theta_1) + 0.5  & \thetag{\theequation}\label{eq:second}  \\
    \bottomrule
\end{tblr}

\medskip
\eqref{eq:first} and \eqref{eq:second}

\vspace{3ex}
\begingroup
    \setlength\abovedisplayskip{-1ex}
    \setlength\belowdisplayskip{-1ex}
\begin{tblr}{colspec = {*{2}{Q[l,m, mode=math]}
                             X[c,m]},
             row{1} = {font=\bfseries, c, mode=text},
           row{2-Y} = {rowsep=-2ex},
            measure = vbox,
             }
    \toprule
Inputs      &   Output  &   Equation        \\
    \midrule
\theta_1    &   y   &   \begin{equation}\label{eq:third}
                        0.5 \cos(2\pi\theta_1) + 0.5
                        \end{equation}      \\
\theta_1    &   y   &   \begin{equation}\label{eq:fourth}
                        0.5 \cos(2\pi\theta_1) + 0.5
                        \end{equation}      \\
\theta_1    &   y   &   \begin{equation}\label{eq:fifth}
                        0.5 \cos(2\pi\theta_1) + 0.5
                        \end{equation}      \\
    \bottomrule
\end{tblr}
\endgroup

\medskip
\eqref{eq:third}, \eqref{eq:fourth}  and \eqref{eq:fifth}
\end{document}

enter image description here

0

You cannot use \begin{equation}...\end{equation} inside a table cell. If you want it to look like a displayed equation, you can do this:

... & \(\displaystyle 0.5 \cos(2\pi\stone) + 0.5 \)  

But You can try something like that:

\documentclass{article}
\usepackage{tabularx}
\usepackage{natbib}
\bibpunct{(}{)}{;}{a}{,}{,} % I added this

\usepackage{verbatim}  % for commenting

\usepackage{float}
\usepackage{array}
\usepackage{multirow}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{cite}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage{algorithmic}
\usepackage{graphicx}
\usepackage{textcomp}
\usepackage{xcolor}
\usepackage{verbatim}  % for commenting

\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{caption}
\usepackage{amsmath}
\usepackage{siunitx}


\newcommand{\stone}{\theta_1}

\newcommand{\sx}{x}
\newcommand{\sy}{y}

\begin{document}

\begin{table} [tbp]
\centering
  \caption{Equations}
  \label{table:Equations}
  \begin{tabular}{p{0.45in} p{0.5in} p{2.4in}} % {@{}ll@{}}
    \toprule
    \textbf{Inputs} & \textbf{Output} & \textbf{Equation} \\
    \midrule
    
   \rotatebox[origin=c]{0}{$\stone$}
    & $\sx$ &  \parbox{4cm}{\begin{equation} 0.5 \cos(2\pi\stone) + 0.5 \end{equation}} \\%\hline

   \rotatebox[origin=c]{0}{$\stone$}
    & $\sy$ &  \parbox{4cm}{\begin{equation} 0.5\sin(2\pi\stone) + 0.5 \end{equation}}\\%\hline
    
\bottomrule
\end{tabular}
\end{table}

\end{document}

enter image description here

So, as You understand enumerate equations in table isn't nice idea but I would recomend You to look at this answer and make something like that)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.