Ctex入门指南笔记 -列表、表格、公式与图片

Ctex入门指南笔记

列表、表格、公式与图片

觉得有用的话,欢迎一起讨论相互学习~


我的微博我的github我的B站

列表

  • 可以使用可嵌套的列表项目itemize
documentclass{article}

egin{document}
egin{itemize}
item 项目1
egin{itemize}
item 项目1.1

item 项目1.2
item 项目1.3
end{itemize}
item 项目2
item 项目3
end{itemize}
end{document}

  • 可以使用可嵌套的列表项目enumerate
egin{enumerate}
item 项目1
egin{enumerate}
item 项目1.1

item 项目1.2
item 项目1.3
end{enumerate}
item 项目2
item 项目3
end{enumerate}

  • 也可以更改enumerate中的数字符号样式.
  1. 导入宏包
  2. 更改enumerate样式

egin{enumerate}[A.]
item 项目1
egin{enumerate}[a.]
item 项目1.1

item 项目1.2
item 项目1.3
end{enumerate}
item 项目2
item 项目3
end{enumerate}


egin{enumerate}[fseries A.]%加粗
item 项目1
egin{enumerate}[fseries a.]
item 项目1.1

item 项目1.2
item 项目1.3
end{enumerate}
item 项目2
item 项目3
end{enumerate}

表格

  • tabular {clr} 分别代表居中对齐,左对齐,右对齐
egin{tabular}{c|c|c}%表示三列都是居中对齐,并且中间用竖线分开
hline % 表示两行中分隔的横线
1&1&1\
hline
2&2&2\
hline
end{tabular}

  • 注意:在excel中表格间的列按照tab进行分离,但是对于Latex中,使用&,进行分割,则可以将其复制到记事本中将所有Tab字符替换成&字符即可

  • Table

    • centering 使所有表格居中
    • caption{} 用于表下方标题
    • label 用于超链接
egin{table}
centering
egin{tabular}{c|c|c}%表示三列都是居中对齐,并且中间用竖线分开
hline % 表示两行中分隔的横线
1&1&1\
hline
2&2&2\
hline
end{tabular}
caption{this is 呵呵}
end{table}

中英文混排

  • 注意:这其中使用了中英文混排,对于中英文混排在Ctex中我的建议是:
  1. 不使用原版的Latex,而是使用XeLaTeX进行编译,并且点击右侧的PDF按钮进行预览。
  2. 不是使用{article}而是使用documentclass[UTF8]{ctexart}的方式。
  3. 网络上也有种说法是不需要执行以上操作而是依次点击:Documents > Documents settings > Format > UTF-8

公式

  • 行内公式 $$
  • 行间公式 $$$$
  • 使用equation--这一种带公式编号
egin{equation}
 x^{2}_1 
end{equation} 

  • 可以使用boxed对公式进行加框的操作
  • 即在公式中添加boxed{}

egin{equation}
oxed{x^{2}_1}
end{equation}

  • 对于公式的括号有时候会发现包不住公式,比如
$$lim_{n	oinfty} (1+frac{1}{n})^n=e$$

  • 这时候可以使用left和 ight包住括号,即将left放到左括号前而 ight放到右括号前
$$lim_{n	oinfty} left(1+frac{1}{n}
ight)^n=e$$

  • 这样就整的挺好,括号能完全包裹住公式就很完美

数组

  • 数组公式和表格类似,也能够控制列的对齐方式,通过crl这种对齐格式
$$egin{array}{ccc}
11& 22 &33\
44&55&66\
77&88&99
end{array}$$

egin{equation}
egin{array}{ccc}
11& 22 &33\
44&55&66\
77&88&99
end{array}
end{equation}

  • 注意:如果不指定对齐方式会报错{ccc}这种
egin{equation}
egin{array}
11& 22 &33\
44&55&66\
77&88&99
end{array}
end{equation}

  • 如果需要指定矩阵的外括号或者边框,也可以使用left或者 ight这一对符号对括号进行认定。
egin{equation}
left[egin{array}{ccc}
11& 22 &33\
44&55&66\
77&88&99
end{array}
ight]
end{equation}

egin{equation}
left(egin{array}{ccc}
11& 22 &33\
44&55&66\
77&88&99
end{array}
ight)
end{equation}

egin{equation}
left{egin{array}{ccc}
11& 22 &33\
44&55&66\
77&88&99
end{array}
ight}
end{equation}

其中数组除了array,也可以使用{amsmath}宏包中的其他环境-bmatrix,Bmatrix,pmatrix,vmatrix,Vmatrix.

  • 区别在于不需要使用ccc这种控制对齐的标识,第二不需要使用left和 ight的标识
bmatrix
egin{equation}
egin{bmatrix}
11& 22 &33\
44&55&66\
77&88&99
end{bmatrix}
end{equation}

Bmatrix
egin{equation}
egin{Bmatrix}
11& 22 &33\
44&55&66\
77&88&99
end{Bmatrix}
end{equation}

pmatrix
egin{equation}
egin{pmatrix}
11& 22 &33\
44&55&66\
77&88&99
end{pmatrix}
end{equation}

Vmatrix
egin{equation}
egin{Vmatrix}
11& 22 &33\
44&55&66\
77&88&99
end{Vmatrix}
end{equation}

vmatrix
egin{equation}
egin{vmatrix}
11& 22 &33\
44&55&66\
77&88&99
end{vmatrix}
end{equation}

分块矩阵

  • 通过在列格式{c|cc}加上竖线,和hline表示分块矩阵
egin{equation}
left[egin{array}{c|cc}
11& 22 &33\
hline
44&55&66\
77&88&99
end{array}
ight]
end{equation}

公式排版

  • 公式如果过长,使用split环境进行公式排版,注意split环境必须在equation环境之下。
原始公式
egin{equation}
9=1+8=2+7=3+6=4+5=5+4=6+3=7+2=8+1
end{equation}
使用split重新排版
egin{equation}
egin{split}
9=1+8\
=2+7\
=3+6\
=4+5\
=5+4\
=6+3\
=7+2\
=8+1
end{split}
end{equation}
不使用split进行排版
egin{equation}
$$
9=1+8\
=2+7\
=3+6\
=4+5\
=5+4\
=6+3\
=7+2\
=8+1
$$
end{equation}

分段函数

  • {cases}
分段函数
Indicator Function:
[I_A(a)=egin{cases}
1&ain A\
0&a
otin A
end{cases}]

插入图片

  • 首先使用宏包graphicx--usepackage{graphicx}
  • 使用的图片格式是.eps (可以将图片转为PDF后使用adobe acrobat将其另存为eps格式)
  • 或者点击figure按钮生成模板代码进行编写。
egin{figure}
  centering
  % Requires usepackage{graphicx}
  includegraphics[scale=0.5]{1.eps}\
  caption{hello kitty}
end{figure}

  • 注意:如果报figure not found的错误,很有可能是目录中真的没有这个文件,只需要将图片和tex文件放在一个文件夹中一般不会出现找不到文件的问题。需要谨慎查看winedt文件夹地址,谨防同名文件夹~!
原文地址:https://www.cnblogs.com/cloud-ken/p/14322337.html