我正在根据风格指南撰写一些论文集这里。我有两张图片,我想将它们并排放在文章中,但当我这样做时,标题不会换行,而是相互重叠并超出页面的两侧,如下图所示。我知道这是样式指南的问题,因为当我将 MWE 更改为时,标题换行\documentclass{article}
正确。
有人能告诉我为什么会发生这种情况以及如何解决吗?
\documentclass[aPhyssubmission, Phys]{SciPost}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage{float}
\begin{document}
\begin{figure}[H]
\begin{minipage}[t]{0.4\textwidth}
\includegraphics[scale=0.6]{example-image-a}
\label{fig:X17Exclusion}
\centering
\caption{My long caption includes some useless test text and is poorly formatted.}
\end{minipage}
\begin{minipage}[t]{0.4\textwidth}
\includegraphics[scale=0.6]{example-image-a}
\label{fig:PADMEX17Scan}
\caption{My long caption includes some useless test text and is poorly formatted and goes over multiple lines.}
\end{minipage}
\end{figure}
\end{document}
答案1
SciPost
(我在网上找到了一份文件类的副本https://git.scipost.org/scipost/SciPost_LaTeX_Templates_Submission。)
文档SciPost
类会自动加载其他包caption
,并带有(至少对我来说)有点令人惊讶的选项
width=.90\textwidth
这就是您所遇到的与字幕相关的混乱的原因。
minipage
解决办法?假设环境内部环境的宽度figure
设置为0.45\textwidth
,你可以发出指令
\captionsetup{width=0.45\textwidth}
之后立马\begin{figure}
。
\documentclass[aPhyssubmission, Phys]{SciPost}
% This document class loads several packages automatically, including 'caption', 'graphicx', and 'hyperref'
\hypersetup{colorlinks,allcolors=blue} % optional
\begin{document}
\begin{figure}[ht]
\captionsetup{width=0.45\textwidth} % same as width of minipage environments
\begin{minipage}[t]{0.45\textwidth}
\includegraphics[width=\linewidth]{example-image-a}
\caption{This long caption includes some useless test text and is poorly formatted.}
\label{fig:X17Exclusion} % note: \label is placed after \caption
\end{minipage}%
\hfill % maximize separation between the minipages
\begin{minipage}[t]{0.45\textwidth}
\includegraphics[width=\linewidth]{example-image-b}
\caption{This long caption includes some useless test text, is poorly formatted, and goes over multiple lines.}
\label{fig:PADMEX17Scan} % note: \label is placed after \caption
\end{minipage}
\end{figure}
\noindent
Cross-references to figures \ref{fig:X17Exclusion} and \ref{fig:PADMEX17Scan}.
\end{document}