我想模仿以下风格:在相同高度的文本框旁边放置作者图像。
然而,我的尝试却令人感到不安:
看起来我的脸部的纵横比已经改变,并且它与文本框偏移了一行,向下延伸到抽象线。在这里,我试图将图像缩放到文本框的高度,但我实际上想将文本框缩放到图像的高度(不改变纵横比):
\noindent\fbox{%
\parbox{\textwidth}{%
\begin{wrapfigure}{r}{0.2\textwidth}
\begin{center}
\includegraphics[width=0.18\textwidth]{boylan.jpg}
\end{center}
\end{wrapfigure}
\textbf{Lyam K. Boylan} is an undergraduate student studying physics and pure mathematics at the
University of Victoria with primary interests in the set theoretic foundations of the universe.
}%
}
答案1
使用包valign
中定义的指令adjustbox
,并插入文本和图像tabularx
:
\documentclass{article}
\usepackage[export]{adjustbox} % it load graphicx too
\usepackage{tabularx}
\begin{document}
\noindent\begin{tabularx}{\linewidth}{ |X|c @{} }
\cline{1-1}
\textbf{Lyam K. Boylan} is an undergraduate student studying physics and pure mathematics at the \emph{}University of Victoria with primary interests in the set theoretic foundations of the universe.
& \includegraphics[width=0.2\linewidth,valign=t]{example-image-a} \\
\cline{1-1}
\end{tabularx} \\
\begin{tabularx}{\linewidth}{@{} c|X| }
\cline{2-2}
\includegraphics[width=0.2\linewidth,valign=t]{example-image-b}
& \textbf{Lyam K. Boylan} is an undergraduate student studying physics and pure mathematics at the \emph{}University of Victoria with primary interests in the set theoretic foundations of the universe.\\
\cline{2-2}
\end{tabularx}
\end{document}
答案2
一种可能性:\raisebox
\documentclass{article}
\usepackage{graphicx}
\usepackage{wrapfig}
\begin{document}
\noindent\fbox{%
\parbox{\textwidth}{%
\begin{wrapfigure}[4]{r}{0.3\textwidth}
\raisebox{-11mm}[0pt][0pt]{ \includegraphics[width=0.18\textwidth]{example-image}}
\end{wrapfigure}
\textbf{Lyam K. Boylan} is an undergraduate student studying physics and pure mathematics at the
University of Victoria with primary interests in the set theoretic foundations of the universe.
}%
}
\end{document}