For AI agents: the complete documentation index is available at https://heyq02.com/llms.txt, the full documentation bundle is available at https://heyq02.com/llms-full.txt, and this page is available as Markdown at https://heyq02.com/blog/posts/latex-mcm-tables-figures-equations.md.
跳到主要内容

美赛 LaTeX 关键操作:表格、图片、公式与代码块

预计阅读时间: 3 分钟

2022 年美赛开赛前整理的一份 LaTeX 速查:绘制表格、插入图片、插入公式的具体写法和注释要求。下面的代码可以直接复制使用,编号格式已经设置好。

1. 绘制表格

1.1 代码如下

\begin{table}[htbp]
    \centering
    \caption{Symbols and Definition}
    \label{tab:my_label}
    \begin{tabular}{c|c}
        Symbols&Definition\\
        \hline
        PEI&The extent to which plastic processing affects the environment\\
        PODI&The degree to which plastic processing breaks the environment\\
        POEI&How much plastic handling optimises the environment\\
        PPRO&Plastic production\\
        PP&Plastic pollution levels
    \end{tabular}
\end{table}

1.2 例图

1.3 详解

表格的插入不需要额外的宏包。

\caption{} 大括号内可以设置表格标题。

边框的设置很有意思:纵向线条由 {c|c} 这样的格式预设,横向线条用 \hline 语句绘制。c|c 表示两列,|c|c| 也是两列,只是后者多了外边框。在第一行 Symbols & Definition 之后写 \hline,就会在这一行下方画一条横线。横线可以在任意一行上下添加,宽度会自动匹配内容的多少。

2. 插入图片

2.1 代码如下

\begin{figure}[htbp]
  \centering
  \includegraphics{Model 1.png}
  \caption{Model 1}
  \label{fig:my_label}
\end{figure}

2.2 例图

2.3 详解

首先需要添加宏包 \usepackage{graphicx}。

\caption{} 大括号内可以设置标题。

\includegraphics{} 大括号内放置图片文件名。博主用的是网页版 TeX 编辑器,文件名很好查。

3. 插入公式

3.1 代码如下

\begin{equation}
    AP=\sum_{n}{\gamma_n\omega_mEM}
\end{equation}

3.2 例图

3.3 详解

首先也是添加宏包 \usepackage{amsmath, amsfonts}。

公式环境 equation 已经处理好了格式,关键是大括号里的公式怎么写。这里推荐一篇写得很详细的博文:LaTeX数学公式-详细教程_NSJim的博客-CSDN博客_latex数学公式