如何在 LaTeX 中将图形放置在文本旁边?

如何在 LaTeX 中将图形放置在文本旁边?

以下是代码:

\documentclass{article}
\author{Youssef Amr Abd El-Moneim}
\title{\textbf{IYMC qualification round answers}}
\usepackage{amsmath}
\usepackage{float}
\usepackage{graphicx}
\usepackage[export]{adjustbox}
\date{}
\begin{document}
    \maketitle
    \begin{figure}[H]
        \centering
        \includegraphics[scale=0.5, right]{IYMC}
    \end{figure}
\end{document}

我想让图形(IYMC)正好位于标题和作者文本的旁边,如下图所示: 在此处输入图片描述

不管怎么说,还是要谢谢你

答案1

\maketitle和都figure尽量占据整个列。你可以把 放在\maketitle里面minipage,但不能figure。但由于没有标题,所以你不需要figure

主要问题是如何协调两者。

\documentclass{article}
\author{Youssef Amr Abd El-Moneim}
\title{\textbf{IYMC qualification round answers}}
\usepackage{amsmath}
%\usepackage{float}% Friends don't let friends use [H]
\usepackage{graphicx}
\usepackage[export]{adjustbox}
\date{}
\begin{document}
  \noindent\begin{minipage}[c]{0.7\textwidth}
    \maketitle
  \end{minipage}\hfill
  \raisebox{-0.5\height}{\includegraphics[width=0.25\textwidth]{example-image}}% align centers
  
  Document resumes with new paragraph.
\end{document}

答案2

在此处输入图片描述

\documentclass{article}
\usepackage[showframe]{geometry}
\author{Youssef Amr Abd El-Moneim}
\title{\textbf{IYMC qualification round answers}}
\usepackage{amsmath,array}
\usepackage{float}
\usepackage[demo]{graphicx}
\usepackage[export]{adjustbox}
\date{}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}

\begin{document}\noindent
    \begin{tabular}{C{11cm}L{3.5cm}}
    {\footnotesize\maketitle} & \raisebox{-3\baselineskip}{\includegraphics[width=\linewidth]{example-image-a}} 
    \end{tabular}
    
\end{document}

相关内容