LaTeX的学习笔记

输出矩阵

\documentclass[12pt]{aritcle}
\begin{document}
$
\left|
    \begin{array}{ccc}
    1 & 1 & 1 \\
    1 & 1 & 1 \\
    1 & 1 & 1 \\
    \end{array}
\right|
$
\end{document}

%如果输出其他表示形式的矩阵或者行列式,将|对应换成[]{}()即可

输出结果如图
矩阵

输出空格

% 第一种,使用"\"
\documentclass[12pt]{article}
\begin{document}
h\ e\ \ l\ \ \ l\ \ \ \ o!\\
\end{document}

% 推荐使用第二种,使用"\hspace"
\documentclass[12pt]{article}
\begin{document}
h\hspace{0.2cm}e\hspace{0.4cm}l\hspace{0.6cm}l\hspace{0.8cm}o!\\
\end{document}

% 也可以使用pt单位

% 在数学公式中,即$$内建议使用
\quad
\1em
\em
\m
% 代表当前字体下接近字符‘M’的宽度

输出结果如图
第一种方法
第二种方法

输出圈号一

# 由于常用CJK包,故直接使用'\textcircled'
\textcircled{1}

由于比较简单就不贴图了,值得一提的是在这里圈号一是不属于数学公式的,所以是不需要添加$$的

设置字体大小

\tiny
\scriptsize
\footnotesize
\small
\normalsize
\large
\Large
\LARGE
\huge
\Huge

对比结果如图
字体大小

输出中文字体

\documentclass[12pt]{article}
\usepackage{CJK} 
\begin{document}
\begin{CJK}{UTF8}{song}
% 宋体
\end{CJK}

\begin{CJK}{UTF8}{fs}
% 仿宋
\end{CJK}

\begin{CJK}{UTF8}{kai}
% 这是CTeX里的楷体!
\end{CJK}

\begin{CJK}{UTF8}{hei}
% 这是CTeX里的黑体!
\end{CJK}

\begin{CJK}{UTF8}{li}
% 这是CTeX里的隶书!
\end{CJK}

\begin{CJK}{UTF8}{you}
% 这是CTeX里的幼圆体!
\end{CJK}
\end{document}

%由于中文字体的缘故,运行起来会较慢

结果如图
结果

将Contents设置为中文

% \tableofcontents自动生成目录
% 在该命令行前插入这一行,则可将Contents替换
\renewcommand\contentsname{\textbf{目录}} 
\tableofcontents

自定义时间

# 在\begin{document}前加入\date{},大括号内自定义内容
\date{}
\begin{document}
\maketitle
...
\end{document}

输出表格

普通表格

\begin{table}
	# 此处c大小均可,表示居中,l和r分别表示居左居右。
	# 竖线表示是否有此列两边是否有竖线,建议读者自行尝试
	\begin{tabular}{|c|c|c|}
		# \hline表示横线
		\hline
		a & a & a \\
		\hline
		a & a & a \\
		\hline
		a & a & a \\
		\hline				
	\end{tabular}
\end{table}

跨行跨列的复杂表格

# 跨行必须应用此包,若只是跨列则不需要
\usepackage{multirow}
\begin{tabular}{|c|c|c|c|c|}
	\hline
	# 第一个数据为空
	# \multicolumn{跨的列数}{对齐方式}{内容}
	 & a & \multicolumn{3}{|c|}{a} \\
	\hline
	# \multirow{跨的行数}*{内容}
	\multirow{2}*{a} 
		# 注意保留空的单元格
		& a & \multicolumn{3}{|c|}{a} \\ 
		# 跨第二列到第五列的横线
		\cline{2-5}
		& a & \multicolumn{3}{|c|}{a}\\
	\hline
	\multirow{3}*{a} 
		& a & \multicolumn{3}{|c|}{a} \\
		\cline{2-5}
		& \multirow{2}*{a} & \multirow{2}*{a} 
			& a \\
			\cline{4-5}
			& & & a & a \\
	\hline
\end{tabular}

这里写图片描述

中文文档

\documentclass[UTF8]{ctexart}
\begin{document}
\end{document}

对应的也可以使用ctexbook、ctexrep

列表环境

\begin{itemize}
    \item itemize
    \item itemize
\end{itemize}

\begin{enumerate}
    \item enumerate
    \item enumerate
\end{enumerate}

\begin{description}
    \item description
    \item description
\end{description}

标题、作者、摘要、目录、参考文献

\begin{document}

% 标题、作者、时间
\title{title}
\author{author}
% date不写则默认当前时间,若为空则不显示
\date{date}
\maketitle

% 摘要
\begin{abstract}
abstract
\end{abstract}

% 自动添加目录
\tableofcontents

% 参考文献
\begin{thebibliography}{} % 第二个大括号表示填入数字的最大标号值
\end{thebibliography}
\bibitem[]{} % []表示标号,可不填,默认为1、2、3,{}表示标签,并不显示
\end{document}

% 添加代码
% 选择你要添加何种语言的代码
\lstset{language=xxx}
\lstset{breaklines}
\begin{document}
\begin{lstlisting}
xxxx
\end{lstlisting}
% 或者调用本地文件
\lstinputlisting{/xxx/xx}
% 若要自定义开始结束行号可在大括号前加入如[fistline=x1,lastline=x2]
\end{document}

常用宏包

% AMS数学公式
\usepackage{amsmath}
% 支持中文
\usepackage{CJK}
% 页边距
\usepackage{geometry}
% 页眉页脚
\usepackage{fancyhdr}
% 添加代码
\usepackage{listings}

中文对应字号大小


常用命令

\newcommand{\chuhao}{\fontsize{42pt}{\baselineskip}\selectfont}
\newcommand{\xiaochuhao}{\fontsize{36pt}{\baselineskip}\selectfont}
\newcommand{\yihao}{\fontsize{28pt}{\baselineskip}\selectfont}
\newcommand{\erhao}{\fontsize{21pt}{\baselineskip}\selectfont}
\newcommand{\xiaoerhao}{\fontsize{18pt}{\baselineskip}\selectfont}
\newcommand{\sanhao}{\fontsize{15.75pt}{\baselineskip}\selectfont}
\newcommand{\sihao}{\fontsize{14pt}{\baselineskip}\selectfont}
\newcommand{\xiaosihao}{\fontsize{12pt}{\baselineskip}\selectfont}
\newcommand{\wuhao}{\fontsize{10.5pt}{\baselineskip}\selectfont}
\newcommand{\xiaowuhao}{\fontsize{9pt}{\baselineskip}\selectfont}
\newcommand{\liuhao}{\fontsize{7.875pt}{\baselineskip}\selectfont}
\newcommand{\qihao}{\fontsize{5.25pt}{\baselineskip}\selectfont}
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值