Latex中出现的问题及解决方案

本篇不会讲基本操作等等,只是记录本人在使用latex中出现的一些问题等。

一、基本代码

1、首行空两格

1. 手动空两格

  优点:万无一失;缺点:手动真的很麻烦。

	\hspace{1.7em}

2. 使用宏包控制

  导言中加入package,然后seting就可以直接使用了。

	 \usepackage{indentfirst}
	 \setlength{\parindent}{2em} %2em这里可以更改宽度,mcm模板默认就是1.7em

3. 取消首行缩进

	\noindent	

2、插入图片

1. 插图

	\begin{figure}[htbp]
		\begin{center}
			\includegraphics[width=0.6\textwidth]{5-3-1(2)}
		\end{center}
		\caption{Change of MSE value as the number of items increases}
	\end{figure}
  • htbp:我这里设置是为了让Caption根据章节自动编号
  • width:可以调整图片宽度,我这里是让它根据一行text的距离自行缩放
  • center:居中对齐

2. 调整latex图与caption之间的距离

	\begin{figure}\centering\caption{Caption Above Graphic}
	\includegraphics[width=2in]{graphic.eps}
	\end{figure}

  生成的图中标题和图形非常接近。
  标题上下方的间距由长度\abovecaptionskip 和\belowcaptionskip (缺省分别为10pt 与零)。可以用标准的LATEX 命令\setlength 和\addtolength来修改这些长度。例如:

	\begin{figure}
	\setlength{\abovecaptionskip}{0pt}
	\setlength{\belowcaptionskip}{10pt}\centering\caption{Caption Above Graphic}
	\includegraphics[width=2in]{graphic.eps}
	\end{figure}

  得到图。其中标题的上方没有额外的空白,与图形之间则有10pt 的距离。
如果一个文档的所有浮动对象的标题都位于该对象的上方,那么可将命令

	\setlength{\abovecaptionskip}{0pt}
	\setlength{\belowcaptionskip}{10pt}

放到导言区里,从而对整个文档都起作用。

3、序号序列

1.枚举类型enumerate

  {enumerate}产生带需要的编号,默认是采用数字1,2,3……进行排列。如果你想用其他排列方式例如(1),(2)…的话需要先加载\usepackage{enumerate},然后再使用。分别输入如下代码使用默认和自定义的编号方式进行编号;编译输出后可以看到默认的使用1,2,3等数字进行编号,而使用(1)的依次使用(1),(2),(3)进行编号。

	\begin{enumerate}[i)]
	\item a
	\item b
	\end{enumerate}
	 
	 
	\begin{enumerate}[1)]
	\item a
	\item b
	\end{enumerate}
	 
	 
	可以发现,编号方式改变一下参数格式即可。
	 
	 
	\begin{description}
	\item[item a] a
	\item[item b] b
	\end{description}

2. 枚举类型itemize

  {itemize}命令对文本进行简单的排列,不是采用序号,而是实心圆点符号。这个命令需要和\item配合使用。作为演示,输入如下代码;编译后可以看出在每一段前都加上了实心圆点符号进行排列。
  如果我们不想使用实心圆点符号进行排列的话可以在\item[]的中括号里面指定需要的编号符号。例如我们使用-进行编号,改变代码如下;编译输出后可以看到编号的符号被换成来“-”。当然我们也可以采用其他的符号进行编号效果如下:

	\begin{itemize}
	\item[*] a
	\item[*] b
	\end{itemize}

3. 使用enumitem包对枚举类型enumerate进行缩进

	\documentclass[12pt]{article}
	\usepackage{enumitem} 
	 
	\begin{document}
	ZERO
	\begin{enumerate}[itemindent=1em] 
		\item One
		\begin{enumerate}
				\item Two
				\item Three
				\item Four
		\end{enumerate}
		\item Five
		\item Six
	\end{enumerate}
	\end{document}

  实现效果如:
在这里插入图片描述

4、参考文献

\addcontentsline{toc}{section}{Reference}
\begin{thebibliography}{99}
\bibitem{1} Li Zhe. Monte Carlo simulation of characteristic X-rays in EDXRF and universal peak Gaussian broadening technology. Chengdu University of Technology.2012
\bibitem{2} Zhang Qingguo. The physical mechanism of spectral line broadening and its half-height width. Journal of Henan University of Science and Technology.2008
\bibitem{3}chencas.catboostprinciple[DB/OL].\url{https://blog.csdn.net/chencas/java/article/details/104418476}
\end{thebibliography}

5、latex目录

1. 插入目录不识别的section

latex中的距离

在这里插入图片描述

二、报错以及处理

三、宏包问题

  • 4
    点赞
  • 38
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值