我想将每个子图的标题放在子图的中心,但它却出现在左侧。您知道如何移动子图的标题以及图的标题吗?提前谢谢!
\begin{figure}[h]
\centering
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[width=.4\linewidth]{Non-State.png}
\caption{Non-State Violence}
\label{fig:sub1}
\end{subfigure}%
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[width=.4\linewidth]{One-Sided.png}
\caption{One Sided violence}
\label{fig:sub2}
\end{subfigure}
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[width=.4\linewidth]{State-Based.png}
\caption{State-Based Violence}
\label{fig:sub3}
\end{subfigure}
\caption{Type of Violence}
\label{fig:test}
\end{figure}
答案1
这应该有效:
\documentclass[demo]{article} % remove 'demo' option in real document
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage[justification=centering]{caption}
\begin{document}
\begin{figure}[h]
%\centering
\begin{subfigure}{.42\textwidth}
%\centering
\includegraphics[width=\linewidth]{Graph1.png}
\caption{"Stable" Countries group}
\label{fig:sub1}
\end{subfigure}
\hfill
\begin{subfigure}{.42\textwidth}
%\centering
\includegraphics[width=\linewidth]{Graph2.png}
\caption{"unstable" Countries group}
\label{fig:sub2}
\end{subfigure}
\caption{Number of Actors by Year and Countries}
\label{fig:test}
\end{figure}
\end{document}
编辑:我听取了 Mico 的建议,因此长标题与图形更好地一致。
答案2
我认为实现格式化目标的最佳方法是更改[width=.6\linewidth]
环境[width=\linewidth]
的宽度(如果需要)subfigure
。
\documentclass[demo]{article}
\usepackage{graphicx,subcaption}
\begin{document}
\begin{figure}[h]
\centering
\begin{subfigure}{.45\textwidth}
\includegraphics[width=\linewidth]{Graph1.png}
\caption{Non-state violence}
\label{fig:sub1}
\end{subfigure}
\hfill
\begin{subfigure}{.45\textwidth}
\includegraphics[width=\linewidth]{Graph2.png}
\caption{One-sided violence}
\label{fig:sub2}
\end{subfigure}
\bigskip
\begin{subfigure}{.45\textwidth}
\includegraphics[width=\linewidth]{Graph3.png}
\caption{State-based violence}
\label{fig:sub3}
\end{subfigure}
\caption{Types of violence}
\label{fig:test}
\end{figure}
\end{document}