定位表格和图形以适合文本

定位表格和图形以适合文本

我尝试了很多次,但还是无法按照模板的指示将表格和图形放在右侧。我该怎么做才能满足下图所示的所需边距。以下是代码

\documentclass[a4 paper, 11pt,twoside]{article}
\usepackage{fullpage}                           % Makes the page margins smaller to a predefined one.
\usepackage[lmargin=0.6in,rmargin=0.6in,tmargin=0.6in,headsep=.2in]{geometry}
\usepackage{graphicx}
\usepackage{forloop}
%\usepackage{etoolbox}
\usepackage{calc}
\usepackage{wrapfig,lipsum,booktabs} % To produce the empty space on the left
\usepackage{xtab} % To produce the empty space on the left
\usepackage[dvipsnames]{xcolor}
\usepackage[normalem]{ulem}
\usepackage{sectsty}% http://ctan.org/pkg/sectsty
\allsectionsfont{\color{Brown}}
\makeatletter
\def\@seccntformat#1{\@ifundefined{#1@cntformat}%
{\csname the#1\endcsname\;}%  default
{\csname #1@cntformat\endcsname}% individual control
}
\def\section@cntformat{\thesection.\;} % Dot after the section number
\def\subsection@cntformat{\thesubsection.\;} % Dot after the subsection number
\makeatother
\usepackage{hyperref}
\hypersetup{
    colorlinks=true,
    urlcolor=blue,
    linkcolor=black,
    citecolor = black}

\urlstyle{same}
\usepackage{fancyhdr}
\pagestyle{fancy}
%  ---------------   Normal Headers  ------------------
\fancyhf{} % clear all fields
\fancyhead[LE,RO]{\textsf{authorname}}
%\fancyhead[C]{Paper Title: Running Title}
\fancyfoot[LO,RE]{\includegraphics[scale=0.12]{index1.png}}
\fancyfoot[LE,RO]{\thepage}
\renewcommand{\headrulewidth}{1pt} % to remove line on header
\renewcommand{\footrulewidth}{1pt} % to remove line on footer
% ------------------ Header for first page -----------------
\fancypagestyle{first}{%
  \fancyhf{}% clear all header and footer fields
  \fancyhead[L]{\includegraphics[scale=0.8]{index.jpeg}}%
  \fancyfoot[L]{{\footnotesize \textsf{DOI: \href{10.4236/***.2024.*****}{\color{blue}\uline{10.4236/***.2024.*****}} $\;$**** **, 2024}}}%
  \fancyhead[R]{{\bf\small \textsf{Journal of ****, 2024, *, *-*}}\\
\href{http://www.scirp.org/journal/***}{\color{blue}\uline{\textsf{http://www.scirp.org/journal/***}}}\\
\textsf{ISSN Online:****-****}\\
\textsf{ISSN Print:****-****}}%
  \renewcommand{\headrulewidth}{0pt}% to remove line on header
  \renewcommand{\footrulewidth}{0pt}% to remove line on footer
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%% Author Packages %%%%%%%%%%%%%%%%%%%%%
\usepackage{mathtools,amsfonts,amssymb}
\usepackage[caption=false]{subfig}% Support for small, `sub' figures and tables
\usepackage{stmaryrd}
\usepackage{tabularx, multirow,threeparttable}

    \newcolumntype{L}{>{\raggedright\arraybackslash}X >{$\displaystyle}l<{$}}
    \newcolumntype{C}{>{\raggedright\arraybackslash}X >{$\displaystyle}c<{$}}
    
\usepackage[backend=biber,style=apa,citestyle=numeric]{biblatex}
%\usepackage{csquotes}
\makeatletter
\RequireBibliographyStyle{numeric}
\makeatother

\addbibresource{References.bib}

\begin{document}
\thispagestyle{first}
\vspace*{3cm}
%%%%%%%%%  TITLE %%%%%%%%%%%%%%%%%
{\noindent\huge\bf Title}\\[1cm]

%%%%%%%%%%%%%%%%  Author Data %%%%%%%%%%%%%%%%%%%
{\bf\large authorname$^*$}\\[0.5cm]
Email: [email protected]\\

{\bf\large authorname$^*$}\\[0.5cm]
Email: [email protected]\\
$^*$ Affiliations\\         
%%%%%%%%%%%   The Information Bar on the Left %%%%%%%%%%%
\begin{wraptable}{l}{5.1cm}
{\footnotesize
\begin{xtabular*}{0.3\textwidth}{p{5cm}}
\noindent{\bf How to cite this paper:} Author (2024) title, Journal of ***, {\bf *},    *-*.\\
\url{http://dx.doi.org/10.4236/***.2024.*****}\\
{\bf Received: **** **, ***}\\
{\bf Accepted: **** **, ***}\\
{\bf Published: **** **, ***}\\
Copyright \copyright$\;$2024 by author(s) and Scientific Research Publishing Inc.\\
This work is licensed under the Creative Commons Attribution International License (CC BY 4.0).\\
\url{http://creativecommons.org/licenses/by/4.0/}\\
\includegraphics[width=2.5cm,height=0.72cm]{ccby40.png}$\;$\includegraphics[width=2.5cm,height=0.75cm]{openaccess.jpg}\\
%%%%%%%%%%%%%%%%%%% IMPORTANT FOR AUTHORS %%%%%%%%
% Copy and paste the following line depending on the number of full pages in your document (i.e. before using the template)
%{\color{white}\lipsum[1-60]}% If the number of pages is less than 15
{\color{white}\lipsum[1-60]}% uncomment if the number of pages is more than 15 and less than 30
%{\color{white}\lipsum[1-60]}% uncomment if the number of pages is more than 30 and less than 45
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{xtabular*}
}
\end{wraptable}
%%%%%%%%%%%%%%%  The Abstract and Keywords %%%%%%%%%%%%%%%%%%%%%%%%
{\color{Brown}\rule{0.7\textwidth}{2pt}}\\[0.2cm]
{\color{Brown}\bf\large Abstract}\\

the abstract context
\vspace{0.5cm}\\
{\color{Brown}\bf\large Keywords}\\
keywords,bla bla....
\vspace{0cm}\\
{\color{Brown}\rule{0.7\textwidth}{2pt}}
%%%%%%%%%%%%%%%    bodytext   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
bodytext .......
After graduation, Rhimes was an unemployed scriptwriter in Hollywood.[15] To make ends meet, Rhimes worked at a variety of day jobs, including as an office administrator and then a counselor at a job center that taught job skills to people with housing instability and mental illness. During this period, Rhimes worked as research director on the documentary Hank Aaron: Chasing the Dream (1995), which won the 1995 Peabody Award.[15][21] In 1998, Rhimes made a short film, Blossoms and Veils, starring Jada Pinkett-Smith and Jeffrey Wright, which is her only credit as a film director.[15] New Line Cinema purchased a feature script of hers. Rhimes received an assignment to co-write the HBO movie Introducing Dorothy Dandridge (1999), which earned numerous awards for its star, Halle Berry.
\begin{table}
\centering
\caption{Comparison of the performance metrics.}
\begin{tabular}{|l|llll|}
  \hline\noalign{\smallskip}
     Metrics & AMOPSO-SRD & SMOPSO & NSGA-II & SPEA-II\\
  \noalign{\smallskip}\hline\noalign{\smallskip}
    GD  &    0 &     0 &     00 &    0.0 \\
    S   &    0 &     0.0 &   0 &     0 \\
    C(A,B)&        -- &  0000 &  0 &     0. \\
    C(B,A)&        -- & 0000  &  000 &   0.00 \\
  \noalign{\smallskip}\hline
\end{tabular}
\begin{tablenotes}\footnotesize
\item A represents the AMOPSO-SRD; B represents the algorithm in each column.
\end{tablenotes}
\label{tab:schaffer}
\end{table}

\begin{figure}
\centering
\subfloat[Result from SMOPSO and AMOPSO-SRD]{%
\resizebox*{4.5cm}{!}{\includegraphics{Plots_Viennet3_scheme_smopso}}}\hspace{5pt}
 \subfloat[Result from NSGA2 and AMOPSO-SRD]{%
\resizebox*{4.5cm}{!}{\includegraphics{Plots_Viennet3_scheme_nsga2}}}\hspace{5pt}
 \subfloat[Result from SPEA2 and AMOPSO-SRD]{%
\resizebox*{4.5cm}{!}{\includegraphics{Plots_Viennet3_scheme_spea2}}}
\caption{The true Pareto Front and the approximated Pareto fronts for the Viennet(3) test problems.}
\label{fig:viennet3}
\end{figure}

\printbibliography
\addcontentsline{toc}{section}{References}
\end{document} 

在此处输入图片描述

表格和图片必须与正文对齐。图片是在 word office 中完成的,我不知道 latex 中的命令

答案1

对于表格部分,请参见下面的语法变化和生成的输出

在此处输入图片描述

语法已更改

\begin{table}[h!]
    \centering
    \begin{threeparttable}
    \caption{Comparison of the performance metrics.}
    \begin{tabular}{lllll}
        \toprule
        Metrics & AMOPSO-SRD & SMOPSO & NSGA-II & SPEA-II\\
        \midrule
        GD  &    0 &     0 &     00 &    0.0 \\
        S   &    0 &     0.0 &   0 &     0 \\
        C(A,B)&        -- &  0000 &  0 &     0. \\
        C(B,A)&        -- & 0000  &  000 &   0.00 \\
        \bottomrule
    \end{tabular}
    \begin{tablenotes}[para]
        \footnotesize
        A represents the AMOPSO-SRD; B represents the algorithm in each column.
    \end{tablenotes}
    \end{threeparttable}
    \label{tab:schaffer}
\end{table}

相关内容