子图标题未居中

子图标题未居中

无法将子图中的标题居中。我尝试了一下标题和子标题包,似乎子图标题被视为普通标题。例如,当我添加\usepackage[font=bf]{caption}到序言时,所有子标题都加粗,而不仅仅是主标题。如果我向 中添加任何选项\usepackage{subcaption},它们都不会对任何东西产生任何影响。这是我现在正在做的事情:

\documentclass[12pt]{article}

\usepackage{mathptmx}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage[margin=0.9in]{geometry}
\usepackage{gensymb}
\usepackage{subcaption}
\usepackage{adjustbox}

\begin{document}

Petroporphyrins, as shown in Figure \ref{fig:porphyrinexamples}, are constituted of four cyclically-bonded pyrroles with various aliphatic, cylcic, and aromatic moieties. The nitrogen of each pyrrole is oriented to the center of the porphyrin, which is where the nickel or vanadium, in the form of vanadium (IV) oxide, coordinates.

\begin{figure}
\begin{adjustbox}{varwidth=\textwidth,fbox,center}
  \centering
\begin{subfigure}{.45\textwidth}
  \centering
  \includegraphics[width=.5\linewidth]{Porphyrin.png}
  \caption{Unsubstituted Demetalated Porphyrin}
  \label{fig:porphyrin}
\end{subfigure}
\begin{subfigure}{.45\textwidth}
  \centering
  \includegraphics[width=.5\linewidth]{VPorphyrin.png}
  \caption{Unsubstituted Vanadyl Porphyrin}
  \label{fig:vporphyrin}
\end{subfigure}
\\
\vspace{18pt}
\begin{subfigure}{.45\textwidth}
  \centering
  \includegraphics[width=.5\linewidth]{VDPEP.png}
  \caption{Vanadyl DPEP}
  \label{fig:vdpep}
\end{subfigure}
\begin{subfigure}{.45\textwidth}
  \centering
  \includegraphics[width=.5\linewidth]{VEtio.png}
  \caption{Vanadyl Etioporphyrin}
  \label{fig:vetio}
\end{subfigure}
\\
\vspace{18pt}
\begin{subfigure}{.45\textwidth}
  \centering
  \includegraphics[width=.5\linewidth]{VBenzoEtio.png}
  \caption{Vanadyl Benzoetioporphyrin}
  \label{fig:vbenzoetio}
\end{subfigure}
\begin{subfigure}{.45\textwidth}
  \centering
  \includegraphics[width=.5\linewidth]{VTHBEtio.png}
  \caption{Vanadyl Tetrahydrobenzoetioporphyrin}
  \label{fig:vthbetio}
\end{subfigure}
\end{adjustbox}
\caption{Several Basic Petroporphyrin Configurations}
\label{fig:porphyrinexamples}
\end{figure}

\end{document}

答案1

在此处输入图片描述

问题出在adjustbox;如果将其替换为被minipage包围的\fbox,则子标题将再次居中:

\documentclass[12pt]{article}
\usepackage{mathptmx}
\usepackage{amsmath}
\usepackage[demo]{graphicx}
\usepackage[margin=0.9in]{geometry}
\usepackage{gensymb}
\usepackage{subcaption}
\usepackage{adjustbox}

\captionsetup[figure]{font=bf}
\captionsetup[subfigure]{font=rm}

\begin{document}

Petroporphyrins, as shown in Figure \ref{fig:porphyrinexamples}, are constituted of four cyclically-bonded pyrroles with various aliphatic, cylcic, and aromatic moieties. The nitrogen of each pyrrole is oriented to the center of the porphyrin, which is where the nickel or vanadium, in the form of vanadium (IV) oxide, coordinates.

\begin{figure}
\fbox{\begin{minipage}{\dimexpr\textwidth-2\fboxsep-2\fboxrule\relax}
\centering
\begin{subfigure}{.45\textwidth}
  \centering
  \includegraphics[width=.5\linewidth]{Porphyrin.png}
  \caption{Unsubstituted Demetalated Porphyrin}
  \label{fig:porphyrin}
\end{subfigure}%
\begin{subfigure}{.45\textwidth}
  \centering
  \includegraphics[width=.5\linewidth]{VPorphyrin.png}
  \caption{Unsubstituted Vanadyl Porphyrin}
  \label{fig:vporphyrin}
\end{subfigure}
\\
\vspace{18pt}
\begin{subfigure}{.45\textwidth}
  \centering
  \includegraphics[width=.5\linewidth]{VDPEP.png}
  \caption{Vanadyl DPEP}
  \label{fig:vdpep}
\end{subfigure}%
\begin{subfigure}{.45\textwidth}
  \centering
  \includegraphics[width=.5\linewidth]{VEtio.png}
  \caption{Vanadyl Etioporphyrin}
  \label{fig:vetio}
\end{subfigure}
\\
\vspace{18pt}
\begin{subfigure}{.45\textwidth}
  \centering
  \includegraphics[width=.5\linewidth]{VBenzoEtio.png}
  \caption{Vanadyl Benzoetioporphyrin}
  \label{fig:vbenzoetio}
\end{subfigure}%
\begin{subfigure}{.45\textwidth}
  \centering
  \includegraphics[width=.5\linewidth]{VTHBEtio.png}
  \caption{Vanadyl Tetrahydrobenzoetioporphyrin}
  \label{fig:vthbetio}
\end{subfigure}
\end{minipage}}
\caption{Several Basic Petroporphyrin Configurations}
\label{fig:porphyrinexamples}
\end{figure}

\end{document}

关于第二个问题,您可以使用可选参数来对\captionsetup图形和子图形进行不同的格式设置;在我的示例代码中,我使用了

\captionsetup[figure]{font=bf}
\captionsetup[subfigure]{font=rm}

仅用于说明目的。

选项demo只是graphicx用黑色矩形替换实际图形;不是在实际文档中使用该选项。

相关内容