Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Q23 如何插入Figure,Scheme, Table 等并按类型编号? #30

Open
Lihua1990 opened this issue Jan 3, 2020 · 5 comments
Open

Q23 如何插入Figure,Scheme, Table 等并按类型编号? #30

Lihua1990 opened this issue Jan 3, 2020 · 5 comments

Comments

@Lihua1990
Copy link
Collaborator

No description provided.

@EthanDeng
Copy link
Owner

EthanDeng commented Jan 4, 2020

首先是插图和表格制作。插图需要借助 graphicx 包,所以导言区需要加上

\usepackage{graphicx}

插图示例命令为

\includegraphics[width=0.7\textwidth]{image.png}

这样我们就可以在当前位置插入 image.png 这张图,并且设定宽度为 0.7\textwidth,其中 \textwidth 表示版芯宽度。另外还可以设置高度 height=0.3\textheight,\textheight 表示版芯高度; 以及缩放比例scale=0.3以及旋转角度angle=45。在插图时,建议设置弹性宽度(\textwidth, \linewidth`),而不是绝对宽度(比如 3cm)。

表格的制作参照 #24

@EthanDeng
Copy link
Owner

EthanDeng commented Jan 4, 2020

在完成插图和插入表格之后,如果想要引用图表的编号,则需要通过交叉引用,也就是通过 \label\ref 组合使用获得编号引用,并且为了区分正文,我们还需要将其放入 figuretable 环境中。

下面举例说明,在不涉及交叉引用时,插图的代码一般是:

\begin{figure}
  \centering
  \includegraphics[width=0.7\textwidth]{image.png}
  \caption{The Caption of Figure}
\end{figure}

其中,centering 是为了让图居中,而 \caption 则会为图生成一个标题,显示为

Figure x. The Caption of Figure

如果想要引用这个图的编号,也就是 x,可以改为

\begin{figure}
  \centering
  \includegraphics[width=0.7\textwidth]{image.png}
  \caption{The Caption of Figure}
  \label{fig:label_text}
\end{figure}

然后在需要引用图表编号的地方使用 \ref{fig:label_text}\label\ref 的内容必须一致才能正确引用图的编号,本质上无需 fig: 开头,但是为了区分不同类型的标签文本(label text),此方法已经成为传统。

@EthanDeng
Copy link
Owner

表格的引用也是类似,如果不涉及引用时,代码为

\begin{table}
  \centering
  \caption{The Caption of Table}
  \begin{tabular}
    1 & 2\\
    3 & 4\\
  \end{tabular}
\end{table}

\centering\caption 的含义和插图一样,不过一般图的标题在图的下方,而表格的标题在表格上方,因此 \caption 的位置有所不同。涉及交叉引用时,则需要为其添加 label,变为

\begin{table}
  \centering
  \caption{The Caption of Table}
  \label{tab:label_text}
  \begin{tabular}
    1 & 2\\
    3 & 4\\
  \end{tabular}
\end{table}

在引用时,则使用 \ref{tab:label_text} 即可。

强烈建议:标签文本也即 label_text 设置为有意义的内容,不要 \label{fig:1}\label{fig:2} 这种。

@Lihua1990
Copy link
Collaborator Author

Lihua1990 commented Jan 15, 2020

如何为所有的Figure (or Table)生成一个目录列表
比如如下图所示
List of Figures
1.1 Virreplication scheme . . . . . . . .3
1.2 Ba idgshadgruses . . . . . . . . . . . 4
1.3 Sc dsfgadnome . . . . . . . . . . . . . 7
1.4 fes sfdhhhhhhhhh . . . . . . . . . . 14

@EthanDeng
Copy link
Owner

如果你设置好了图/表的 caption,你可以使用 \listoffigures\listoftables 两个命令得到图表的列表,你只需要把这两个命令插入到你想要的位置即可。如果你想修改 List of Figures/Tables 可以在导言区使用

\renewcommand{\listfigurename}{Figures}
\renewcommand{\listtablename}{Tables}

更多例子参考:Lists of Tables and Figures

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants