右对齐标题,左侧有图片

右对齐标题,左侧有图片

我想要制作一个遵循以下结构的标题:

\documentclass[12pt]{article}

\usepackage[pass,showframe]{geometry}% just to show the page margins

\usepackage[demo]{graphicx}% remove demo option in actual document

\begin{document}
\noindent\begin{minipage}{0.3\textwidth}% adapt widths of minipages to your needs
\includegraphics[width=\linewidth]{yourimage}
\end{minipage}%
\hfill%
\begin{minipage}{0.6\textwidth}\raggedleft
Yesterday,\\
all my troubles seemed so far away\\
Now it looks as though they're here to stay\\
Oh, I believe in yesterday.
\end{minipage}
\end{document} 

在此处输入图片描述

(代码在这里找到如何将图片放在右对齐文本的左侧

也就是说,文本\title将右对齐,并且文本左侧将有一张图片

这怎么可能呢?

答案1

我已更新答案。

输出

\documentclass[12pt]{article}
\usepackage[pass,showframe]{geometry}% just to show the page margins
\usepackage[demo]{graphicx}
\usepackage{adjustbox}

\begin{document}
    \title{Paper Title}
    \author{Your name}
    \date{\today}
    \noindent\adjustbox{valign = t}{%
    \includegraphics[width = 0.3\textwidth, height = 3in]{yourimage}}\hfill%Image
    \begin{minipage}[t]{0.6\textwidth}\raggedleft
        Yesterday,\\
        all my troubles seemed so far away\\
        Now it looks as though they're here to stay\\
        Oh, I believe in yesterday.\\        
        \begingroup
        \let\center\flushright
        \maketitle
        \endgroup
    \end{minipage}\\
    Stuff stuff stuff...
\end{document}

答案2

姆韦

\documentclass[12pt]{article}
\usepackage{graphicx,lipsum}

\makeatletter         
\def\@maketitle{
\noindent\begin{minipage}{0.3\textwidth}
\includegraphics[width=\linewidth]{example-image-duck}
\end{minipage}%
\hfill\begin{minipage}{0.69\textwidth}
\raggedleft{\bfseries\@title}\par\medskip(\@author,
\@date)\end{minipage}\vspace{3em}}
\makeatother

\begin{document}

\title{Yesterday,\\
all my troubles seemed so far away.\\
Now it looks as though they're here to stay\\
Oh, I believe in yesterday.}

\author{The Beatles}

\date{1965}

\maketitle

\lipsum[1-2]

\end{document} 

答案3

好的,只需将你写的内容包装在\title{..}命令中即可。这是您想要的吗?

\documentclass[12pt]{article}
\usepackage[pass,showframe]{geometry}% just to show the page margins
\usepackage[demo]{graphicx}% remove demo option in actual document

\begin{document}

\title{\begin{minipage}{0.3\textwidth}% adapt widths of minipages to your needs
\includegraphics[width=\linewidth]{yourimage}
\end{minipage}%
\hfill%
\begin{minipage}{0.6\textwidth}\raggedleft
Yesterday,\\
all my troubles seemed so far away\\
Now it looks as though they're here to stay\\
Oh, I believe in yesterday.
\end{minipage}}
\date{}
\author{}
\maketitle

\end{document} 

相关内容