Latex常用指令

本文介绍了在LaTeX中进行文档编辑的一些常用快捷键和命令,包括注释、换页、换行、缩进管理、图片插入及调整、代码块展示、无序和有序列表创建、三线表制作、数学公式输入以及文献引用的方法。提供了详细的LaTeX命令示例,便于快速参考和使用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

ctrl+T:注释快捷键

ctrl+U:取消注释

%:注释

如果要添加%,如99.2%可以用99.2\%,\可以取消%的作用

1. 换页: \newpage

2. 换行: 用回车键空两格,或者、\par

3. 添加缩进:\indent

4. 取消缩进:\noindent

5. 添加图片,centering:居中对齐,width=150控制图片大小(可以根据实际需要更改),imgname就是图片的名字(不需要名字后缀(如ios.png直接填ios),但是需要把图片放到tex文件同目录下,caption是设置图片名字,label是给图片加标签方便引用,示范的代码引用方式为 \ref{imgs} )

如果要一次性添加两/多个图片,

就直接加一行 \includegraphics[width=150mm]{imgName2} 

 \includegraphics[width=150mm]{imgName3}.........

	\begin{figure}[!htb]\centering
	\includegraphics[width=150mm]{imgName} 
	\caption{img}
	\label{imgs}
	\end{figure}

6. 添加代码code

%添加code,language根据实际语言可以更改JAVA,Python........

%引用
\ref{name of Python code}

\begin{lstlisting}[language=C, caption=Your caption for this Python, label= name of Python code] 

			public static void main(String[] args) 
			{
				 
				System.out.println("Hello World !");
				while ((ch = fr.read()) != -1) { //read characters
					System.out.print((char)ch);
				}
				fr.close(); 
			}
	
\end{lstlisting}

7. 添加列表

% 无数字编号列表	
\begin{itemize}
		\item This is a list without numbering.
		\item This is a list without numbering.
	\end{itemize}

% 有数字编号列表
	The following is an example of using \textbf{enumerate} environment:
	\begin{enumerate}%[1.]
		\item This is a list with numbering.
		\item This is a list with numbering.
	\end{enumerate}

8. 添加三线表

	\begin{table}[!htb]\centering
		\caption{Caption of Tables Should Be Above the Table} 	
		\label{tabIDyouNameIt}
		\setlength{\tabcolsep}{1ex}% 列间距加宽
		\begin{tabular}{p{0.3\textwidth}p{0.2\textwidth} p{0.4\textwidth}} % p{width} 控制列宽
			\toprule
			 Donec	& Etiam  	& Etiam suscipi    \\ 
			\midrule		
			 Maec 	& Maece     & Donec vel pede   \\ 
			 Maec 	& column    & Maecenas non     \\ 
			\bottomrule
		\end{tabular}
	\end{table}

9. 添加公式,推荐使用mathpix软件,可以截图识别公式转换为latex格式

% 段落内数学式,放在 $...$ 之间
The following are examples of in-line mathematical expressions:

$\alpha \leq \beta$ in-line math $a_i \times b_{min} = c^{567}$ in-line math $70 \sim 80Hz$

% 段落之间的公式
The following is an example of using \textbf{equation} environment:

Refer to the equation: Equation~\ref{eqID}
\begin{equation}\label{eqID}
H(Y|X) = \sum_{i=1}^s \sum_{j=1}^t P(x_i, y_j) \log_2 \Big(\frac{1}{ P(y_j|x_i) } \Big) 
\end{equation}

 

\begin{equation}
	\begin{aligned}\label{eqIDanother}
	H(Y|X) =& \sum_{i=1}^s P(x_i) H(Y|x_i) \\
	=& \sum_{i=1}^s \sum_{j=1}^t P(x_i) P(y_j|x_i)  \log_2 \Big(\frac{1}{ P(y_j|x_i) } \Big) 
	\end{aligned}
\end{equation}

 

10. 添加文献

引用方式:\cite{surnameyear}

需要添加bib文件,可以到论文发表网址直接复制代码,然后添加到bib文件中。不过不是所有的网址都可以复制,部分是直接下载bib文件。

注意:论文引用作者名字相同的时候第二次引用时候名字会被破折号——代替

有两个方法解决:

1. 打开IEEEtran.bst文件,
修改 FUNCTION {default.is.dash.repeated.names} { #1 }
为 FUNCTION {default.is.dash.repeated.names} { #0 }
也就是把1改成0
2. 在第二次添加的时候,给作者名字多加{},但是这种方法在引用的时候不会再把作者名字缩写了

 @ARTICLE{one,
   	author={Xiao, ming},
    }

 @ARTICLE{two,
   	author={{Xiao, ming}},
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值