admin管理员组

文章数量:1530517

LaTex使用

      • 1. 关于工具
      • 2. 建立文档
      • 3. 公式
        • 插入公式编号
      • 4. 符号
        • 常用
        • 特殊字符
        • refrence
      • 5. 矩阵
      • 6. 图片
        • 浮动体
        • 跨双栏显示图片
      • 7. 表格
        • tabular环境
        • booktabs宏包
        • table 环境
        • 表格的合并
      • 8.参考文献
      • 9. 实用工具

1. 关于工具

MAC端可以使用MacTex。点击下载好pkg格式的MacTex软件之后即可安装。安装好后打开其中的TeXShop,便可以在上面进行LaTeX的编译了,也可以配置VScode或者sublime。
关于编译,在TeXShop中直接点击Typeset或使用command+T快捷键进行编译就好了。
关于中文,
如果要插入中文,那么需要在前面引入一个包

\usepackage{xeCJK}
\setCJKmainfont{宋体}

然后就可以直接使用中文了。

2. 建立文档

一个小的demo

\documentclass{article}
   \author{My Name}
   \title{The Title}
   \date{\today}
\begin{document}
   \maketitle
   hello, world  \\ good % this is a comment
\end{document}
  • \documentclass[选项]{类型} 文章格式
    article(文章) report(报告) slides(ppt) book(书籍)
    \documentclass[conference]{IEEEtran} IEEE模版

  • \begin{document} \end{document}

    二者中间为正文部分

  • \title{} \author{} \date{} 三项分别为标题、作者、日期

  • \maketitle 使得以上内容得以显现。

  • 在代码中,空一行表示另起一段,\\为段内强制换行

  • 中间空一行 代表另起一段

  • 保存类型选择为 UTF-8

\documentclass{article}
\begin{document}
   \tableofcontents
   \section{A} sectionA.
      \subsection{AB} subsectionAB.
         \subsubsection{ABC} subsubsectionABC.
            \paragraph{ABCD}is paragraph.
               \subparagraph{ABCDE} is subparagraph.
\end{document}
  • \tableofcontents 目录
  • \section 章节
  • \subsection 子章节
  • \subsubsection 子章节的子章节
  • \paragraph 段落
  • \subparagraph 子段落

3. 公式

使用包\usepackage{amsmath}

LaTeX 的数学模式有两种:行内模式(inline)和行间模式(display)。前者在正文的行文中,插入数学公式;后者独立排列单独成行。

使用 $ ... $ 可以插入行内公式,使用 $$ ... $$ 可以插入行间公式(不建议),如果需要对行间公式进行编号,可以使用 equation 环境.

\begin{equation} 
...
\end{equation}
  • 行内公式也可以使用 \(...\) 或者 \begin{math} ... \end{math} 来插入,无编号的行间公式也可以使用 \begin{displaymath} ... \end{displaymath} 或者 \begin{equation*} ... \end{equation*} 来插入(equation* 中的 * 表示环境不编号)。
\begin{align} 
ds^2 &= c^2dt^2-d\rm{r}^2 \\
\frac{b}{a} + \sqrt{3} \otimes 7 &= \bm{T}
\end{align}
  • 其中多行公式中 \begin{gather} \end{gather} 表示居中对齐

    ​ \begin{align} \end{align} 配合&使用 指明哪里对齐

    ​ 尾部加上 \nonub 就是此行公式不编号

插入公式编号
\begin{equation} \label{equnum} % 注意空格 label{}括号内的自定义
...
\end{equation}

在文本中插入\ref{equnum}。其搭配label{equnum}使用。

4. 符号

常用
  • \bm{} 对大括号里面的内容加粗
  • \rm{} 大括号里面的东西是正的 也就是公式里的不倾斜
  • ^ 右上角标
  • _ 右下角标
  • \sqrt 根号
  • \frac 分号
  • \cdot 点乘
特殊字符

~ { } & % # 用转义字符转译

refrence
Symbol Command Symbol Command Symbol Command
\pm \mp \times
\div \cdot \ast
\star \dagger \ddagger
\amalg \cap \cup
\uplus \sqcap \sqcup
\vee \wedge \oplus
\ominus \otimes \circ
\bullet \diamond \lhd
\rhd \unlhd \unrhd
\oslash \odot \bigcirc
\triangleleft \Diamond \bigtriangleup
\bigtriangledown \Box \triangleright
\setminus \wr \sqrt{x}
x^{\circ} \triangledown \sqrt[n]{x}
a^x a^{xyz} </

本文标签: LaTeX