我正在写作OSA 通用模板。不幸的是,这些图的名称没有调整。我检查了其他问题,但它们没有帮助。我非常感谢任何帮助。我附上了 latex 文件和我的问题的图片。
\documentclass{optica-article}
\journal{oe}
\articletype{Research Article}
\pdfminorversion=7
% Note that article type is not required for Express journals (OE, BOE, OME and OPTCON)
\usepackage{adjustbox}%,makecell
\usepackage{tabularx}
\usepackage{tabulary}
\usepackage{indentfirst}
\usepackage[caption=false, justification=centerlast]{subfig}
%\usepackage{tabularray}
%\UseTblrLibrary{booktabs}
\usepackage{dcolumn}% Align table columns on decimal point
\usepackage{booktabs}
\usepackage{nicefrac}
\usepackage{etoolbox}
\usepackage{multirow}
\usepackage{textcomp,gensymb}
\usepackage{lineno}
\linenumbers
\setlength{\parindent}{8pt}
\usepackage{amsmath,mathtools}
%\DeclareMathOperator{\cotinv}{cot\,inverse}
\newcommand{\acot}{\cot^{-1}}
%\usepackage{amssymb}
\let\amscases\cases
\begin{document}
\title{ooooo}
%\bigskip
\author{sara,\authormark{1,*}}
\address{\authormark{1}Department\\}
\email{\authormark{*}sara@gmail} %% email address is required
%\medskip
\begin{abstract}
Thhhhhhhhhhhh
\end{abstract}
\section{Introduction}hhhhhhhhh
\begin{figure*}[hbtp]
\centering
\setkeys{Gin}{width=0.25\textwidth}
\subfloat[\label{subfig2as}]{\includegraphics{example-image-a}}
\hfill
\subfloat[\label{subfig2bs}]{\includegraphics{example-image-b}}
\hfill
\subfloat[\label{subfig2cs}]{\includegraphics{example-image-c}}
\hfill
\subfloat[\label{subfig2ds}]{\includegraphics{example-image-a}}
\caption{fffffffffff}
\label{lockingrange}
\end{figure*}
\end{document}
答案1
以下是基于\subcaptionbox
以下是基于的副标题包裹:
\documentclass{article}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage{kantlipsum}
\begin{document}
\kant[1][1]
\begin{figure}[tbh]
\centering
\subcaptionbox{Sub 1\label{fig:subcaption1}}[0.25\linewidth]{%
\includegraphics[width=\linewidth]{example-image}}%
\subcaptionbox{Sub 2\label{fig:subcaption2}}[0.25\linewidth]{%
\includegraphics[width=\linewidth]{example-image}}%
\subcaptionbox{Sub 3\label{fig:subcaption3}}[0.25\linewidth]{%
\includegraphics[width=\linewidth]{example-image}}%
\subcaptionbox{Sub 4\label{fig:subcaption4}}[0.25\linewidth]{%
\includegraphics[width=\linewidth]{example-image}}%
\caption{The main caption}
\end{figure}
\kant[1][2]
\end{document}
或者,您可以手动排列图像minipage
并将所有内容包装起来,以subcaptionblock
将每个\caption
内部图像变成子标题。
在下面的代码中,我还应用了\adjustboxset{width=\linewidth}
,它会自动将其选项(此处)插入width
到每个选项中\includegraphics
以避免重复。它需要使用adjustbox
选项加载[Export]
。
替代方法的片段
\begin{figure}[tbh]
\adjustboxset{width=\linewidth} % Requires: \usepackage[Export]{adjustbox}
\begin{subcaptionblock}{\linewidth}
\centering
\begin{minipage}[t]{0.25\linewidth}
\includegraphics{example-image}
\caption{Sub 1}
\label{fig:subcaption1}
\end{minipage}%
\begin{minipage}[t]{0.25\linewidth}
\includegraphics{example-image}
\caption{Sub 2}
\label{fig:subcaption2}
\end{minipage}%
\begin{minipage}[t]{0.25\linewidth}
\includegraphics{example-image}
\caption{Sub 3}
\label{fig:subcaption3}
\end{minipage}%
\begin{minipage}[t]{0.25\linewidth}
\includegraphics{example-image}
\caption{Sub 4}
\label{fig:subcaption4}
\end{minipage}
\end{subcaptionblock}
\caption{Another main caption}
\end{figure}
答案2
subcaption
从版本 1.3 开始的软件包\subfloat
环境也从软件包中已知subfig
。如果Gin
使用键,您的问题也可以通过以下简洁的代码解决:
\documentclass{article}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage{kantlipsum}
\begin{document}
\kant[1][1]
\begin{figure}[tbh]
\centering
\setkeys{Gin}{width=0.25\textwidth}
\subfloat[Sub 1 \label{fig:subcaption1}]{\includegraphics{example-image}}%
\subfloat[Sub 2 \label{fig:subcaption2}]{\includegraphics{example-image}}%
\subfloat[Sub 3 \label{fig:subcaption3}]{\includegraphics{example-image}}%
\subfloat[Sub 4 \label{fig:subcaption4}]{\includegraphics{example-image}}
\caption{The main caption}
\end{figure}
\kant[1][2]
\end{document}