LaTex排版一二三

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u011335616/article/details/50759915


引言

本科毕设论文排版使用的微软Office的Word,当时最为繁琐的就是插入参考文献了,后来用了Endnote软件,体验了一把快感。可是Word排版出来的论文并不是那么美观,比如英文单词间空白距离不一致,公式行间距等等。

也不知怎么就认识到了LaTex,说是世界上优秀科学家与艺术家的结晶,就想着一定要学会,绝不能半途而废。可是当我们开始用的时候才会发现一大堆问题,有事甚至无从下手。

本文重在讲述思想方法与实践

LaTex环境配置

软件包选择与安装

LaTex或TeX排版软件

LaTeX在Windows、Linux、Mac OS上都有发行版:

操作系统 软件发行版 编辑器
Windows MikTeXTexLive TeXnicCenter、WinEdt、Sublime Text
Unix/Linux MikTeXTexLive Emacs、vim、Kile、Sublime Text
Mac OS MikTeXTexLiveMacTeX TeXShop、Sublime Text

建议选择TEXLive,安装较为方便,就是安装包大了点,镜像包约2.9G。

MikTex源码及其Windows安装版可以在这里下载,如果想自己编译安装(比较麻烦),Windows系统请参考官方文档Building MiKTeX (Windows) ,Unix系统参考官方文档Building MiKTeX (GNU/Linux)

安装

MikTex在Windows上的安装很简单,这里就不再介绍,仅简要介绍Linux下TeXLive的安装,也很简单。

根据安装包给出的安装指南中所述,有文本模式,专家GUI模式等等,本人选择GUI模式,需要安装perl-tk:

sudo apt-get install perl-tk

perl的TK安装很快,之后解压你下载的TeXLive.iso镜像,进入TeXLive根目录,然后输入如下命令执行安装

cd texlive
perl install-tl -gui

在弹出的对话框中,根据自己需要设置,主要设置安装目录即可:
TeXLive安装界面

点击安装TeXLive,等待安装结束即可,Sublime Text3下LaTex环境配置见本人[博客]。

编辑器

编辑器的选择,任何一款文本编辑器即可,但本人偏向Sublime Text,因为其跨平台、几乎你需要的功能都有,一切可修改(快捷键、插件包etc.);界面优美;免费;可惜的是不开源。在上面配置LaTex环境也是很舒服和容易的,具体见超级文本编辑器Sublime Text3

注: 有关Sublime Text3下LaTex环境配置见本人博客

LaTex排版基础

参考文献

Inventors have long dreamed of creating machines that think. Ancient Greek myths tell of intelligent objects, such as animated statues of human beings and tables that arrive full of food and drink when called. When programmable computers were first conceived, people wondered whether they might become intelligent, over a hundred years before one was built \cite{lovelace3sketch}. % 这里使用\cite{}引用

\begin{thebibliography}{}
\bibliographystyle{ieeetr}

\bibitem{lovelace3sketch}
A.~Lovelace, ``Sketch of the analytical engine invented by charles babbage, by
  lf menabrea, officer of the military engineers, with notes upon the memoir by
  the translator,'' {\em Taylor’s Scientific Memoirs}, vol.~3, pp.~666--731.

\end{thebibliography}

\end{document}

需要注意的一些问题

Something’s wrong–perhaps a missing \item.

这很可能是你将参考文献放在了一个bib文件中,而在正文中你是这样写的:

\begin{thebibliography}{}
\bibliographystyle{ieeetr}
\bibliography{DeepLearning_zh_me}

\end{thebibliography}

因为tex文件中的\begin{thebibliography}{} ... \end{thebibliography}与bbl中的重复,所以只需将tex中代码改成这样即可:

\bibliographystyle{ieeetr}
\bibliography{DeepLearning_zh_me}

插入eps图片

Latex仅支持eps格式的图片,pdflatex支持jpg、png等格式的图片,可以像下面这样,使得这几种图片格式都支持,文件名中不加后缀,可以自动判断,很方便使用:

\documentclass[UTF8,10pt,oneside]{ctexbook}
% 导言区
\usepackage{graphicx}
\usepackage{epstopdf}

\begin{document}

\begin{figure}
\centering
\includegraphics[width=0.9\textwidth]{./figs/fig1-1}
\caption{不同表示方法的例子}
\label{fig1.1}
\end{figure}

\end{document}

脚注

footmisc宏包可以设置每页脚注重头开始编号,显示位置等等,结合hyperref宏包使用,还能生成超链接,可是却发现,现引用hyperref再引用footmisc,超链接会失效,只能下面这样放:

% ----------------------------------------------------
% for misc footnote 放在 hyperref 后,超链接竟然会失效!!!
\usepackage[perpage,stable,bottom]{footmisc}

% ----------------------------------------------------
% generates Contents with Hyperlink
\usepackage[colorlinks,linkcolor=red,anchorcolor=blue,citecolor=green]{hyperref}
% “colorlinks”的意思是将超链接以颜色来标识,而并非使用默认的方框来标识。
% linkcolor, anchorcolor, citecolor分别表示用来标识link, anchor, cite等各种链接的颜色。
% 若正式的文档中不想使用彩色的标识,但又希望具有超链接的功能,则将上例中的各种颜色换成“black”即可。

特殊符号

MathJax 支持的 Latex 符号总结

猜你喜欢

转载自blog.csdn.net/u011335616/article/details/50759915