Latex 伪代码、三线表与多线表
Latex 伪代码、三线表与多线表
伪代码
先导入宏包
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage{amsmath}
\renewcommand{\algorithmicrequire}{\textbf{Input:}} % Use Input in the format of Algorithm
\renewcommand{\algorithmicensure}{\textbf{Output:}} % Use Output in the format of Algorithm
\begin{algorithm}[htb]
\caption{ Framework of ensemble learning for our system.}
\label{alg:Framwork}
\begin{algorithmic}[1]
\Require
The set of positive samples for current batch, $P_n$;
The set of unlabelled samples for current batch, $U_n$;
Ensemble of classifiers on former batches, $E_{n-1}$;
\Ensure
Ensemble of classifiers on the current batch, $E_n$;
\State Extracting the set of reliable negative and/or positive samples $T_n$ from $U_n$ with help of $P_n$;
\label{code:fram:extract}
\State Training ensemble of classifiers $E$ on $T_n \cup P_n$, with help of data in former batches;
\label{code:fram:trainbase}
\State $E_n=E_{n-1}cup E$;
\label{code:fram:add}
\State Classifying samples in $U_n-T_n$ by $E_n$;
\label{code:fram:classify}
\State Deleting some weak classifiers in $E_n$ so as to keep the capacity of $E_n$;
\label{code:fram:select} \\
\Return $E_n$;
\end{algorithmic}
\end{algorithm}
三线表
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-5lggglyB-1616407034926)(https://i.loli.net/2021/03/22/yoNr82YtjUDI95T.png)]
导入宏包
\usepackage{float}%提供float浮动环境
\usepackage{booktabs}%提供命令\toprule、\midrule、\bottomrule
%经典三线表
\begin{table}[H]
\caption{\textbf{Example 1}}%标题
\centering%把表居中
\begin{tabular}{cccc}%四个c代表该表一共四列,内容全部居中
\toprule%第一道横线
Item 1&Item 2&Item 3&Item 4 \\
\midrule%第二道横线
Data1&Data2&Data3&Data4 \\
Data5&Data6&Data7&Data8 \\
\bottomrule%第三道横线
\end{tabular}
\end{table}
多线表
四线表
导入宏包
\usepackage{float}%提供float浮动环境
\usepackage{booktabs}%提供命令\toprule、\midrule、\bottomrule
%经典四线表
\begin{table}[H]
\caption{\textbf{Example 2}}%标题
\centering%把表居中
\begin{tabular}{cccc}%四个c代表该表一共四列,内容全部居中
\toprule%第一道横线
Item 1&Item 2&Item 3&Item 4 \\
\midrule%第二道横线
Data1&Data2&Data3&Data4 \\
\midrule%第三道横线
Data5&Data6&Data7&Data8 \\
\bottomrule%第四道横线
\end{tabular}
\end{table}
内容跨行表
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-4AbMXtpn-1616407034928)(https://i.loli.net/2021/03/22/kKFyqnwh4LsX6xe.png)]
导入宏包
\usepackage{float}%提供float浮动环境
\usepackage{booktabs}%提供命令\toprule、\midrule、\bottomrule
\usepackage{multirow}%提供跨行命令\multirow{}{}{}
%内容跨行表
\begin{table}[H]
\caption{\textbf{Example 3}}
\centering
\begin{tabular}{cccc}%四个c代表该表一共四列,内容全部居中
\toprule%第一道横线
Item1& \multirow{2}{*}{Item2}& \multirow{2}{*}{Item3}& \multirow{2}{*}{Item4} \\%表格宽度参数采用*代表自动宽度
number&&&\\
\midrule%第二道横线
Data1&Data2&Data3&Data4 \\
\midrule%第三道横线
Data5&Data6&Data7&Data8 \\
\bottomrule%第四道横线
\end{tabular}
\end{table}
内容跨列表
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-xuJehITp-1616407034932)(https://i.loli.net/2021/03/22/wtXc1aRfhAgQkOr.png)]
导入宏包
\usepackage{float}%提供float浮动环境
\usepackage{booktabs}%提供命令\toprule、\midrule、\bottomrule
\usepackage{multirow}%提供跨列命令\multicolumn{}{}{}
%内容跨列表
\begin{table}[H]
\caption{\textbf{Example 4}}
\centering
\begin{tabular}{cccc}%四个c代表有四列且内容居中
\toprule%第一道横线
&\multicolumn{2}{c}{Resultsummary}& \\%跨两列、内容居中、跨列内容为Resultsummary
Item1&Item2&Item3&Item4 \\
\midrule%第二道横线
Data1&Data2&Data3&Data4 \\
\midrule%第三道横线
Data5&Data6&Data7&Data8 \\
\bottomrule%第四道横线
\end{tabular}
\end{table}
内容跨行、跨列多线复杂表
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-7mKKX84i-1616407034934)(https://i.loli.net/2021/03/22/d2FZLoQMJ6ye5Ku.png)]
导入宏包
\usepackage{float}%提供float浮动环境
\usepackage{booktabs}%提供命令\toprule、\midrule、\bottomrule
\usepackage{multirow}%提供跨列命令\multicolumn{}{}{}
%内容跨行、跨列多线复杂表
\begin{table}[H]
\caption{\textbf{Example 5}}
\centering
\begin{tabular}{cccc}%四个c代表有四列且内容居中
\toprule%第一道横线
&\multicolumn{2}{c}{\textbf{\underline{Resulrsummary}}}& \\%跨两列;内容居中;跨列内容为Resultsummary通过\textbf{}与\underline{}命令分别对内容加粗、加下划线
Item1&Item2&Item3&Item4 \\
\midrule%第二道横线
\multirow{2}{*}{Data1}&Data2&Data3&Data4 \\%Data1跨两行,自动表格宽度
&number2&number3&number4 \\
\midrule%第三道横线
Data5&Data6&Data7&Data8 \\
\bottomrule%第四道横线
\end{tabular}
\end{table}