天天看點

Latex 撰寫論文錯誤及解決方法記錄

author year 問題

報錯資訊

Package natbib: Bibliography not compatible with author-year citations.
(natbib)	Press <return> to continue in numerical citation style.
           

解決方法

将 authoryear 選項去掉。

\documentclass[times,twocolumn,authoryear,final]{elsarticle}%錯誤
           
\documentclass[times,twocolumn,final]{elsarticle}%正确
           

hyperref 問題

報錯資訊

Token not allowed in a PDF string (PDFDocEncoding):
(hyperref)	removing `\<def>-command'.
           

解決方法

\usepackage[colorlinks]{hyperref}
           

在引入包之後添加如下代碼。

\pdfstringdefDisableCommands{
  \def\corref#1{<#1>}
}
           

BibTex 引用問題

在使用 BibTex 引用時,若使用從 arXiv 網站導出的 BibTex 出現錯誤,

@misc{ledig2017photorealistic,
      title={Photo-Realistic Single Image Super-Resolution Using a Generative Adversarial Network},
      author={Christian Ledig and Lucas Theis and Ferenc Huszar and Jose Caballero and Andrew Cunningham and Alejandro Acosta and Andrew Aitken and Alykhan Tejani and Johannes Totz and Zehan Wang and Wenzhe Shi},
      year={2017},
      eprint={1609.04802},
      archivePrefix={arXiv},
      primaryClass={cs.CV}
}
           

則可以考慮統一換成谷歌學術上的 BibTex 代碼。

@inproceedings{ledig2017photo,
  title={Photo-realistic single image super-resolution using a generative adversarial network},
  author={Ledig, Christian and Theis, Lucas and Husz{\'a}r, Ferenc and Caballero, Jose and Cunningham, Andrew and Acosta, Alejandro and Aitken, Andrew and Tejani, Alykhan and Totz, Johannes and Wang, Zehan and others},
  booktitle={Proceedings of the IEEE conference on computer vision and pattern recognition},
  pages={4681--4690},
  year={2017}
}
           

圖檔與表格 label 放置問題

圖檔

将\label{}放入\caption{}中。

\begin{figure}[htb]
  \centering
  \caption{\label{fig1}Results of ablation study}
\end{figure}latex
           

表格

将\label{}放在\end{table}之前。

\begin{table}[htb]
  \centering
  \caption{Results of Ablation Study}
  \begin{tabular}{@{}lc|cccc@{}}
  \end{tabular}
  \label{table1}
\end{table}
           

字型問題

在使用

\setCJKmainfont{}
\setCJKmonofont{}
           

等指令進行設定的時候,選擇字型時采用的名字 Win10 和 Linux 是不同。另外,如果一個模闆在 Linux 下開發的,拿到 Win10 來用可能會出現奇奇怪怪的問題,這是直接隻用指令行編譯有奇效。

比如直接用

xelatex resume-zh.tex
           

碰到報錯就直接Enter鍵跳過。