凯鲁嘎吉
用书写铭记日常,最迷人的不在远方

LaTeX小范例

作者:凯鲁嘎吉 - 博客园 http://www.cnblogs.com/kailugaji/

    这篇博客给出一个关于LaTeX论文的小范例,包含了如何插入图片并设置图片大小,如何插入复杂表格(包括合并单元格,横线位置,列宽,总表格宽度,行间隔,表格一行里面文字太多需要另起一行,表格左下角注释等等),如何单独插入公式与在文本中插入公式,如何插入参考文献,如何引用文献或公式,如何插入网址等等。(自行忽略英文语法错误,只是做一个关于LaTeX的小模板)。更多LaTeX知识,参考:LaTeX常用链接与资料

1. LaTeX

\documentclass{article}
% 插入图需要加的包
\usepackage{graphicx} 
% 插入表格需要的包
\usepackage{multirow}
\usepackage{threeparttable}
\newcommand{\tabincell}[2]{\begin{tabular}{@{}#1@{}}#2\end{tabular}} 
% 插入公式需要的包
\usepackage{amsmath}
% 引用,自己定义颜色
\usepackage[colorlinks, linkcolor=blue, anchorcolor=green, citecolor=red]{hyperref}
% 超链接
\usepackage{url}
% Author:凯鲁嘎吉 https://www.cnblogs.com/kailugaji/
% 开始正文
\begin{document}
% 标题
\title{A LaTeX Example}
% 作者
\author{Kailugaji}  
\maketitle
% 章节
\section{Model}
This is an equation (\ref{eq:1}) and the picture is shown in Fig. \ref{fig:1}, where $AB^2$ is xxxxx.
% 公式
\begin{equation}
	\label{eq:1}
	\begin{aligned}
		AB^2 = BC^2 + AC^2 
	\end{aligned}
\end{equation}

\subsection{Text}
This is a table, which is shown in Table \ref{tab:1}, and this is a reference \cite{ref:1}. 
% 表格
\begin{table}
	\begin{threeparttable}
	\centering
	\caption{Blogs kailugaji}
	\setlength{\tabcolsep}{5mm}{
		\begin{tabular}{ccccp{0.1mm}ccc}
		\hline \noalign{\smallskip}
		\multirow{3}[4]{*}{Blogs} & \multirow{3}[4]{*}{Lists} & \multicolumn{2}{c}{Class1} &       & \multicolumn{3}{c}{Class2} \\
		\cline{3-4}\cline{6-8}          &       & \multirow{2}[2]{*}{\tabincell{c}{E1\\(f=0.4)}} & \multirow{2}[2]{*}{\tabincell{c}{E2\\(f=0.5)}} &       & \multirow{2}[2]{*}{E3} & \multicolumn{1}{c}{\multirow{2}[2]{*}{E4}} & \multicolumn{1}{c}{\multirow{2}[2]{*}{E5}} \\
		&       &       &       &       &       &       &  \\
		\noalign{\smallskip} \hline \noalign{\smallskip}
		\multirow{3}[1]{*}{A} & A1    & 1     & 3     &       & 2     & \multirow{3}[1]{*}{--} & \multirow{3}[1]{*}{--} \\
		& A2    & 2     & 4     &       & 0     &       &  \\
		& A3    & 5     & 9     &       & 7     &       &  \\
		\noalign{\smallskip}
		\multirow{3}[0]{*}{B} & B1    & \multirow{3}[0]{*}{--} & \multirow{3}[0]{*}{--} &       & \multirow{3}[0]{*}{--} & 1     & 4 \\
		& B2    &       &       &       &       & 2     & 2 \\
		& B3    &       &       &       &       & 5     & 9 \\
		\noalign{\smallskip}
		\multirow{3}[0]{*}{C} & C1    & 8     & 4     &       & 8     & \multirow{3}[0]{*}{--} & \multirow{3}[0]{*}{--} \\
		& C2    & 3     & 6     &       & 3     &       &  \\
		& C3    & 2     & 1     &       & 5     &       &  \\
		\noalign{\smallskip} \hline 
		\end{tabular}}
		\begin{tablenotes} 
			\item[1] xxxxxxxxx.
			% \item[*] xxxxxxxxx.
		\end{tablenotes} 
		\label{tab:1}
		\end{threeparttable}
\end{table}
% 图片
\begin{figure}
	\centering
	\includegraphics[width=5cm]{1.png}
	\caption{Kailugaji}
	\label{fig:1}
\end{figure}	
% 参考文献
\begin{thebibliography}{}
\bibitem{ref:1}
Kailugaji, Blog about LaTex, Journal, Volume, page numbers (2020), \url{https://www.cnblogs.com/kailugaji/}
\end{thebibliography}
\end{document}

2. 结果

3. 下载

    源文件与PDF文件:LaTex范例-凯鲁嘎吉.rar

posted on 2020-08-14 11:35  凯鲁嘎吉  阅读(3056)  评论(0编辑  收藏  举报