文章目录
1、参考文献
可以从外部引入参考文献,不用在latex模板中一个个添加,容易格式出错导致引用参考文献处出现“?”。
1.1 制作.bib文件
参考链接:https://blog.csdn.net/tmylzq187/article/details/51355261
例如:
1.2 slatex模板中引入.bib文件
在 \end{document} 前面加上下面两句:
\bibliographystyle{IEEEtran}//默认为plain
\bibliography{ref} //ref是自己的bib文件
1.3 文中引用文献
\cite{ref1}
注意:一开始点击 ”pdfLaTex“ 运行时,文章引用文献的地方会变成 “[?]”。需要先点击 “BibTex”,生成一些拓展文件,再点击 " pdfLaTex"运行 即可
2、TeXworks注释快捷键
(1)多行注释:ctrl+shift+]
(2)取消多行注释:ctrl+shift+[
3、插入图片
3.1 半栏:单张图片
\begin{figure}[htbp]
\centerline{\includegraphics{unnorm2.png}}
\caption{Example of a figure caption.}
\label{fig}
\end{figure}
效果:
3.2 半栏:两图并列
\begin{figure}[htbp] %半栏中两图并列
\subfigure{
\centering
\includegraphics[width=0.23\textwidth]{unnorm2.png}
}\subfigure{
\centering
\includegraphics[width=0.23\textwidth]{unnorm3.png}
}
\caption{ Comparison between the original image and its low-frequency and high-frequency components after haar wavelet transform. The ImageNet 2012 validation dataset was used in the experiment.}
\end{figure}
效果:
3.3 不分栏:单张图片
\begin{figure*}[htb]
\centering
\includegraphics{unnorm2.png}
\caption{Comparison between the original image and its low-frequency and high-frequency components after haar wavelet transform. The ImageNet 2012 validation dataset was used in the experiment}
\label{Figure}
\end{figure*}
效果:
3.4 不分栏:多张图片并列
\begin{figure*}[htb]
\centering
\includegraphics[scale=0.8]{unnorm2.png} %可通过scale设置图片尺寸
\includegraphics{unnorm2.png}
\caption{Comparison between the original image and its low-frequency and high-frequency components after haar wavelet transform. The ImageNet 2012 validation dataset was used in the experiment}
\label{Figure}
\end{figure*}
效果:
3.5 不分栏:多行多列图片,仅在最下面那行的图片下方添加文字
\begin{figure*}[htb]
\centering
\subfigure{
\begin{minipage}[t]{0.23\linewidth}
\centering
\includegraphics[width=1\linewidth]{unnorm2.png}
\end{minipage}
}
\subfigure{
\begin{minipage}[t]{0.23\linewidth}
\centering
\includegraphics[width=1\linewidth]{input_ll2.png}
\end{minipage}
}
\subfigure{
\begin{minipage}[t]{0.23\linewidth}
\centering
\includegraphics[width=1\linewidth]{input_high2.png}
\end{minipage}
}
%想让上面三张图片单独一行,需要加一行空白行,表示下面的图片另起一行。即便上面的图片尺寸小,也不会自动将下面的图片添加到第一行末尾
\setcounter{subfigure}{0} %清零,从 a 重新编号。
\subfigure[Original image]{
\begin{minipage}[t]{0.23\linewidth}
\centering
\includegraphics[width=1\linewidth]{unnorm3.png}
\end{minipage}
}
\subfigure[Low-frequency]{
\begin{minipage}[t]{0.23\linewidth}
\centering
\includegraphics[width=1\linewidth]{input_ll3.png}
\end{minipage}
}
\subfigure[High-frequency]{
\begin{minipage}[t]{0.23\linewidth}
\centering
\includegraphics[width=1\linewidth]{input_high3.png}
\end{minipage}
}
\caption{Comparison between the original image and its low-frequency and high-frequency components after haar wavelet transform. The ImageNet 2012 validation dataset was used in the experiment}
\label{Figure}
\end{figure*}
效果:
3.5 图片标题caption居中(换行居中)显示
(1)添加宏包
\usepackage{caption}
\captionsetup[figure]{font={small},singlelinecheck=false}
(2)图片标题
\caption{\centering{Comparison between the original image and its low-frequency and high-frequency components after haar wavelet transform.\\The ImageNet 2012 validation dataset was used in the experiment}}
(3)前后效果对比
前:\centering{} 中使用 \\ 会报错,如果去掉 \centering{},则效果为左对齐(未居中)
后:
4、添加邮箱
(1)添加宏包:
\usepackage{hyperref} %添加邮箱时使用
(2)用法
\href{mailto:xxx@xxx.com}{E-mail:xxx@xxx}
完整示例:
\title{Paper Title}
\author{\IEEEauthorblockN{Author1\textsuperscript{1},Author2\textsuperscript{2},Author3\textsuperscript{*}}
\IEEEauthorblockA{\textit{1. Address1}
\href{mailto:xxx@xxx.com}{E-mail:xxx@xxx}} %此处添加邮箱
\IEEEauthorblockA{\textit{2. Address2}}
\IEEEauthorblockA{* Correspondence:\href{mailto:xxx@xxx}{xxx@xxx}}
}
\maketitle
效果:
5、latex绘制表格
在线绘制表格,再将相应的latex代码复制粘贴
别忘了添加宏包:\usepackage{booktabs}
5.1 可能出现的问题
5.1.1 表格不居中
% Please add the following required packages to your document preamble:
% \usepackage{booktabs}
\begin{table}[]
\begin{tabular}{@{}cccc@{}}
\toprule
class & math & chinese & english \\ \midrule
1 & 77 & 90 & 89 \\
2 & 82 & 87 & 91 \\
3 & 87 & 88 & 84 \\ \bottomrule
\end{tabular}
\caption{Table test}
\label{tab:my-table}
\end{table}
解决方法:添加 \centering
% Please add the following required packages to your document preamble:
% \usepackage{booktabs}
\begin{table}[]
\centering %使表格居中显示
\begin{tabular}{@{}cccc@{}}
\toprule
class & math & chinese & english \\ \midrule
1 & 77 & 90 & 89 \\
2 & 82 & 87 & 91 \\
3 & 87 & 88 & 84 \\ \bottomrule
\end{tabular}
\caption{\centering{Table test}}
\label{tab:my-table}
\end{table}
效果:
5.2 希望表格跨两栏显示
解决方法:将
\begin{table}[]
……
\end{table}
改成:
\begin{table*}[]
……
\end{table*}
效果:
5.3 缩放表格尺寸
使用 \scalebox{缩放倍数} 将表格内容包起来
完整代码:
\begin{table*}[]
\centering %使表格居中显示
\scalebox{3}{ %控制表格缩放
\begin{tabular}{@{}cccc@{}}
\toprule
& content1 & content2 & content3 \\ \midrule
a & 11 & 12 & 13 \\
b & 21 & 22 & 23 \\
c & 31 & 32 & 33 \\ \bottomrule
\end{tabular}
}
\caption{\centering{Table test}} %\centering 使得表格标题居中显示
\label{tab:my-table}
\end{table*}
效果:
5.4 添加竖线
解决方法:修改
\begin{tabular}{@{}cccc@{}}
为:
\begin{tabular}{@{}|c|ccc|@{}} %要在哪里分割就在哪里画竖线。
完整代码:
% Please add the following required packages to your document preamble:
% \usepackage{booktabs}
\begin{table*}[]
\centering %使表格居中显示
\scalebox{3}{ %控制表格缩放
\begin{tabular}{@{}|c|ccc|@{}} %要在哪里分割就在哪里画竖线
\toprule
class & math & chinese & english \\ \midrule
1 & 77 & 90 & 89 \\
2 & 82 & 87 & 91 \\
3 & 87 & 88 & 84 \\ \bottomrule
\end{tabular}
}
\caption{\centering{Table test}}
\label{tab:my-table}
\end{table*}
效果:
5.5 表格交叉线有空隙
解决方法:将所有的 \toprule \midrule \bottomrule 都改成 \hline
完整代码:
% Please add the following required packages to your document preamble:
% \usepackage{booktabs}
\begin{table*}[]
\centering %使表格居中显示
\scalebox{3}{ %控制表格缩放
\begin{tabular}{@{}|c|ccc|@{}} %要在哪里分割就在哪里画竖线
\hline %去除交叉线空隙
class & math & chinese & english \\ \hline %去除交叉线空隙
1 & 77 & 90 & 89 \\
2 & 82 & 87 & 91 \\
3 & 87 & 88 & 84 \\ \hline %去除交叉线空隙
\end{tabular}
}
\caption{\centering{Table test}}
\label{tab:my-table}
\end{table*}
效果:
\hline 所带来的问题:替换成\hline 之后,行高变小,表格内容紧贴着框线,不顾美观,如下:
解决方法:手动设置行高
关键代码:
\renewcommand\arraystretch{行高} %设置表格行高
完整代码:
% Please add the following required packages to your document preamble:
% \usepackage{booktabs}
\begin{table*}[]
\renewcommand\arraystretch{2} %设置表格行高
\centering %使表格居中显示
\begin{tabular}{@{}|c|ccc|@{}} %要在哪里分割就在哪里画竖线
\hline %去除交叉线空隙
class & math & chinese & english \\ \hline %去除交叉线空隙
1 & 77 & 90 & 89 \\
2 & 82 & 87 & 91 \\
3 & 87 & 88 & 84 \\ \hline %去除交叉线空隙
\end{tabular}
\caption{\centering{Table test}}
\label{tab:my-table}
\end{table*}
效果: