栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

Latex入门简明教程

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Latex入门简明教程

Latex入门简明教程
  • 前言
  • 一、Latex和Word的优缺点对比
  • 二、Latex项目组成文件格式
  • 三、Latex插入图片
  • 四、Latex插入公式
  • 五、Latex插入参考文献
  • 六、Latex生成带目录PDF文档
  • 七、Latex的error整理
  • 总结


前言

使用对象:Latex入门初学者
博客内容概述:
Latex作为撰写论文的工具,深受广大科研工作者的喜爱,本文为个人的Latex入门总结,特此记录。


一、Latex和Word的优缺点对比


知乎高赞:LaTex 比 Word 好在哪?

二、Latex项目组成文件格式

以IEEE的Latex模板为例,进行介绍。IEEE的Latex的模板在网站http://ras.papercept.net/conferences/support/tex.php中可下载。其一为latex文档压缩包,其一为bibtex参考文献压缩包。

.tex文件,为论文正文文件;下面代码为latex的开头部分,关于设置论文格式,使用包,题目和感谢的内容。

documentclass[letterpaper, 10 pt, conference]{ieeeconf}  % Comment this line out if you need a4paper

%documentclass[a4paper, 10pt, conference]{ieeeconf}      % Use this line for a4 paper

IEEEoverridecommandlockouts                              % This command is only needed if 
                                                          % you want to use the thanks command

overrideIEEEmargins                                      % Needed to meet printer requirements.

usepackage[T1]{fontenc}                                  % LaTeX Error: Command DH unavailable in encoding OT1.

% The following packages can be found on http:\www.ctan.org
usepackage{graphicx} % for pdf, bitmapped graphics files
%usepackage{epsfig} % for postscript graphics files
%usepackage{mathptmx} % assumes new font selection scheme installed
%usepackage{times} % assumes new font selection scheme installed
usepackage{amsmath} % assumes amsmath package installed, for equation aligned
%usepackage{amssymb}  % assumes amsmath package installed
%setcounter{secnumdepth}{4} %subsubsection
usepackage{pdfcomment} % PDF document contents

title{LARGE bf
Paper Manipulation and Shoe Packaging Task with Soft Gripper
}

author{XXX$^{1}$% <-this % stops a space
thanks{*This work was not supported by any organization}% <-this % stops a space
%thanks{$^{2}$Bernard D. Researcheris with the Department of Electrical Engineering, Wright State University,
%        Dayton, OH 45435, USA
%        {ttsmall b.d.researcher@ieee.org}}%
}

begin{document}

.eps文件,为latex指定的图片插入格式;在导入图片之前,最好将图片先转换为.eps格式文件;

.bib文件,为参考文献的一种格式;在百度学术以及Google学术均可一键获取引用对应文献的bib格式代码。

.bst为参考文献的格式文件;

以上格式中内容还会在下文中介绍。


三、Latex插入图片

向LaTeX插入图片的时候,一直使用.jpg格式,编译出来效果很不好,稍微放大就显得很模糊。后来采用.eps(Encapsulated Post Script)格式的图片,因为是矢量图,即使放大也不会失真,效果很好,推荐使用。

jpg/png格式图片转eps格式的方法总结
http://blog.sina.com.cn/s/blog_5410e7b50101lme2.html

Overleaf——LaTeX插图命令使用教程
https://zhuanlan.zhihu.com/p/143529262

一般情况下我们很少会把图片直接插入到我们的文本当中,而是会使用浮动体的格式。浮动体的环境为figure,如下述代码所示。

begin{figure}[htbp]
  centering
  includegraphics[scale=0.3]{figs/1introduction.eps}
  caption{Inductance of oscillation winding on amorphous magnetic core versus DC bias magnetic field}
  label{introduction}
end{figure}
  • figure表示图片是浮动的;后面加*号表示打通排版;
  • htbp表示图片的排版是自动排版;h–here; t–top; b–bottom; p–page;
  • centering表示居中显示 ;
  • scale设置缩放比例;其后为指定的文件路径;
  • caption为图注;
  • label为自定义的标签,用于在正文中引用的时候使用;

在正文中引用图片的编号方式为如下,此处的introduction即为自定义的标签。

Fig. ref{introduction} shows a scene wherein shoes are being packaged. 

Latex自带画图宏包。
科研画图都用什么软件?
https://www.zhihu.com/question/29557377/answer/99175627
LaTeX—Tikz 宏包入门使用教程
https://zhuanlan.zhihu.com/p/127155579
http://pgfplots.sourceforge.net/gallery.html

四、Latex插入公式

插入公式包括行内公式和行间公式

行内公式的插入:

$F_f leq F_N mu_1$

中文显示为: F f ≤ F N μ 1 F_f leq F_N mu_1 Ff​≤FN​μ1​

行间公式的插入:

begin{equation}label{eq4}
    F_f + F_{in} = F_{tau}
end{equation}

正文显示为:
F f + F i n = F τ F_f + F_{in} = F_{tau} Ff​+Fin​=Fτ​

五、Latex插入参考文献

在插入参考文献之前,首先要将所要引用的参考文献.bib引用格式代码复制到.bib文件中,如下述代码所示为一篇文献的.bib引用格式代码,其中第一行大括号后面的“yin2021modeling”表示这篇文献的标签,便于后面在正文中引用这篇文献。

@article{yin2021modeling,
  title={Modeling, learning, perception, and control methods for deformable object manipulation},
  author={Yin, Hang and Varava, Anastasia and Kragic, Danica},
  journal={Science Robotics},
  volume={6},
  number={54},
  year={2021},
  publisher={Science Robotics}
}

在Latex

bibliographystyle{./IEEEtran} % use IEEEtran.bst style
bibliography{./IEEEabrv,./IEEEexample}

end{document}

在正文中引用参考文献的方式如下,yin2021modeling为要引用的参考文献的标签。

cite{yin2021modeling}
六、Latex生成带目录PDF文档

这里只给出一种方法,在正文开始之前加上如下代码片段:

usepackage{pdfcomment} % PDF document contents
七、Latex的error整理

error1:
[Latex] Command DH unavailable in encoding OT1
https://www.jianshu.com/p/7832e477ce09
前文部分添加usepackage[T1]{fontenc}

error2:
Latex “Paragraph ended before Gin@iii was complete” — solution
It hapens when simply inserting a figure. Solution is to change the package from {graphics} to {graphicx}.

总结

以上就是今天要讲的内容,本文仅仅简单介绍了latex的使用,而更多的关于latex的使用方法在写作时,边学边用,效率更高。

暑期编程PK赛 得CSDN机械键盘等精美礼品!
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/1016222.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号