我一直尝试使用 subcaption 包在 MDPI 文章模板中部署子图,但是每次我尝试部署它时,图形都会与标题重叠
这是我的 tex 文件
\begin{figure}[ht ]
\centering
\begin{subfigure}[t]{0.2\textwidth}
\centering
\includegraphics[height=1.2in]{frog.jpg}
\caption{Subfigure 1}
\end{subfigure}%
~
\begin{subfigure}[t]{0.2\textwidth}
\centering
\includegraphics[height=1.2in]{frog.jpg}
\caption{Subfigure 1}
\end{subfigure}
~
\begin{subfigure}[t]{0.2\textwidth}
\centering
\includegraphics[height=1.2in]{frog.jpg}
\caption{Subfigure 2}
\end{subfigure}
~
\begin{subfigure}[t]{0.2\textwidth}
\centering
\includegraphics[height=1.2in]{frog.jpg}
\caption{Subfigure 3}
\end{subfigure}
~
\begin{subfigure}[t]{0.2\textwidth}
\centering
\includegraphics[height=1.2in]{frog.jpg}
\caption{Subfigure 4}
\end{subfigure}
~
\begin{subfigure}[t]{0.2\textwidth}
\centering
\includegraphics[height=1.2in]{frog.jpg}
\caption{Subfigure 5}
\end{subfigure}
~
\begin{subfigure}[t]{0.2\textwidth}
\centering
\includegraphics[height=1.2in]{frog.jpg}
\caption{Subfigure 6}
\end{subfigure}
~
\begin{subfigure}[t]{0.2\textwidth}
\centering
\includegraphics[height=1.2in]{frog.jpg}
\caption{Subfigure 7}
\end{subfigure}
~
\begin{subfigure}[t]{0.2\textwidth}
\centering
\includegraphics[height=1.2in]{frog.jpg}
\caption{Subfigure 8}
\end{subfigure}
~
\begin{subfigure}[t]{0.2\textwidth}
\centering
\includegraphics[height=1.2in]{frog.jpg}
\caption{Subfigure 9}
\end{subfigure}
\caption{Data Figures\label{dataex}}
\end{figure}```
答案1
我假设您下载了该类mdpi
并将其放在新目录中。它应该有一个文件template.tex
和一个 Definitions 子目录。
该类针对图形mdpi
进行定义 \captionsetup
,但没有针对子图形进行定义。
使用简短的template.tex
、添加包subcaption
并\captionsetup[sub]{...}
使用为图形定义的相同样式,问题就解决了。
代碼[2021/08/26 MDPI 论文课]
% !TeX TS-program = pdflatex
%=================================================================
\documentclass[journal,article,submit,moreauthors,pdftex]{Definitions/mdpi} %[26/08/2021 MDPI paper class]
%=================================================================
\usepackage{subcaption} % added<<<<<<<<<<<
\captionsetup[sub]{position=bottom,
labelfont={bf, small, stretch=1.17},
labelsep=space,
textfont={small, stretch=1.5},
aboveskip=6pt,
belowskip=6pt,
singlelinecheck=off,
justification=justified}
% MDPI internal commands
\firstpage{1}
\makeatletter
\setcounter{page}{\@firstpage}
\makeatother
\pubvolume{1}
\issuenum{1}
\articlenumber{0}
%\doinum{}
\pubyear{2021}
\copyrightyear{2020}
%\externaleditor{Academic Editor: Firstname Lastname} % For journal Automation, please change Academic Editor to "Communicated by"
\datereceived{}
\dateaccepted{}
\datepublished{}
\hreflink{https://doi.org/} % If needed use \linebreak
%------------------------------------------------------------------
% Full title of the paper (Capitalized)
\Title{Title}
% MDPI internal command: Title for citation in the left column
\TitleCitation{Title}
% Author Orchid ID: enter ID or remove command
\newcommand{\orcidauthorA}{0000-0000-0000-000X} % Add \orcidA{} behind the author's name
% Authors, for the paper (add full first names)
\Author{Firstname Lastname $^{1,\dagger,\ddagger}$\orcidA{}, Firstname Lastname $^{1,\ddagger}$ and Firstname Lastname $^{2,}$*}
% MDPI internal command: Authors, for metadata in PDF
\AuthorNames{Firstname Lastname, Firstname Lastname and Firstname Lastname}
% MDPI internal command: Authors, for citation in the left column
\AuthorCitation{Lastname, F.; Lastname, F.; Lastname, F.}
% If this is a Chicago style journal: Lastname, Firstname, Firstname Lastname, and Firstname Lastname.
% Affiliations / Addresses (Add [1] after \address if there is only one affiliation.)
\address{%
$^{1}$ \quad Affiliation 1; [email protected]\\
$^{2}$ \quad Affiliation 2; [email protected]}
% Contact information of the corresponding author
\corres{Correspondence: [email protected]; Tel.: (optional; include country code; if there are multiple corresponding authors, add author initials) +xx-xxxx-xxx-xxxx (F.L.)}
% Current address and/or shared authorship
\firstnote{Current address: Affiliation 3}
\secondnote{These authors contributed equally to this work.}
% Abstract (Do not insert blank lines, i.e. \\)
\abstract{A single paragraph of about 200 words maximum. For research articles, abstracts should give a pertinent overview of the work. We strongly encourage authors to use the following style of structured abstracts, but without headings: (1) Background: place the question addressed in a broad context and highlight the purpose of the study; (2) Methods: describe briefly the main methods or treatments applied; (3) Results: summarize the article's main findings; (4) Conclusion: indicate the main conclusions or interpretations. The abstract should be an objective representation of the article, it must not contain results which are not presented and substantiated in the main text and should not exaggerate the main conclusions.}
% Keywords
\keyword{keyword 1; keyword 2; keyword 3 (List three to ten pertinent keywords specific to the article; yet reasonably common within the subject discipline.)}
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setcounter{section}{-1} %% Remove this when starting to work on the template.
\section{How to Use this Template}
The template details the sections that can be used in a manuscript. Note that the order and names of article sections may differ from the requirements of the journal (e.g., the positioning of the Materials and Methods section). Please check the instructions on the authors' page of the journal to verify the correct order and names. For any questions, please contact the editorial office of the journal or [email protected]. For LaTeX-related questions please contact [email protected].
\section{Introduction}
The introduction should briefly place the study in a broad context and highlight why it is important. It should define the purpose of the work and its significance. The current state of the research field should be reviewed carefully and key publications cited. Please highlight controversial and diverging hypotheses when necessary. Finally, briefly mention the main aim of the work and highlight the principal conclusions. As far as possible, please keep the introduction comprehensible to scientists outside your particular field of research.
\begin{figure}[ht ]
\centering
\begin{subfigure}[t]{0.2\textwidth}
% \centering
\includegraphics[height=1.2in]{example-grid-100x100pt}
\caption{Subfigure 1}
\end{subfigure}%
~
\begin{subfigure}[t]{0.2\textwidth}
% \centering
\includegraphics[height=1.2in]{example-grid-100x100pt}
\caption{Subfigure 2}
\end{subfigure}
~
\begin{subfigure}[t]{0.2\textwidth}
% \centering
\includegraphics[height=1.2in]{example-grid-100x100pt}
\caption{Subfigure 3}
\end{subfigure}
~
\begin{subfigure}[t]{0.2\textwidth}
% \centering
\includegraphics[height=1.2in]{example-grid-100x100pt}
\caption{Subfigure 4}
\end{subfigure}
~
\begin{subfigure}[t]{0.2\textwidth}
% \centering
\includegraphics[height=1.2in]{example-grid-100x100pt}
\caption{Subfigure 5}
\end{subfigure}
~
\begin{subfigure}[t]{0.2\textwidth}
% \centering
\includegraphics[height=1.2in]{example-grid-100x100pt}
\subcaption{Subfigure 6}
\end{subfigure}
~
\begin{subfigure}[t]{0.2\textwidth}
% \centering
\includegraphics[height=1.2in]{example-grid-100x100pt}
\subcaption{Subfigure 7}
\end{subfigure}
~
\begin{subfigure}[t]{0.2\textwidth}
% \centering
\includegraphics[height=1.2in]{example-grid-100x100pt}
\subcaption{Subfigure 8}
\end{subfigure}
~
\begin{subfigure}[t]{0.2\textwidth}
% \centering
\includegraphics[height=1.2in]{example-grid-100x100pt}
\subcaption{Subfigure 9}
\end{subfigure}
~
\begin{subfigure}[t]{0.2\textwidth}
% \centering
\includegraphics[height=1.2in]{example-grid-100x100pt}
\subcaption{Subfigure 10}
\end{subfigure}
\caption{Data Figures For journal Automation, \\ please change Academic Editor to "Communicated by" \label{dataex}}
\end{figure}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{paracol} % needed <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{document}
更新 [20/12/2021 MDPI 论文课]
现在 MDPI 类加载包subfigure
。
得到上图的完整代码是
% !TeX TS-program = pdflatex
%=================================================================
\documentclass[journal,article,submit,moreauthors,pdftex]{Definitions/mdpi} % version [20/12/2021 MDPI paper class] <<<<<<<<<<<<
%=================================================================
% MDPI internal commands
\firstpage{1}
\makeatletter
\setcounter{page}{\@firstpage}
\makeatother
\pubvolume{1}
\issuenum{1}
\articlenumber{0}
%\doinum{}
\pubyear{2021}
\copyrightyear{2020}
%\externaleditor{Academic Editor: Firstname Lastname} % For journal Automation, please change Academic Editor to "Communicated by"
\datereceived{}
\dateaccepted{}
\datepublished{}
\hreflink{https://doi.org/} % If needed use \linebreak
%------------------------------------------------------------------
% Full title of the paper (Capitalized)
\Title{Title}
% MDPI internal command: Title for citation in the left column
\TitleCitation{Title}
% Author Orchid ID: enter ID or remove command
\newcommand{\orcidauthorA}{0000-0000-0000-000X} % Add \orcidA{} behind the author's name
% Authors, for the paper (add full first names)
\Author{Firstname Lastname $^{1,\dagger,\ddagger}$\orcidA{}, Firstname Lastname $^{1,\ddagger}$ and Firstname Lastname $^{2,}$*}
% MDPI internal command: Authors, for metadata in PDF
\AuthorNames{Firstname Lastname, Firstname Lastname and Firstname Lastname}
% MDPI internal command: Authors, for citation in the left column
\AuthorCitation{Lastname, F.; Lastname, F.; Lastname, F.}
% If this is a Chicago style journal: Lastname, Firstname, Firstname Lastname, and Firstname Lastname.
% Affiliations / Addresses (Add [1] after \address if there is only one affiliation.)
\address{%
$^{1}$ \quad Affiliation 1; [email protected]\\
$^{2}$ \quad Affiliation 2; [email protected]}
% Contact information of the corresponding author
\corres{Correspondence: [email protected]; Tel.: (optional; include country code; if there are multiple corresponding authors, add author initials) +xx-xxxx-xxx-xxxx (F.L.)}
% Current address and/or shared authorship
\firstnote{Current address: Affiliation 3}
\secondnote{These authors contributed equally to this work.}
% Abstract (Do not insert blank lines, i.e. \\)
\abstract{A single paragraph of about 200 words maximum. For research articles, abstracts should give a pertinent overview of the work. We strongly encourage authors to use the following style of structured abstracts, but without headings: (1) Background: place the question addressed in a broad context and highlight the purpose of the study; (2) Methods: describe briefly the main methods or treatments applied; (3) Results: summarize the article's main findings; (4) Conclusion: indicate the main conclusions or interpretations. The abstract should be an objective representation of the article, it must not contain results which are not presented and substantiated in the main text and should not exaggerate the main conclusions.}
% Keywords
\keyword{keyword 1; keyword 2; keyword 3 (List three to ten pertinent keywords specific to the article; yet reasonably common within the subject discipline.)}
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setcounter{section}{-1} %% Remove this when starting to work on the template.
\section{How to Use this Template}
The template details the sections that can be used in a manuscript. Note that the order and names of article sections may differ from the requirements of the journal (e.g., the positioning of the Materials and Methods section). Please check the instructions on the authors' page of the journal to verify the correct order and names. For any questions, please contact the editorial office of the journal or [email protected]. For LaTeX-related questions please contact [email protected].
\section{Introduction}
The introduction should briefly place the study in a broad context and highlight why it is important. It should define the purpose of the work and its significance. The current state of the research field should be reviewed carefully and key publications cited. Please highlight controversial and diverging hypotheses when necessary. Finally, briefly mention the main aim of the work and highlight the principal conclusions. As far as possible, please keep the introduction comprehensible to scientists outside your particular field of research.
\begin{figure}%
\centering
\label{fig:first}%
\subfigure[Subfigure 1.\label{fig:firstA}]{\includegraphics[height=1.2in]{example-grid-100x100pt}}%
\hfill
\subfigure[Subfigure 2.\label{fig:firstB}]{\includegraphics[height=1.2in]{example-grid-100x100pt}}%
\hfill
\subfigure[Subfigure 3.\label{fig:firstC}]{\includegraphics[height=1.2in]{example-grid-100x100pt}}%
\par
\subfigure[Subfigure 4.\label{fig:firstD}]{\includegraphics[height=1.2in]{example-grid-100x100pt}}%
\hfill
\subfigure[Subfigure 5.\label{fig:firstE}]{\includegraphics[height=1.2in]{example-grid-100x100pt}}%
\hfill
\subfigure[Subfigure 6.\label{fig:firstF}]{\includegraphics[height=1.2in]{example-grid-100x100pt}}%
\par
\subfigure[Subfigure 7.\label{fig:firstG}]{\includegraphics[height=1.2in]{example-grid-100x100pt}}%
\hfill
\subfigure[Subfigure 8.\label{fig:firstH}]{\includegraphics[height=1.2in]{example-grid-100x100pt}}%
\hfill
\subfigure[Subfigure 9.\label{fig:firstI}]{\includegraphics[height=1.2in]{example-grid-100x100pt}}%
\par
\subfigure[Subfigure 10.\label{fig:firstJ}]{\includegraphics[height=1.2in]{example-grid-100x100pt}}%
\caption{Data Figures For journal Automation, \\ please change Academic Editor to "Communicated by" \label{dataex}}
\end{figure}
\end{document}
答案2
尝试这个。
\begin{figure}[h!]
\begin{adjustwidth}{-\extralength}{0cm}
\centering
\includegraphics[width=17cm]{Definitions/figa.png}\\
(a) Caption of a \\
\vspace{.5cm}
\includegraphics[width=17cm]{Definitions/figb.png}\\
(b) Caption of a \\
\end{adjustwidth}
\caption{Main caption. \label{fig_label}}
\end{figure}