我想将第三张图片居中。以下是代码和结果:
\begin{figure}[h]
\begin{subfigure}{0.6\linewidth}
\includegraphics[width=0.7\textwidth, height=5 cm]{3_8_1_Under-and-Overexposure_Overexposure-Sample.jpg}
\centering
\caption{A sample of Over-exposured Image}
\label{fig:3_8_1}
\centering
\end{subfigure}
\hfill
\begin{subfigure}{0.6\linewidth}
\includegraphics[width=0.7\textwidth, height=5cm]{3_8_2_Under-and-Overexposure_Underexposure-Sample.jpg}
\centering
\caption{A sample of Under-exposured Image}
\label{fig:3_8_2}
\centering
\end{subfigure}
\begin{subfigure}{0.6\linewidth}
\includegraphics[width=0.7\textwidth, height=5cm]{3_8_3_Under-and-Overexposure_Correct-Exposure-Sample-960x640.jpg}
\centering
\caption{A sample of Well-exposured Image}
\label{fig:3_8_3}
\centering
\end{subfigure}
\caption*{Source: https://photographylife.com/underexposure-and-overexposure-in-photography/}
\caption{Samples for Over-exposured, Under-exposured and Well-exposured Images}
\end{figure}
答案1
在您的代码片段中,我删除s\centering
内的所有 s ,在环境的开头subfigure
添加并在最后一个之前插入空行:\centering
figure
subfigure
\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{subcaption}
\begin{document}
\begin{figure}[h]
\centering
\begin{subfigure}{0.48\linewidth}% <-- changed
\includegraphics[width=\linewidth, height=5 cm]{3_8_1_Under-and-Overexposure_Overexposure-Sample}
\caption{A sample of Over-exposured Image}
\label{fig:3_8_1}
\end{subfigure}
\hfil
\begin{subfigure}{0.48\linewidth}
\includegraphics[width=\linewidth, height=5cm]{3_8_2_Under-and-Overexposure_Underexposure-Sample}
\caption{A sample of Under-exposured Image}
\label{fig:3_8_2}
\end{subfigure}
\begin{subfigure}{0.48\linewidth}
\includegraphics[width=\linewidth, height=5cm]{3_8_3_Under-and-Overexposure_Correct-Exposure-Sample-960x640}
\caption{A sample of Well-exposured Image}
\label{fig:3_8_3}
\end{subfigure}
\caption*{Source: https://photographylife.com/underexposure-and-overexposure-in-photography/}
\caption{Samples for Over-exposured, Under-exposured and Well-exposured Images}
\end{figure}
\end{document}
编辑:为了使标题和注释居中\caption*
(我建议将其括在标题中),您需要在序言中添加(如果这在文档中的所有标题中都有效)或仅对此图有效的环境\captionsetup{justification=centering, font=small}
的开头):figure
\documentclass{article}
\usepackage{geometry}
\usepackage[demo]{graphicx}
\usepackage{subcaption}
\usepackage{caption}
\captionsetup{justification=centering, font=small}
\usepackage{url}
\begin{document}
\begin{figure}[h]
\centering
\begin{subfigure}{0.48\linewidth}% <-- changed
\includegraphics[width=\linewidth, height=5 cm]{3_8_1_Under-and-Overexposure_Overexposure-Sample}
\caption{A sample of Over-exposured Image}
\label{fig:3_8_1}
\end{subfigure}
\hfil
\begin{subfigure}{0.48\linewidth}
\includegraphics[width=\linewidth, height=5cm]{3_8_2_Under-and-Overexposure_Underexposure-Sample}
\caption{A sample of Under-exposured Image}
\label{fig:3_8_2}
\end{subfigure}
\medskip
\begin{subfigure}{0.48\linewidth}
\includegraphics[width=\linewidth, height=5cm]{3_8_3_Under-and-Overexposure_Correct-Exposure-Sample-960x640}
\caption{A sample of Well-exposured Image}
\label{fig:3_8_3}
\end{subfigure}
\caption*{}
\caption[Samples for Over-exposured, Under-exposured and Well-exposured Images]
{Samples for Over-exposured, Under-exposured and Well-exposured Images.\\ Source: \url{https://photographylife.com/underexposure-and-overexposure-in-photography/}}
\end{figure}
\end{document}