%Tex program = xelatex%software = TexLive 2015%本程序的作用是解决LaTex插图的问题,一是并排插入图片,二是解决图片的标号问题%引用自(http://tieba.baidu.com/p/4582793482)\documentclass[a4paper,UTF8]{article}\usepackage{ctex}\usepackage{graphicx}\usepackage{caption,subcaption}\begin{document}\begin{figure}[ht]\centering\begin{subfigure}[t]{0.3\textwidth}\centering\includegraphics[width=1\textwidth]{a1.jpg}\subcaption*{伤心图}\end{subfigure}\quad\begin{subfigure}[t]{0.3\textwidth}\centering\includegraphics[width=1\textwidth]{a2.jpg}\subcaption*{开心图}\end{subfigure}\quad\begin{subfigure}[t]{0.3\textwidth}\centering\includegraphics[width=1\textwidth]{a3.jpg}\subcaption*{帅哥图}\end{subfigure}\caption*{都是表情图}\end{figure}\end{document}
LaTeX排版札记:插入图片(并排显示、自定义编号)
https://zhuanlan.zhihu.com/p/32925549
1.单图插入的基本用法
%导言区插入下面三行\usepackage{graphicx} %插入图片的宏包\usepackage{float} %设置图片浮动位置的宏包\usepackage{subfigure} %插入多图时用子图显示的宏包\begin{document}\begin{figure}[H] %H为当前位置,!htb为忽略美学标准,htbp为浮动图形\centering%图片居中\includegraphics[width=0.7\textwidth]{DV_demand} %插入图片,[]中设置图片大小,{}中是图片文件名\caption{Main name 2} %最终文档中希望显示的图片标题\label{Fig.main2} %用于文内引用的标签\end{figure}\end{document}
编译之后,得到:
2.多图横排+默认编号
%导言区插入下面三行\usepackage{graphicx}\usepackage{float} \usepackage{subfigure}\begin{document}Figure \ref{Fig.main} has two sub figures, fig. \ref{Fig.sub.1} is the travel demand of driving auto, and fig. \ref{Fig.sub.2} is the travel demand of park-and-ride.
\begin{figure}[H]\centering%图片全局居中\subfigure[name1]{\label{Fig.sub.1}\includegraphics[width=0.45\textwidth]{DV_demand}}\subfigure[name2]{\label{Fig.sub.2}\includegraphics[width=0.45\textwidth]{P+R_demand}}\caption{Main name}\label{Fig.main}\end{figure}\end{document}
编译完成后的效果:
3.多图横排+自定义编号
%导言区的此三行无变化\usepackage{graphicx}\usepackage{float} \usepackage{subfigure}%以下是新增的自定义格式更改\usepackage[]{caption2} %新增调用的宏包\renewcommand{\figurename}{Fig.} %重定义编号前缀词\renewcommand{\captionlabeldelim}{.~} %重定义分隔符%\roman是罗马数字编号,\alph是默认的字母编号,\arabic是阿拉伯数字编号,可按需替换下一行的相应位置\renewcommand{\thesubfigure}{(\roman{subfigure})}%此外,还可设置图编号显示格式,加括号或者不加括号\makeatletter\renewcommand{\@thesubfigure}{\thesubfigure\space}%子图编号与名称的间隔设置\renewcommand{\p@subfigure}{} \makeatother\begin{document}%注意:此段中在引用中增加了主图编号的引用Figure \ref{Fig.main} has two sub-figures, fig. \ref{Fig.main}\ref{Fig.sub.1} is the travel demand of driving auto, and fig. \ref{Fig.main}\ref{Fig.sub.2} is the travel demand of park-and-ride.
%以下code与上一小结的无变化\begin{figure}[H]\centering%图片全局居中\subfigure[name1]{\label{Fig.sub.1}\includegraphics[width=0.45\textwidth]{DV_demand}}\subfigure[name2]{\label{Fig.sub.2}\includegraphics[width=0.45\textwidth]{P+R_demand}}\caption{Main name}\label{Fig.main}\end{figure}\end{document}
%导言区需要新增的宏包\usepackage{enumerate} %列举宏包%正文部分的代码% 无编号,但公式符号可以对齐的做法,example1\begin{enumerate}[align=right]\setlength{\leftmargin}{2em} %左边界\setlength{\parsep}{0ex} %段落间距\setlength{\topsep}{0ex} %列表到上下文的垂直距离\setlength{\itemsep}{0ex} %条目间距\setlength{\labelsep}{1em} %标号和列表项之间的距离,默认0.5em\setlength{\itemindent}{0em} %标签缩进量\setlength{\listparindent}{0em} %段落缩进量\item [ $c_1$] the constant travel time of driving (auto), unit: minutes per time;\item [$c_2$] the constant travel time of taking MRT, unit: minutes per time;\item [$\tau_1$] the unit fixed cost of driving for a traveler, unit: yuan per person per time;\item [$\tau_2$] one-way fare of MRT for a traveler, unit: yuan per person per time;\item [$\varsigma_1$] the unit operation cost of highway for the traffic manager, unit: yuan per person per time;\end{enumerate}%有编号的一般做法, example2With numbers as below in example1:\begin{itemize}\item document style\item baselineskip\item front matter\item keywords and MSC codes\item theorems, definitions and proofs\item lables of enumerations\item citation style and labeling.\end{itemize}%有编号的一般做法,example 3With numbers as below in example2:\begin{enumerate}[(1)]\item Group the authors per affiliation.\item Use footnotes to indicate the affiliations.\end{enumerate}