报错 Missing number, treated as zero. 和 Undefined control sequence.

按照elsevier模板写的,表格总是报错,求教应该如何修改。

\documentclass[review]{elsarticle}


\usepackage{lineno,hyperref}

\modulolinenumbers[5]

\usepackage{amssymb}

\usepackage{graphicx}


\journal{Journal of \LaTeX\ Templates}


\bibliographystyle{elsarticle-num}


\begin{document}




\begin{table*}

\caption{Key input variables and DCF main values of Scheme 1}

\begin{tabular*}{\tblwidth}{@{} lll@{} }


\toprule

Variables         &  Values          &  Definition/resource\\


\midrule

CapEx-MGO &  0                  &  Initial investment using MGO\\ 

Price-MGO &  \$570/ton    & Using the average price of MGO (Singapore)\\

Usage-MGO & 40 000 tons  & MGO annual usage\\

Discount rate &11\%              & Weighted average cost of capital(WACC) is the company's weighted cost of capital, including all sources of capital: equity and debt. It represents the discount rate of estimated cash flows (Block, 2011; Bennouna et al., 2010).

\bottomrule


\end{tabular*}


\end{table*}

\end{document}

3 回答3

1
仔细看模板说明,有没有必须设置却没有设置的变量。 `missing number`, 一般是需要一个数字的地方却没有设置数字。 `Undefined control sequence` 通常是拼写错误,或没有加载宏包而使用了宏包中的命令。 ```tex \documentclass[review]{elsarticle} \usepackage{lineno,hyperref} \usepackage{booktabs}  % 非要用\toprule \bottomrule \midrule,就得加这个宏包,否则用\hline 或者自定义这几个命令。 \usepackage{tabularx} % 换一种表格环境 \modulolinenumbers[5] \usepackage{amssymb} \usepackage{graphicx} \journal{Journal of \LaTeX\ Templates} \bibliographystyle{elsarticle-num} \begin{document} \begin{table*} \caption{Key input variables and DCF main values of Scheme 1} %\begin{tabular*}{\tblwidth}{@{} lll@{} } \tblwidth 没有定义,要么自己定义个长度,要么用其他预定义长度。 %\begin{tabular*}{\textwidth}{@{} lll@{} }  这样写是可以的,不过最后一行第三列太长,不建议用这个环境 \begin{tabularx}{\textwidth}{@{} llX@{}}  %当然导言区要加载 tabularx 宏包 \toprule Variables         &  Values          &  Definition/resource\\ \midrule CapEx-MGO &  0                  &  Initial investment using MGO\\  Price-MGO &  \$570/ton    & Using the average price of MGO (Singapore)\\ Usage-MGO & 40 000 tons  & MGO annual usage\\ Discount rate &11\%              &  Weighted average cost of capital(WACC) is the company's weighted cost of capital, including all sources of capital: equity and debt. It represents the discount rate of estimated cash flows (Block, 2011; Bennouna et al., 2010).\\ %最后一行缺了换行。 \bottomrule \end{tabularx} %\end{tabular*} 对应注释掉 \end{table*} \end{document} ```
  • 非常感谢! – yueyue yue 2019-08-22 15:04 回复
7
代码细节问题很多,比如缺少 booktabs,比如 参数里的宽度 是一个不知道什么东西,改成这样: ```tex \documentclass[review]{elsarticle} \usepackage{booktabs} \usepackage{lineno,hyperref} \modulolinenumbers[5] \usepackage{amssymb} \usepackage{graphicx} \journal{Journal of \LaTeX\ Templates} \bibliographystyle{elsarticle-num} \begin{document} \begin{table} \caption{Key input variables and DCF main values of Scheme 1} \begin{tabular}{\textwidth}{@{} lll@{} } \toprule Variables & Values & Definition/resource\ \midrule CapEx-MGO & 0 & Initial investment using MGO\ Price-MGO & \$570/ton & Using the average price of MGO (Singapore)\ Usage-MGO & 40 000 tons & MGO annual usage\ Discount rate &11\% & Weighted average cost of capital(WACC) is the company’s weighted cost of capital, including all sources of capital: equity and debt. It represents the discount rate of estimated cash flows (Block, 2011; Bennouna et al., 2010).\ \bottomrule \end{tabular} \end{table} \end{document} ``` 作者追问:2019-08-22 15:04 谢谢,按照你给出的方案,问题已经解决了。还有一个问题想要请教。表格的溢出问题要如何解决? ```tex \documentclass[review]{elsarticle} \usepackage{lineno,hyperref} \usepackage{booktabs} \usepackage{tabularx} \modulolinenumbers[5] \usepackage{amssymb} \usepackage{graphicx} \journal{Journal of \LaTeX\ Templates} \bibliographystyle{elsarticle-num} \begin{document} \begin{table} \caption{Key input variables and DCF main values of Scheme 1} \begin{tabular}{\textwidth}{@{} lllllllllllllllll@{}} \toprule \ &Year0 &Year1 &Year2 &Year3 &Year4 &Year5 &Year6 &Year7 &Year8 &Year9 &Year10 &Year11 &Year12 &Year13 &Year14 &Year15\ \midrule CapEx &-6.26 &- &- &- &- &- &- &- &- &- &- &- &- &- &- &- \ Spread-saving &- &7.16 &5.94 &4.77 &3.67 &2.62 &2.42 &2.22 &2.03 &1.83 &1.64 &1.45 &1.26 &1.08 &0.89 &0.71 \ Discount-spread &- &0.55 &0.52 &0.48 &0.44 &0.41 &0.37 &0.33 &0.29 &0.26 &0.22 &0.18 &0.15 &0.11 &0.07 &0.04 \ Total &-6.26 &7.71 &6.45 &5.25 &4.11 &3.02 &2.79 &2.55 &2.32 &2.09 &1.86 &1.64 &1.41 &1.19 &0.97 &0.75 \ \bottomrule \end{tabular} \end{table} \end{document} ```

作者追问:2019-08-22 15:04

谢谢,按照你给出的方案,问题已经解决了。还有一个问题想要请教。表格的溢出问题要如何解决?


\documentclass[review]{elsarticle}

\usepackage{lineno,hyperref}


\usepackage{booktabs} 


\usepackage{tabularx} 


\modulolinenumbers[5]

\usepackage{amssymb}

\usepackage{graphicx}

\journal{Journal of \LaTeX\ Templates}

\bibliographystyle{elsarticle-num}


\begin{document}


\begin{table*}

\caption{Key input variables and DCF main values of Scheme 1}

\begin{tabular*}{\textwidth}{@{}  lllllllllllllllll@{}}

\toprule

\  &Year0 &Year1 &Year2   &Year3   &Year4   &Year5  &Year6  &Year7   &Year8   &Year9   &Year10 &Year11  &Year12  &Year13  &Year14 &Year15\\

\midrule

CapEx         &-6.26 &- &- &- &- &- &- &- &- &- &- &- &- &- &- &-  \\

Spread-saving &\- &7.16  &5.94  &4.77 &3.67  &2.62 &2.42 &2.22 &2.03 &1.83  &1.64 &1.45 &1.26 &1.08  &0.89  &0.71 \\

Discount-spread &\- &0.55      &0.52 &0.48  &0.44 &0.41 &0.37 &0.33  &0.29 &0.26  &0.22  &0.18 &0.15 &0.11 &0.07 &0.04 \\

Total    &-6.26 &7.71 &6.45 &5.25 &4.11 &3.02  &2.79 &2.55 &2.32 &2.09  &1.86 &1.64 &1.41 &1.19 &0.97   &0.75  \\

\bottomrule

\end{tabular*}


\end{table*}

\end{document}


  • 非常感谢,不过按照这个方法,最后一行字太长,会溢出表格。 – yueyue yue 2019-08-22 15:06 回复
0
<pre class="brush:plain;toolbar:false">\tblwidth</pre><p>是什么</p>

你的回答

请登录后回答

你的回答将会帮助更多人,请务必认真回答问题。