我尝试将两个图形并排堆叠,但它们总是叠放在一起并且标题左对齐。
\documentclass[article]{Definitions/mdpi}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage[utf8]{inputenc}
\usepackage{graphics}
\usepackage[skip=2pt,font=scriptsize]{caption}
\usepackage{caption}
\usepackage{subcaption}
\graphicspath{{Images/}}
\usepackage{array,booktabs,longtable,tabularx,tabulary}
\usepackage{adjustbox}
\usepackage{hhline}
\usepackage{nccmath}
\usepackage{yfonts,color}
\usepackage{ltablex}
\usepackage{amssymb}
\usepackage{wrapfig}
\usepackage{color,soul}
\usepackage{amsfonts}
\usepackage{enumerate}
\usepackage{forest}
\usepackage{tikz-qtree}
\usepackage{tikz}
\usepackage[long]{optidef}
\usepackage{textcomp}
\usepackage{rotating}
\usepackage{tabu}
\usepackage{ltablex}
%\usepackage[export]{adjustbox}
%\usepackage{wrapfig}
%------------------------------
%Table-related commands
%\usepackage{array}
%\usepackage[table]{xcolor}
%\setlength{\arrayrulewidth}{1mm}
%\setlength{\tabcolsep}{18pt}
%\renewcommand{\arraystretch}{1.5}
%\newcolumntype{s}{>{\columncolor[HTML]{AAACED}} p{3cm}}
%-------------------------------------------------------
\title{Positioning tables and figures}
\author{Overleaf}
\date{May 2021}
\graphicspath{{images/}}
\begin{document}
\maketitle
\section{Positioning images}
\begin{figure}
%\centering
\begin{subfigure}{0.49\textwidth}
\includegraphics[width=0.9\linewidth, height=6cm]{figure1.JPG}
\caption{}
\label{fig:uavbuilding}
\end{subfigure}
\begin{subfigure}{0.49\textwidth}
\includegraphics[width=0.9\linewidth, height=6cm]{figure2.jpg}
\caption{}
\label{fig:uavcloseip}
\end{subfigure}
\caption{a) System Model to Calculate the $P(LoS)$ Considering the user’s Antenna Height b) A Close-Up of (a) }
\end{figure}
\end{document}
答案1
\documentclass[article]{Definitions/mdpi}
\usepackage{graphicx}
\usepackage[skip=2pt,font=scriptsize]{caption}
\usepackage{subcaption}
\title{Positioning tables and figures}
\author{Overleaf}
\date{May 2021}
\begin{document}
\maketitle
\begin{figure}[ht]
\centering
\begin{subfigure}{0.49\linewidth} % <---- observe "\linewidth>"
\includegraphics[width=\linewidth, height=6cm]{example-image-duck}
\caption{}
\label{fig:uavbuilding}
\end{subfigure}\hfil%
\begin{subfigure}{0.49\linewidth}% <---- observe "\linewidth>"
\includegraphics[width=\linewidth, height=6cm]{example-image-duck}
\caption{}
\label{fig:uavcloseip}
\end{subfigure}
\caption{a) System Model to Calculate the $P(LoS)$ Considering the user’s Antenna Height b) A Close-Up of (a) }
\end{figure}
\end{document}
在 Overleaf 中编译后的结果如下: