生成表但发生错误

生成表但发生错误

最有效的获取表格的方法是什么http://en.wikipedia.org/wiki/Electrical_resistivity_and_conductivity#Resistivity_of_various_materials融入 LaTeX 语法?

我尝试将其输入,但出现以下错误:

LaTeX Error: Command \texttimes unavailable in enco
ding OT1.
 ...                                              
l.84 Carbon (graphene) & 1×
                            10−8 \\ \hline

有问题的表具有以下语法:

%Fig xxxxx table of material resistivity
\begin{table}[h]
\centering
\begin{tabular}{|l|l|}
Material                        & $\rho \Omega  \dotsm$ m at 20 \si{\degreeCelsius}                                                    \\ \hline
Carbon (graphene) & 1×10−8 \\ \hline
Silver & 1.59×10−8 \\ \hline
Copper & 1.68×10−8 \\ \hline

答案1

使用booktabs包装生产出高质量的桌子和siunitx用于格式化单位并在单元格中产生对齐的包;一个小例子,为您提供了构建表格所需的信息:

\documentclass{article}
\usepackage{siunitx}
\usepackage{array}
\usepackage{booktabs}

\begin{document}

\begin{table}
\caption{material resistivity}
\label{tab:matres}
\begin{tabular}{>{\bfseries}lSSS}
\toprule
\multicolumn{1}{c}{\bfseries Material} 
  & \multicolumn{1}{c}{$\rho\, $\si{(\ohm$\cdot$\meter) at 20 \si{\degreeCelsius} }} 
  & \multicolumn{1}{c}{$\sigma\, $\si[per-mode=symbol]{(S\per\meter) at 20 \si{\degreeCelsius}}}
  & \multicolumn{1}{c}{\bfseries Temperature} \\
& & & \multicolumn{1}{c}{\bfseries coefficient} \\
& & & \multicolumn{1}{c}{{\si{K^{-1}}}} \\
\midrule
Silver & \num{1.59d-8} & \num{6.30d7} & \num{0.0038} \\
Carbon & \num{2.14d-7} & \num{8.24d6} & \num{0.0126} \\
Zinc & \num{1.26d-8} & \num{3.12d8} & \num{0.0672} \\
\bottomrule
\end{tabular}
\end{table}

\end{document}

在此处输入图片描述

答案2

这是一个使用的解决方案captionbooktabs, 和siunitx包装:

\documentclass{article}

\usepackage[
  tableposition = top
]{caption}
\usepackage{booktabs}
\usepackage{siunitx}

\newcommand*\mc[1]{\multicolumn{1}{c}{#1}}


\begin{document}

\begin{table}
\centering
\caption{Material resistivity.}
\label{tab:matres}
 \begin{tabular}{
   l
   S[table-format = 1.2e-1]
   S[table-format = 1.2e1]
   S[table-format = 1.4]
 }
  \toprule
    \mc{Material} 
  & {$\rho$   at \SI{20}{\celsius}}
  & {$\sigma$ at \SI{20}{\celsius}}
  & {Temperature} \\
  &
  &
  & {coefficient} \\
  \midrule
    \mc{---}
  & {\si[inter-unit-product = \ensuremath{{}\cdot{}}]{\ohm\m}}
  & {\si[per-mode = symbol]{\siemens\per\m}}
  & {\si{\per\K}} \\
  \midrule
    Silver & 1.59e-8 & 6.30e7 & 0.0038 \\
    Carbon & 2.14e-7 & 8.24e6 & 0.0126 \\
    Zinc   & 1.26e-8 & 3.12e8 & 0.0672 \\
  \bottomrule
\end{tabular}
\end{table}

\end{document}

输出

注意使用S[table-format = ...]来获得数字的正确垂直对齐。

相关内容