论文Latex常用教程
页脚防挡
在合适的位置加上这个:
\IEEEpubidadjcol
Overleaf引用
最简单的方法是使用\bibitem的管理方法:
\begin{thebibliography}{1}
\bibitem{ams}
{\it{Mathematics into Type}}, American Mathematical Society. Online available:
\bibitem{oxford}
T.W. Chaundy, P.R. Barrett and C. Batey, {\it{The Printing of Mathematics}}, Oxford University Press. London, 1954.
\end{thebibliography}
但是这种维护麻烦,每个条目都需要自己转化格式,因此更推荐使用bib文件 + BibTex的管理方式。具体来说在Overleaf Project下命名一个文件为xxx.bib(博主这里是Reference.bib)。在正文中引入你的bib文件:
\usepackage{cite}
\bibliographystyle{IEEEtran}
\bibliography{reference} %bib文件名
bib文件为BibleTex格式的引用,获取的方式如下
但是这种方法获取的引用经常没有boi版号,所以更推荐通过dblp获取详细的引用
表格
三线表常用的包是booktabs包,为了格内换行同时引入makecell包
\begin{table}[htbp]
\begin{center}
\caption{\textbf{Ablation studies of each component on SAR-AIRCRAFT 1.0 and the comparison is shown in terms of current known mAP(mAP) and unknown recall(U-Recall)}} % 表格下方描述
\label{tab3} % 表格引用标签
\begin{tabular}{ c | c | c | c | c | c } % 表格列布局
\toprule
Task IDs($\rightarrow$) & \multicolumn{2}{|c|}{Task 1} & \multicolumn{3}{c}{Task 2}\\ % multicolumn指占据多列
\midrule
&U-Recall &mAP($\uparrow$) &\multicolumn{3}{c}{mAP($\uparrow$)}\\
&($\uparrow$) &\makecell{Current\\known} & \makecell{Previously\\known} & \makecell{Current\\known} & Both\\
\midrule
Full Model &\textbf{44.67} &\textbf{85.52} &\textbf{84.67} & \textbf{49.00} &\textbf{79.57}\\
\textit{w.o.} xx &5.36 &84.37 &82.18 &48.08 &77.31 \\
\textit{w.o.} xx &0.07 &84.82 &81.72 &42.58 &76.13 \\
\textit{w.o.} xx &8.14 &84.61 &82.30 &43.91 &76.82 \\
\bottomrule
\end{tabular}
\end{center}
\end{table}
标题与正文之间出现大片空白
原因:latex排版的问题,为了把整个页面撑满,自动扩大了段间距
\raggedbottom %加这个
\begin{document}
\end{document}
多行公式
% 多行公式单编号
\begin{equation}
\begin{aligned}
&\hat{C}_t = tanh(W_C\odot[h_{t-1},x_t]+b_C) \\
&i_t=\sigma(W_i\odot[h_{t-1},x_t]+b_i) \\
&f_t=\sigma(W_f\odot[h_{t-1},x_t]+b_f) \\
&C_t=f_t * C_{t-1}+i_t * \hat{C}_t \\
&o_t=\sigma(W_o\odot[h_{t-1},x_t]+b_o) \\
&h_t=o_t * tanh(C_t)
\end{aligned}
\end{equation}
算法排版
简单排版可以使用
\usepackage{algorithmic}
\usepackage{algorithm}
复杂推荐algorithm2e
\usepackage[ruled,lined,linesnumbered]{algorithm2e}
设置 | 作用 |
---|---|
linesnumbered | 显示行号 |
ruled | 标题显示在上方,不加就默认显示在下方 |
vlined | 代码段中用线连接 |
boxed | 将算法插入在一个盒子里 |
一个例子:
\begin{algorithm}[t]
\caption{Dual Supervised Pseudo-labeling}
\begin{small}
\BlankLine
\KwIn{Input image $I$, backbone, RPN and head $G()$, Hungarian-Matcher $H()$, ground truth of known class $\{l, b\}$, known class count $C$, hyperparameter $\gamma, k$}%输入参数
\KwOut{pseudo ground truth bounding box $b^*$ with pseudo label $l^*=C + 1$}%输出
$q, \hat{l}, \hat{b} \leftarrow G(I)$\;
$q_j,q_i \leftarrow H(q, l, b)$, where $i \in \overline{\mathcal{Q}}$ and $j \in \mathcal{Q}$\;
\For{$i\leftarrow 1$ \KwTo $|\overline{\mathcal{Q}}|$}{
\For{$c\leftarrow 1$ \KwTo $C+ 1$}{
$s_{c}^{cat} = f_{cls}(q_{ic}) \cdot f_{obj}(q_{ic})$ \;
$s_{cat} = s_{cat} + s_c^{cat}$ \;
}
}
\For{$i\leftarrow 1$ \KwTo $|\overline{\mathcal{Q}}|$}{
\For{each $b_k^*$ in $b$}{
$r = \arg\max IoU(\hat{b_i}, b^*_k)$
}
$\mathbf{s}^{loc}_i = 1 - IoU(\hat{b_i}, b_r)$
}
$s_p = s_{cat} \cdot (s_{loc})^\gamma$\;
Select the $k$ unmatched queries $q*$ with $s_p$, $q* \leftarrow \text{Top}_k(s_p)$ \;
$l^* = C + 1, b^* = \hat{b}_{idx(q^*)}$ \;
\Return $\{l^*, b^*\}$
\end{small}
\end{algorithm}
表格每列宽度调整方法
最推荐的是使用tabularx这个包
\usepackage{tabularx}
设置格式: \begin{tabularx}{width}[pos]{preamble}
width常用的就两个,分别为表示单栏的\linewidth与表示双栏的\textwidth,在前面可以加上一个浮点数表示比例,例如0.9\linewidth表示占据单栏的90%的宽度
preamble表示每一列的设置,用 "|" 间隔, 下面解释一个常见的设置:
>{\centering\arraybackslash}X
\centering表示居中,X表示均分总宽度,因此常见的等宽表格就是所有的宽度都设置为X,如果想要自定义宽度的话使用设置p:
>{\centering\arraybackslash}p{0.15\textwidth}
tip
注意,分割线也会占据一定的宽度,后面计算时需要留给分割线一些宽度
下面是两个常见的例子
\begin{table*}[htbp]
\centering
\caption{}
\label{tab2}
\begin{tabularx}{0.9\textwidth}{ >{\centering\arraybackslash}X | >{\columncolor{yellow!20}\centering\arraybackslash}X | >{\centering\arraybackslash}X | >{\centering\arraybackslash}X | >{\centering\arraybackslash}X | >{\centering\arraybackslash}X }
\toprule
\textbf{Task IDs}($\rightarrow$) & \multicolumn{2}{c|}{\textbf{Task 1}} & \multicolumn{3}{c}{\textbf{Task 2}}\\
\midrule
Methods &U-Recall &\cellcolor{myblue}mAP($\uparrow$) &\multicolumn{3}{c}{\cellcolor{myblue}mAP($\uparrow$)}\\
&($\uparrow$) &\makecell{Current\\known} &\makecell{Previously\\known} &\makecell{Current\\known} &Both\\
\midrule
OW-DETR~\cite{ow-detr} &20.58 &85.90 &62.53 &54.61 &61.40\\
PROB~\cite{prob} &27.8 &85.23 &78.41 &60.66 &75.88\\
CAT~\cite{cat} &31.45 &82.86 &79.60 &56.74 &76.34\\
OrthogonalDet~\cite{orthogonal} &45.6 &94.03 &92.88 &63.07 &88.61\\
\textbf{ToBL} (Ours) &\textbf{70.5}&\textbf{95.08}&\textbf{93.72}&\textbf{68.77}&\textbf{90.16}\\
\midrule
\specialrule{0em}{0pt}{2pt}
\midrule
OW-DETR~\cite{ow-detr} &15.8 &67.17 &59.38 &11.65 &51.42\\
PROB~\cite{prob} &27.3 &60.48 &58.32 &12.16 &51.03\\
CAT~\cite{cat} &11.8 &65.24 &59.73 &13.40 &52.01\\
OrthogonalDet~\cite{orthogonal} &45.9 &71.07 &70.46 &12.61 &60.82\\
\textbf{ToBL}(Ours) &\textbf{48.6} &\textbf{71.2}&\textbf{70.89}& \textbf{16.9}&\textbf{61.88}\\
\bottomrule
\end{tabularx}
\end{table*}
\begin{table*}[htbp]
\centering
\caption{}
\label{tab3}
\begin{tabularx}{\textwidth}{ >{\centering\arraybackslash}p{0.15\textwidth} | >{\centering\arraybackslash}p{0.08\textwidth} | >{\centering\arraybackslash}p{0.08\textwidth} | >{\centering\arraybackslash}p{0.08\textwidth} | >{\centering\arraybackslash}p{0.08\textwidth} | >{\centering\arraybackslash}p{0.08\textwidth} | >{\centering\arraybackslash}p{0.08\textwidth} | >{\centering\arraybackslash}p{0.08\textwidth} | >{\centering\arraybackslash}p{0.08\textwidth} }
\toprule
Methods &B737 &A330 &B787 &A220 &A320 &ARJ21 &other &mAP\\
\midrule
OW-DETR~\cite{ow-detr} &70.1 &56.0 &73.4 &63.3 &56.2 &56.1 &54.6 &61.4\\
PROB~\cite{prob} &87.2 &81.5 &84.5 &73.3 &71.1 &73.0 &60.7 &75.9\\
CAT~\cite{cat} &85.1 &86.5 &85.2 &74.1 &73.5 &73.3 &56.7 &76.3\\
OrthogonalDet~\cite{orthogonal} &96.8 &95.7 &96.5 &85.8 &90.1 &92.3 &63.1 &88.6\\
\midrule
\rowcolor{yellow!20}
\textbf{ToBL}(Ours) &\textbf{97.0} &\textbf{96.3} &\textbf{96.7} &\textbf{89.3} &\textbf{90.6} &\textbf{93.3} &\textbf{68.8} &\textbf{90.2} \\
\bottomrule
\end{tabularx}
\end{table*}
表格插入等高不等宽图片
常见的插入等宽高比例的图片的方法是通过figure与subfloat配合
tip
figure与figure*分别代表占据单栏宽度与占据双栏宽度
\begin{figure*}[!t]
\centering
\subfloat[]{\includegraphics[width=0.19\linewidth]{source.jpg}}
\hfil
\subfloat[]{\includegraphics[width=0.19\linewidth]{gt}}
\hfil
\subfloat[]{\includegraphics[width=0.19\linewidth]{OW-DETR_result.jpg}}
\hfil
\subfloat[]{\includegraphics[width=0.19\linewidth]{PROB_result.jpg}}
\hfil
\subfloat[]{\includegraphics[width=0.19\linewidth]{ours_result.jpg}}
\vspace{-2em}
\subfloat[Origin]{\includegraphics[width=0.19\linewidth]{source2.jpg}}
\hfil
\subfloat[GT]{\includegraphics[width=0.19\linewidth]{gt2.jpg}}
\hfil
\subfloat[OW-DETR~\cite{9879305}]{\includegraphics[width=0.19\linewidth]{OW-DETR_result2.jpg}}
\hfil
\subfloat[PROB~\cite{10204381}]{\includegraphics[width=0.19\linewidth]{PROB_result2.jpg}}
\hfil
\subfloat[DNOWSD(ours)]{\includegraphics[width=0.19\linewidth]{ours_result2.jpg}}
\caption{}
\label{}
\end{figure*}
这样对于想要插入等高但不等宽的图片不适用,想要浮动宽度可以考虑使用表格结构,也更方便添加图片标号
\begin{figure*}[!ht]
\centering
\begin{tabular}{@{}c@{}ccccc@{}}
\raisebox{1.5cm}{\rotatebox{90}{\textbf{GT}}} \hspace{0.5em}&
\includegraphics[height=3.5cm]{crop_img/gt_0707.png} &
\includegraphics[height=3.5cm]{crop_img/gt_1675.png} &
\includegraphics[height=3.5cm]{crop_img/gt_2098.png} &
\includegraphics[height=3.5cm]{crop_img/gt_2285.png} \\
\raisebox{1.5cm}{\rotatebox{90}{\textbf{PROB}}} \hspace{0.5em}&
\includegraphics[height=3.5cm]{crop_img/prob_0707.png} &
\includegraphics[height=3.5cm]{crop_img/prob_1675.png} &
\includegraphics[height=3.5cm]{crop_img/prob_2098.png} &
\includegraphics[height=3.5cm]{crop_img/prob_2285.png} \\
\raisebox{1.5cm}{\rotatebox{90}{\textbf{CAT}}} \hspace{0.5em}&
\includegraphics[height=3.5cm]{crop_img/cat_0707.png} &
\includegraphics[height=3.5cm]{crop_img/cat_1675.png} &
\includegraphics[height=3.5cm]{crop_img/cat_2098.png} &
\includegraphics[height=3.5cm]{crop_img/cat_2285.png} \\
\raisebox{0.5cm}{\rotatebox{90}{\textbf{OrthogonalDet}}} \hspace{0.5em}&
\includegraphics[height=3.5cm]{crop_img/orthogonaldet_0707.png} &
\includegraphics[height=3.5cm]{crop_img/orthogonaldet_1675.png} &
\includegraphics[height=3.5cm]{crop_img/orthogonaldet_2098.png} &
\includegraphics[height=3.5cm]{crop_img/orthogonaldet_2285.png} \\
\raisebox{1cm}{\rotatebox{90}{\textbf{ToBL(Ours)}}} \hspace{0.5em}&
\includegraphics[height=3.5cm]{crop_img/ours_0707.png} &
\includegraphics[height=3.5cm]{crop_img/ours_1675.png} &
\includegraphics[height=3.5cm]{crop_img/ours_2098.png} &
\includegraphics[height=3.5cm]{crop_img/ours_2285.png} \\
\end{tabular}
\caption{}
\label{}
\end{figure*}