我可以将表与某个标量值相乘吗?

我可以将表与某个标量值相乘吗?

我有一张表,我想将该表与某个标量值(比如 6)相乘,可以在 Latex 中做到这一点吗?

\documentclass
\usepackage{multirow}
\begin{table}[]
\begin{tabular}{ccccccccc}
\hline
\multirow{3}{*}{$\rho_{r}=\frac{\rho_{1}}{\rho}$} & \multicolumn{8}{c}{Symmetric non-dimensional frequencies}                                                                             \\ \cline{2-9} 
                                                  & \multicolumn{2}{c}{$\beta_{1}$} & \multicolumn{2}{c}{$\beta_{2}$} & \multicolumn{2}{c}{$\beta_{3}$} & \multicolumn{2}{c}{$\beta_{4}$} \\ \cline{2-9} 
                                                  & DROM           & FEM            & DROM           & FEM            & DROM           & FEM            & DROM           & FEM            \\ \hline
1                                                 & 1.213          & 1.212          & 2.208          & 2.201          & 3.141          & 3.123          & 3.602          & 3.569          \\ \hline
10                                                & 1.213          & 1.212          & 2.208          & 2.201          & 3.141          & 3.123          & 3.602          & 3.567          \\ \hline
1e2                                               & 1.213          & 1.213          & 2.208          & 2.208          & 3.141          & 3.123          & 3.602          & 3.249          \\ \hline
1e3                                               & 1.213          & 1.212          & 2.208          & 1.853          & 3.141          & 2.203          & 3.602          & 3.123          \\ \hline
\multirow{3}{*}{$\rho_{r}=\frac{\rho_{1}}{\rho}$} & \multicolumn{8}{c}{Anti-symmetric non-dimensional frequencies}                                                                        \\ \cline{2-9} 
                                                  & \multicolumn{2}{c}{$\beta_{1}$} & \multicolumn{2}{c}{$\beta_{1}$} & \multicolumn{2}{c}{$\beta_{1}$} & \multicolumn{2}{c}{$\beta_{1}$} \\ \cline{2-9} 
                                                  & DROM           & FEM            & DROM           & FEM            & DROM           & FEM            & DROM           & FEM            \\ \hline
1                                                 & 0.762          & 0.761          & 1.492          & 1.491          & 2.306          & 2.298          & 3.141          & 3.123          \\ \hline
10                                                & 0.634          & 0.633          & 1.304          & 1.302          & 2.232          & 2.225          & 3.141          & 3.123          \\ \hline
1e2                                               & 0.398          & 0.397          & 1.225          & 1.223          & 2.212          & 2.204          & 3.141          & 3.123          \\ \hline
1e3                                               & 0.226          & 0.226          & 1.215          & 1.215          & 2.209          & 2.203          & 3.141          & 2.623          \\ \hline
\end{tabular}
\end{table}

\结束{文档}

答案1

当然可以。使用collcell。只需安装一些解析器来解析和评估条目,我的选择是\pgfmathparse

\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{multirow}
\usepackage{collcell}
\usepackage{pgf}
\newcolumntype{E}{>{\collectcell\usermacro}c<{\endcollectcell}}
\newcommand\usermacro[1]{\pgfmathparse{6*#1}\pgfmathprintnumber\pgfmathresult}

\begin{document}
\begin{table}[htb]
\centering\pgfkeys{/pgf/number format/fixed,
          /pgf/number format/fixed zerofill,
          /pgf/number format/precision=3}
\begin{tabular}{cEEEEEEEE}
\hline
\multirow{3}{*}{$\rho_{r}=\frac{\rho_{1}}{\rho}$} & \multicolumn{8}{c}{Symmetric non-dimensional frequencies}                                                                             \\ \cline{2-9} 
                                                  & \multicolumn{2}{c}{$\beta_{1}$} & \multicolumn{2}{c}{$\beta_{2}$} & \multicolumn{2}{c}{$\beta_{3}$} & \multicolumn{2}{c}{$\beta_{4}$} \\ \cline{2-9} 
                                                  & \multicolumn{1}{c}{DROM}  & \multicolumn{1}{c}{FEM}            & \multicolumn{1}{c}{DROM}           & \multicolumn{1}{c}{FEM}            & \multicolumn{1}{c}{DROM}           & \multicolumn{1}{c}{FEM}            & \multicolumn{1}{c}{DROM}           & \multicolumn{1}{c}{FEM}            \\ \hline
1                                                 & 1.213          & 1.212          & 2.208          & 2.201          & 3.141          & 3.123          & 3.602          & 3.569          \\ \hline
10                                                & 1.213          & 1.212          & 2.208          & 2.201          & 3.141          & 3.123          & 3.602          & 3.567          \\ \hline
1e2                                               & 1.213          & 1.213          & 2.208          & 2.208          & 3.141          & 3.123          & 3.602          & 3.249          \\ \hline
1e3                                               & 1.213          & 1.212          & 2.208          & 1.853          & 3.141          & 2.203          & 3.602          & 3.123          \\ \hline
\multirow{3}{*}{$\rho_{r}=\frac{\rho_{1}}{\rho}$} & \multicolumn{8}{c}{Anti-symmetric non-dimensional frequencies}                                                                        \\ \cline{2-9} 
                                                  & \multicolumn{2}{c}{$\beta_{1}$} & \multicolumn{2}{c}{$\beta_{1}$} & \multicolumn{2}{c}{$\beta_{1}$} & \multicolumn{2}{c}{$\beta_{1}$} \\ \cline{2-9} 
                                                  & \multicolumn{1}{c}{DROM}  & \multicolumn{1}{c}{FEM}            & \multicolumn{1}{c}{DROM}           & \multicolumn{1}{c}{FEM}            & \multicolumn{1}{c}{DROM}           & \multicolumn{1}{c}{FEM}            & \multicolumn{1}{c}{DROM}           & \multicolumn{1}{c}{FEM}            \\ \hline
1                                                 & 0.762          & 0.761          & 1.492          & 1.491          & 2.306          & 2.298          & 3.141          & 3.123          \\ \hline
10                                                & 0.634          & 0.633          & 1.304          & 1.302          & 2.232          & 2.225          & 3.141          & 3.123          \\ \hline
1e2                                               & 0.398          & 0.397          & 1.225          & 1.223          & 2.212          & 2.204          & 3.141          & 3.123          \\ \hline
1e3                                               & 0.226          & 0.226          & 1.215          & 1.215          & 2.209          & 2.203          & 3.141          & 2.623          \\ \hline
\end{tabular}
\end{table}
\end{document}

在此处输入图片描述

相关内容