\begin{table}
\centering
\caption{Cluster head selection}
\label{tab:algofirefly}
\vspace{.1 in} \hrule \vspace {.1 in}
Pseudo code forcluster head selection based on the firefly is as follows:
\vspace {.1 in} \hrule \vspace {.1 in}
\begin{itemize}
\item Initialization
\item Set of sensor nodes $ \{n_1,n_2,n_3.........]\}$ is the input
\item Each node calculate $E_{Res}^{(i)}, PL^{(i)}, dist(i,j), N_D^{(i)}
\item All the nodes calculate the fitness function using the equation (\ref{eq:47})
答案1
在环境等内部创建方程式的交叉引用并没有什么特别之处table
。如果您的文档中有一个带有 的方程式\label{eq:whatever}
,则(\ref{eq:whatever})
和\eqref{eq:whatever}
(假设您已加载amsmath
包)都可以正常工作。
\documentclass{article}
\usepackage{tabularx,booktabs,enumitem,amsmath}
\DeclareMathOperator{\dist}{dist}
\begin{document}
\setcounter{equation}{46} % just for this example
\begin{equation} \label{eq:pyth}
a^2+b^2=c^2
\end{equation}
\begin{table}[h]
\caption{Cluster head selection\strut}
\label{tab:algofirefly}
\begin{tabularx}{\textwidth}{@{} X @{}}
\toprule
Pseudo code for cluster head selection based on the firefly is as follows:\\
\midrule
\begin{minipage}{\textwidth}
\begin{itemize}[left=0pt]
\item Initialization
\item Set of sensor nodes $ \{n_1,n_2,n_3,\dots\}$ is the input.
\item Each node calculates $E_{\mathrm{Res}}^{(i)}$, $\mathit{PL}^{(i)}$, $\dist(i,j)$, and $N_{\!D}^{(i)}$.
\item All nodes calculate the fitness function using equation \eqref{eq:pyth}.
\end{itemize}
\end{minipage} \\
\bottomrule
\end{tabularx}
\end{table}
\end{document}