如何在 elsarticle latex 模板中的图形前添加顶部边距

如何在 elsarticle latex 模板中的图形前添加顶部边距

我添加了一个包含 3 个子图的图。问题是,当我将图放在顶部时,它不会留下顶部边距,如果我将其放在底部,它会与文本重叠,从而隐藏段落

我的问题是如何在这个特定页面的顶部添加默认边距?

\begin{figure*}
\subfloat{\includegraphics[width = 0.35in ]{BM25-fr-snag.png}} 
\hspace*{4.5cm} 
\subfloat{\includegraphics[width = 0.35in]{LM-french3.png}}
\hspace*{4.5cm} 
\subfloat{\includegraphics[width = 0.35in]{PL2-snag3.png}}\\

\caption{Recall-Precision curves comparison for the French dataset. }
\label{graph-fr}
\end{figure*}

我的第二个问题是如何避免底部的文本重叠

答案1

这是一个不应该发生的问题。所以问题出在你代码的其他地方。

将您的三幅.png图像替换为,example-image看看是否与图像相关。

您可以随时添加垂直空间(例如\vspace*{<xx>pt})来纠正它。

figure*两栏会将图形发送到新页面(一栏)。如果要将其与文本一起保留,请在\onecolumn之前发出一个,以将图形和文本一起放在新页面中。

使用来自的 overleaf 模板https://www.sharelatex.com/templates/journals/elsevier

这是正常行为:

C

添加垂直空间后:

A

b

\documentclass[final,5p,times,twocolumn]{elsarticle}

\usepackage{subfig}% added <<<<<

\usepackage{showframe}% margins
\usepackage{kantlipsum}% dummy text

\journal{Nuclear Physics B}
\begin{document}
    
\begin{frontmatter}
    
\title{Title of Your Manuscript}
\author[inst1]{Author One}
\affiliation[inst1]{organization={Department One},%Department and Organization
            addressline={Address One}, 
            city={City One},
            postcode={00000}, 
            state={State One},
            country={Country One}}
\begin{abstract}
\kant[9]
\end{abstract}

\end{frontmatter}

%% main text
\section{Sample Section 1}
\label{sec:sample1}

1. \kant[2-4]
\begin{figure}[hp!] 
    \centering              
    \vspace*{25pt}% added <<<<<
    \subfloat{\includegraphics[width = 0.35in ]{example-image-c}} 
    \hfill 
    \subfloat{\includegraphics[width = 0.35in]{example-image-c}}
    \hfill 
    \subfloat{\includegraphics[width = 0.35in]{example-image-c}}    
    \caption{Recall-Precision curves comparison for the French dataset. }
    \label{graph-fr1}
\end{figure} 

\onecolumn %<<<<<<<<<<<<<<<<
\section{Sample  Section 2}

2. \kant[9]

\begin{figure*} % goes to the top of the page
    \centering              
    \vspace*{25pt}% added <<<<<
    \subfloat{\includegraphics[width = 0.35in ]{example-image-a}} 
    \hspace*{4.5cm} 
    \subfloat{\includegraphics[width = 0.35in]{example-image-a}}
    \hspace*{4.5cm} 
    \subfloat{\includegraphics[width = 0.35in]{example-image-a}}
    \caption{Recall-Precision curves comparison for the French dataset. }
    \label{graph-fr2}
\end{figure*} 

\begin{figure*}[hp!]    % after the text
    \centering              
    \vspace*{25pt}% added <<<<<
    \subfloat{\includegraphics[width = 0.35in ]{example-image-b}} 
    \hspace*{4.5cm} 
    \subfloat{\includegraphics[width = 0.35in]{example-image-b}}
    \hspace*{4.5cm} 
    \subfloat{\includegraphics[width = 0.35in]{example-image-b}}
    \caption{Recall-Precision curves comparison for the French dataset. }
    \label{graph-fr3}
\end{figure*} 

\end{document}

相关内容