![如何将每个子图的标签设置在正确的位置?](https://linux22.com/image/441355/%E5%A6%82%E4%BD%95%E5%B0%86%E6%AF%8F%E4%B8%AA%E5%AD%90%E5%9B%BE%E7%9A%84%E6%A0%87%E7%AD%BE%E8%AE%BE%E7%BD%AE%E5%9C%A8%E6%AD%A3%E7%A1%AE%E7%9A%84%E4%BD%8D%E7%BD%AE%EF%BC%9F.png)
我想将每个子图的标签插入到正确的位置。
因此,我希望子图的标签与图 2 相同,标题的位置与图 1 相同(不要改变)。
笔记:
\documentclass[smallextended]{svjour3}
用来。- 我之前问过这个问题,但还没能解决,这个关联。
代码:
\documentclass[smallextended]{svjour3} % onecolumn (second format)
%\documentclass[twocolumn]{svjour3} % twocolumn
%
\usepackage{amsmath}
\usepackage{graphicx}
\graphicspath{ {./figures/} }
\usepackage[caption=false]{subfig}
\usepackage[colorlinks,allcolors=blue]{hyperref}
%\usepackage{float}
\usepackage{verbatim} %comments
\usepackage{lipsum,capt-of,graphicx}
\usepackage[a4paper, margin=2.5cm]{geometry}
\usepackage[numbers,sort&compress]{natbib}
\let\printorcid\relax
\usepackage[labelfont=bf,justification=raggedright,singlelinecheck=false, font={footnotesize}]{caption}
\captionsetup[figure]{name=Fig. ,labelsep=period, justification=justified, singlelinecheck=off}
\captionsetup[table]{labelsep=newline,font=footnotesize, justification=justified, singlelinecheck=off}%,skip=0pt,belowskip=0pt}
%\setlength\abovecaptionskip{-5pt}
%\setlength{\heavyrulewidth}{3\lightrulewidth}
\usepackage{subcaption}
\usepackage{setspace}
\usepackage{etoolbox}
\AtBeginEnvironment{table}{\sffamily}
\usepackage{booktabs,siunitx, multirow}
%\sisetup{table-format=1.4, tight-spacing=true, % separate-uncertainty}
\sisetup{separate-uncertainty}
\sisetup{
output-exponent-marker = \text{e},
exponent-product={},
retain-explicit-plus,
input-open-uncertainty = ,
input-close-uncertainty = ,
table-align-text-pre = false,
table-align-text-post = false,
round-mode=places,
round-precision=2,
table-space-text-pre = (,
table-space-text-post = ),
}
\usepackage{amsmath}
\usepackage{adjustbox}
\usepackage{floatrow}
\floatsetup[table]{capposition=top}
\floatsetup[table]{captionskip=0.1pt}
\usepackage{array, cellspace}
\setlength\cellspacetoplimit{3pt}
\setlength\cellspacebottomlimit{3pt}
\usepackage{placeins}
\bibliographystyle{elsarticle-num}
%\bibliographystyle{spmpsci}
%\biboptions{sort&compress}
%\usepackage{xurl} % allow arbitrary line breaks in URL strings
%% These two lines are needed to get the correct paper size
%% in TeX Live 2016
\usepackage[misc]{ifsym}
\setlength\emergencystretch{3em}
\usepackage{microtype}
%
\begin{document}
\begin{figure*}
\subfloat[]{\label{main:a}\includegraphics[clip, trim=0cm 1cm 1cm 0.8cm, width=.4\textwidth,height=4cm]{example-image-a}}\quad
\subfloat[]{\label{main:b}\includegraphics[clip, trim=1cm 1cm 1cm 0.8cm, width=.4\textwidth,height=4cm]{example-image-b}}
\medskip
\subfloat[]\par
\floatbox[{\capbeside\thisfloatsetup{capbesideposition={right,bottom},capbesidewidth=6cm}}]{figure}
{\caption{Caption is here.}
\label{fig2: neighborhood}}
{\label{main:c}\includegraphics[clip, trim=1cm 1cm 0.8cm 0.8cm, width=.4\textwidth,height=4cm]{example-image-c}}
\end{figure*}
\end{document}
附加信息:
根据我的代码,问题是由于\usepackage[caption=false]{subfig}
和 的设置造成的[clip, trim=0cm 1cm 1cm 0.8cm]
。尽管标签的位置仍然不够好!
第一个解决方案:
\documentclass[smallextended]{svjour3} % onecolumn (second format)
%\documentclass[twocolumn]{svjour3} % twocolumn
%
\usepackage{amsmath}
\usepackage{graphicx}
\graphicspath{ {./figures/} }
%\usepackage[caption=false]{subfig}
\usepackage[colorlinks,allcolors=blue]{hyperref}
%\usepackage{float}
\usepackage{verbatim} %comments
\usepackage{lipsum,capt-of,graphicx}
\usepackage[a4paper, margin=2.5cm]{geometry}
\usepackage[numbers,sort&compress]{natbib}
\let\printorcid\relax
\usepackage[labelfont=bf,justification=raggedright,singlelinecheck=false, font={footnotesize}]{caption}
\captionsetup[figure]{name=Fig. ,labelsep=period, justification=justified, singlelinecheck=off}
\captionsetup[table]{labelsep=newline,font=footnotesize, justification=justified, singlelinecheck=off}%,skip=0pt,belowskip=0pt}
%\setlength\abovecaptionskip{-5pt}
%\setlength{\heavyrulewidth}{3\lightrulewidth}
\usepackage{subcaption}
\usepackage{setspace}
\usepackage{etoolbox}
\AtBeginEnvironment{table}{\sffamily}
\usepackage{booktabs,siunitx, multirow}
%\sisetup{table-format=1.4, tight-spacing=true, % separate-uncertainty}
\sisetup{separate-uncertainty}
\sisetup{
output-exponent-marker = \text{e},
exponent-product={},
retain-explicit-plus,
input-open-uncertainty = ,
input-close-uncertainty = ,
table-align-text-pre = false,
table-align-text-post = false,
round-mode=places,
round-precision=2,
table-space-text-pre = (,
table-space-text-post = ),
}
\usepackage{amsmath}
\usepackage{adjustbox}
\usepackage{floatrow}
\floatsetup[table]{capposition=top}
\floatsetup[table]{captionskip=0.1pt}
\usepackage{array, cellspace}
\setlength\cellspacetoplimit{3pt}
\setlength\cellspacebottomlimit{3pt}
\usepackage{placeins}
\bibliographystyle{elsarticle-num}
%\bibliographystyle{spmpsci}
%\biboptions{sort&compress}
%\usepackage{xurl} % allow arbitrary line breaks in URL strings
%% These two lines are needed to get the correct paper size
%% in TeX Live 2016
\usepackage[misc]{ifsym}
\setlength\emergencystretch{3em}
\usepackage{microtype}
%
\begin{document}
\begin{figure*}
\subfloat[]{\label{main:a}\includegraphics[clip, trim=0cm 1cm 1cm 0.8cm, width=.48\textwidth,height=5cm]{example-image-a}}\quad
\subfloat[]{\label{main:b}\includegraphics[clip, trim=0cm 1cm 1cm 0.8cm, width=.48\textwidth,height=5cm]{example-image-b}}
\medskip
\subfloat[]\par
\floatbox[{\capbeside\thisfloatsetup{capbesideposition={right,bottom},capbesidewidth=6cm}}]{figure}
{\caption{Caption is here.}
\label{fig2: neighborhood}}
{\label{main:c}\includegraphics[clip, trim=0cm 1cm 1cm 0.8cm, width=.48\textwidth,height=5cm]{example-image-c}}
\end{figure*}
\end{document}
第二种解决方案:
\documentclass[smallextended]{svjour3} % onecolumn (second format)
%\documentclass[twocolumn]{svjour3} % twocolumn
%
\usepackage{amsmath}
\usepackage{graphicx}
\graphicspath{ {./figures/} }
%\usepackage[caption=false]{subfig}
\usepackage[colorlinks,allcolors=blue]{hyperref}
%\usepackage{float}
\usepackage{verbatim} %comments
\usepackage{lipsum,capt-of,graphicx}
\usepackage[a4paper, margin=2.5cm]{geometry}
\usepackage[numbers,sort&compress]{natbib}
\let\printorcid\relax
\usepackage[labelfont=bf,justification=raggedright,singlelinecheck=false, font={footnotesize}]{caption}
\captionsetup[figure]{name=Fig. ,labelsep=period, justification=justified, singlelinecheck=off}
\captionsetup[table]{labelsep=newline,font=footnotesize, justification=justified, singlelinecheck=off}%,skip=0pt,belowskip=0pt}
%\setlength\abovecaptionskip{-5pt}
%\setlength{\heavyrulewidth}{3\lightrulewidth}
\usepackage{subcaption}
\usepackage{setspace}
\usepackage{etoolbox}
\AtBeginEnvironment{table}{\sffamily}
\usepackage{booktabs,siunitx, multirow}
%\sisetup{table-format=1.4, tight-spacing=true, % separate-uncertainty}
\sisetup{separate-uncertainty}
\sisetup{
output-exponent-marker = \text{e},
exponent-product={},
retain-explicit-plus,
input-open-uncertainty = ,
input-close-uncertainty = ,
table-align-text-pre = false,
table-align-text-post = false,
round-mode=places,
round-precision=2,
table-space-text-pre = (,
table-space-text-post = ),
}
\usepackage{amsmath}
\usepackage{adjustbox}
\usepackage{floatrow}
\floatsetup[table]{capposition=top}
\floatsetup[table]{captionskip=0.1pt}
\usepackage{array, cellspace}
\setlength\cellspacetoplimit{3pt}
\setlength\cellspacebottomlimit{3pt}
\usepackage{placeins}
\bibliographystyle{elsarticle-num}
%\bibliographystyle{spmpsci}
%\biboptions{sort&compress}
%\usepackage{xurl} % allow arbitrary line breaks in URL strings
%% These two lines are needed to get the correct paper size
%% in TeX Live 2016
\usepackage[misc]{ifsym}
\setlength\emergencystretch{3em}
\usepackage{microtype}
%
\begin{document}
\begin{figure}
\subfloat[]{\label{main:a}\includegraphics[clip, trim=0cm 1cm 1cm 0.8cm, width=.48\textwidth,height=5cm]{example-image-a}}\quad
\subfloat[]{\label{main:b}\includegraphics[clip, trim=0cm 1cm 1cm 0.8cm, width=.48\textwidth,height=5cm]{example-image-b}}
\medskip
\subfloat[]\par
\floatbox[{\capbeside\thisfloatsetup{capbesideposition={right,bottom},capbesidewidth=7.3cm}}]{figure}
{\caption{Caption text}\label{fig:test}}
{\label{main:e}\includegraphics[clip, trim=0cm 1cm 1cm 0.8cm, width=.48\textwidth,height=5cm]{example-image-c}}
\end{figure}
\end{document}
答案1
太渴望评论了-:(
首先让我复制解决方案@John Kormylo在您之前的一个问题上,并将其采用到三个子图,并稍微修改了主标题的对齐方式,旨在用于elsarticle
文档类:
\documentclass[review]{elsarticle}
\usepackage[font=footnotesize, labelfont=bf,
justification=raggedright,
singlelinecheck=false,
]{caption}
\captionsetup[figure]{name=Fig. ,labelsep=period}
\captionsetup[table]{labelsep=newline}%,skip=0pt,belowskip=0pt}
%\usepackage[caption=false]{subfig} % don't load it when is used subcaption
\usepackage{subcaption}
\usepackage{graphicx}
\graphicspath{ {./figures/} }
% insert here left out part of your preamble
% before doing this, check, if you really need all heir package,
% setups and definitions; please cleanup it
\usepackage{hyperref}
\usepackage{geometry}
\begin{document}
\begin{figure}
\setkeys{Gin}{width=.48\textwidth,height=5cm}
\subfloat[]{\label{main:a}\includegraphics{example-image-a}}\hfill%
\subfloat[]{\label{main:b}\includegraphics{example-image-b}}
\medskip
\subfloat[]{\label{main:c}\includegraphics{example-image-c}}\quad
\begin{minipage}[b]{.48\textwidth}
\captionsetup{skip=0pt}
\caption{Caption text}
\label{fig:test}
\end{minipage}
\end{figure}
\end{document}
它运行良好并给出以下结果:
如果你将上面的 MWE 的第一行替换为
\documentclass[smallextended]{svjour3}
如您所见,上面的 MWE 省略了大部分序言。我建议您按照 MWE 中注释所示位置的分步方式添加它。
所以我想知道,你的问题是什么。将副标题移到太阳图像的左侧?
答案2
除了subcaption
和不兼容之外,所依赖的subfig
包也与不兼容。caption
subcaption
svjour3
Package caption Warning: Unknown document class (or package),
(caption) standard defaults will be used.
See the caption package documentation for explanation.
这是一个生成您想要的东西的简单方法,无需floatrow
。
\documentclass[smallextended]{svjour3} % onecolumn (second format)
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage[caption=false]{subfig}
\begin{document}
\begin{figure*}
\centering
\subfloat[]{\label{main:a}\includegraphics[
clip, trim=0cm 1cm 1cm 0.8cm, width=.4\textwidth,height=4cm
]{example-image-a}}\quad
\subfloat[]{\label{main:b}\includegraphics[
clip, trim=1cm 1cm 1cm 0.8cm, width=.4\textwidth,height=4cm
]{example-image-b}}
\medskip
\subfloat[]{\label{main:c}\includegraphics[
clip, trim=1cm 1cm 0.8cm 0.8cm, width=.4\textwidth,height=4cm
]{example-image-c}}\quad
\begin{minipage}[b]{0.4\textwidth}
\caption{Caption is here.\label{fig2: neighborhood}}
\end{minipage}
\end{figure*}
\end{document}
我们利用由 生成的框\subfloat
在图像底部具有参考点这一事实,因此底部对齐minipage
就可以达到目的。