幺蛾子集锦:Latex 写期刊论文时的常见报错(持续更新)

《Latex 从入门到放弃》系列二

Posted by yxy on December 22, 2018

记录我投过的 Emrald、IEEE、ASME、Elsevier、Spring、SPIE 的 tex 写作过程中的报错问题,全部附有解决方案。

官方模板中 .eps 或 .ps 图片编译报错问题

SPIE 和 ASME 提供的模板中都有.ps格式图片,但是直接编译会产生报错:

原图片代码:

\begin{figure}
\centerline
\caption{Example taken from a paper that was held from production because the image quality is poor.  ASME sets figures captions in 8pt, Helvetica Bold.}
\label{fig_example1.ps}
\end{figure}

报错:

解决方案: 增加关于ps转pdf的宏包后,在figure路径前面增加\psfig

解决代码:

\usepackage{epsfig}
\usepackage{auto-pst-pdf}

\begin{figure}
\centerline{\psfig{figure=figure/FMANU_MD_05_1107_11.ps,width=3.34in}}
\caption{Example taken from a paper that was held from production because the image quality is poor.  ASME sets figures captions in 8pt, Helvetica Bold.}
\label{fig_example1.ps}
\end{figure}

编译bibtex报错的问题

.tex或.bbl引用期刊中带有 & 字符时会报警,如 “IEEE TRANS ON PATTERN ANALYSIS & MACHINE INTELLIGENCE”(TPAMI)、”COMPUTERS & GRAPHICS”(CG)。 需要在.bbl中把&手动改成 \&,报错解决。

公式对齐的问题

当需要做连续公式推导的时候,通常使用对齐功能,并且排版只显示一个公式编号,此时用 \begin{equation}\begin{aligned} 共同实现。如:

代码:

\begin{equation}
\begin{aligned}
\label{eq:warp3D}
\mathbf{x}_{\mathrm{c}\_i} & = W(\mathbf{x}_{\mathrm{t}\_i},\mathbf{p}_\mathrm{c}) \\
& = \mathcal{P}(\mathbf{X}_{t\_i},\mathbf{p}_0+\mathbf{p}_\mathrm{c}) \\
& = \mathbf{K}\mathbf{P}(\mathbf{p}_0)\mathbf{P}(\mathbf{p}_\mathrm{c})\mathbf{X}_{\mathrm{t}\_i}\\
& = \mathbf{K}\mathbf{P}_0\mathbf{P}_\mathrm{c}\mathbf{X}_{\mathrm{t}\_i}
\end{aligned}
\end{equation}

如果需要对每一步推导公式连续编号,应直接使用 \begin{align},效果和代码如下:

\begin{align}
\label{eq:warp3D}
\mathbf{x}_{\mathrm{c}\_i} & = W(\mathbf{x}_{\mathrm{t}\_i},\mathbf{p}_\mathrm{c}) \\
& = \mathcal{P}(\mathbf{X}_{t\_i},\mathbf{p}_0+\mathbf{p}_\mathrm{c}) \\
& = \mathbf{K}\mathbf{P}(\mathbf{p}_0)\mathbf{P}(\mathbf{p}_\mathrm{c})\mathbf{X}_{\mathrm{t}\_i}\\
& = \mathbf{K}\mathbf{P}_0\mathbf{P}_\mathrm{c}\mathbf{X}_{\mathrm{t}\_i}
\end{align}

Springer期刊投稿通讯作者、作者单位的问题

Springer模板中没有提供区分作者单位和通信作者的代码,参考最新的排版效果:

我自己写了一份,源码及使用宏包如下:

\usepackage[misc]{ifsym}

\author{XY Yin \textsuperscript{1}     \and
        Boss Fan  \textsuperscript{1,*} \and
        Xu Yang \textsuperscript{1}  \and
        Shiguang Qiu\textsuperscript{2}
}

\institute{
\Letter Boss Fan\\
\email{fan@sjtu.edu.cn}\\     
Tel.: +86-21-34206291\\     
\at
 {1} Institute of Intelligent Manufacturing and Information Engineering, Shanghai Jiao Tong University, Shanghai, 200240, China.
 \at
 {2} Chengdu Aircraft Industry (Group) Co. Ltd. of AVIC, Chengdu, 610092, China.\\
}

效果如下:

Latex 转 mathtype 公式的问题

大论文要求用 Word 写,简直是无力。不能写注释,不能自动排号,不能focus on content,不能实时编译出美观的 PDF,公式,伪代码。学校不能与时俱进一下吗?吐槽归吐槽,还是乖乖想办法吧。 折腾过 PandocAurora 之后发现转换的tex公式都是 Word2016 内置公式编辑器格式,显然通不过评审。只好重新折腾 mathtype 找办法。

解决方案如下: 打开 mathtype -> preferences -> Workspace preference 拉到底 -> √ Allow tex language entry from keyboard

之后就可以从latex 文件中愉快地 copy paste equations 啦:

双栏论文跨栏图像的排版方法

直接上代码,懒得画图了,谁用谁知道。用 * 实现

\begin{figure*}[ht] %\*实现跨栏的功能,表格同理。
\begin{center}
\begin{tabular}{c}
\includegraphics[width=16cm]{Graphicalabstract.jpg}
\end{tabular}
\end{center}
\end{figure*}

单栏图、表的固定方法

直接上代码,懒得画图了,谁用谁知道。用 [H] 实现。

%图固定
\begin{figure}[H] %用[H]实现
\begin{center}
\begin{tabular}{c}
\includegraphics[width=7cm]{fig.png}
\end{tabular}
\end{center}
\caption
{ \label{fig:figref}
Caption of the figure. }
\end{figure}

%表格固定
\begin{table}[H]
\caption{\label{tab:tablabel}Cation of the table.}
\centering    
\begin{tabular}{|l|l|}
\hline
\rule[-1ex]{0pt}{3.5ex}  Parameters & Meaning  \\
\hline
\rule[-1ex]{0pt}{3.5ex} $[x_0,y_0]$ & Center of the ellipse in ICS  \\
\hline
\rule[-1ex]{0pt}{3.5ex} $a$ & Major axis length of the ellipse in ICS \\
\hline
\rule[-1ex]{0pt}{3.5ex} $b$ & Minor axis length of the ellipse in ICS\\
\hline
\rule[-1ex]{0pt}{3.5ex} $\gamma$ & Rotation angle of the ellipse in ICS\\
\hline
\end{tabular}
\end{table}

双栏论文跨栏图片固定的方法

直接上代码,懒得画图了,谁用谁知道。跨栏不能用 [H],会报错,取而代之的用 [!htb] 将图片强制固定在当前页面。

\begin{figure*}[!htb]
\begin{center}
\begin{tabular}{c}
\includegraphics[width=16cm]{test.jpg}
\end{tabular}
\end{center}
\caption
{ \label{fig:overflow}
Method overview.}
\end{figure*}