请问我怎样才能将文本和图像并排放置,就像所附图片所示,其中图像位于文本块的中央?
我尝试了这个wrapfigure
包,但它没有给出预期的结果。这是我的代码:
\begin{wrapfigure}{l}{0.15\textwidth}
\includegraphics[height=2cm,width=0.9\linewidth]{figures/engineer}
\caption*{Ben}
\end{wrapfigure}
\textbf{Ben} is a technician working for the Ministry of Defense. He was asked to prepare 300 multi-purpose tents (MPT II) for a mission in Mali. Ben is a prudent person. The climate in Mali is extremely hot. Ben does not want to provide an oversized system because he does not want to give the soldiers the opportunity to set too low temperature in the tents in order to prevent health problems caused by the temperature shock. Moreover, oversized systems make noise and consume more fuel. Larger fuel consumption causes additional costs and the need to refill the fuel tank more often, which is not convenient. Ben wants to size the HVAC system properly so that there are no complaints and the soldiers’ health is protected. Also, he wants to convince the soldiers to install shading so that the cooling demand and fuel consumption is decreased.
这是预期的显示效果:
目前的情况如下:
答案1
我希望使用minipage
环境能够让您满意,以下是我得到的:
\documentclass[12pt, a4paper]{book}
\usepackage[margin=2cm]{geometry}
\usepackage{graphicx}
\begin{document}
\begin{minipage}[C]{0.25\linewidth}
\begin{flushleft}
\includegraphics[scale=0.05]{Ben.png}
\end{flushleft}
\end{minipage}
\begin{minipage}[C]{0.75\linewidth}
\textbf{Ben} is a technician working for the Ministry of Defense. He was asked to prepare 300 multi-purpose tents (MPT II) for a mission in Mali. Ben is a prudent person. The climate in Mali is extremely hot. Ben does not want to provide an oversized system because he does not want to give the soldiers the opportunity to set too low temperature in the tents in order to prevent health problems caused by the temperature shock. Moreover, oversized systems make noise and consume more fuel. Larger fuel consumption causes additional costs and the need to refill the fuel tank more often, which is not convenient. Ben wants to size the HVAC system properly so that there are no complaints and the soldiers’ health is protected. Also, he wants to convince the soldiers to install shading so that the cooling demand and fuel consumption is decreased.
\end{minipage}
\end{document}
祝你有美好的一天:D!
答案2
wrapfig 接受一个可选参数,该参数指定图形应占据多少行高。您还需要一个\noindent
:
\documentclass{article}
\usepackage{wrapfig}
\usepackage{graphicx}
\begin{document}
\begin{wrapfigure}[14]{l}{0.15\textwidth} % <----- added [14]
\includegraphics[height=2cm,width=0.9\linewidth]{example-image}
\caption{Ben}
\end{wrapfigure}
\noindent % <----- added
\textbf{Ben} is a technician working for the Ministry of Defense. He was asked to prepare 300 multi-purpose tents (MPT II) for a mission in Mali. Ben is a prudent person. The climate in Mali is extremely hot. Ben does not want to provide an oversized system because he does not want to give the soldiers the opportunity to set too low temperature in the tents in order to prevent health problems caused by the temperature shock. Moreover, oversized systems make noise and consume more fuel. Larger fuel consumption causes additional costs and the need to refill the fuel tank more often, which is not convenient. Ben wants to size the HVAC system properly so that there are no complaints and the soldiers’ health is protected. Also, he wants to convince the soldiers to install shading so that the cooling demand and fuel consumption is decreased.
\end{document}
答案3
这个答案怎么样——使用floatrow
和paracol
包?
\documentclass[11pt]{article}
\usepackage[]{graphicx}
\usepackage{caption}
\usepackage{floatrow}
\usepackage{paracol}
\begin{document}
\columnratio{0.15,0,85}
\begin{paracol}{2}
\vspace*{\fill}
\ffigbox[\FBwidth]
{\caption*{Ben}}{\includegraphics[width=0.15\textwidth]{figures/engineer.png}}
\vspace*{\fill}
\switchcolumn
\textbf{Ben} is a technician working for the Ministry of Defense. He was asked to prepare 300 multi-purpose tents (MPT II) for a mission in Mali. Ben is a prudent person. The climate in Mali is extremely hot. Ben does not want to provide an oversized system because he does not want to give the soldiers the opportunity to set too low temperature in the tents in order to prevent health problems caused by the temperature shock. Moreover, oversized systems make noise and consume more fuel. Larger fuel consumption causes additional costs and the need to refill the fuel tank more often, which is not convenient. Ben wants to size the HVAC system properly so that there are no complaints and the soldiers’ health is protected. Also, he wants to convince the soldiers to install shading so that the cooling demand and fuel consumption is decreased.
\end{paracol}
\end{document}
答案4
一种可能性是使用表格,在第一列插入图像,在第二列插入文本。
对于表格我建议zblr
使用tabularray
:
\documentclass{article}
\usepackage[export]{adjustbox}
\usepackage{tabularray}
\usepackage{lipsum}
\begin{document}
\sffamily
\noindent%
\begin{tblr}{colspec={@{} X[c,m] X[4,j,m] @{}}}
\includegraphics[width=\linewidth,valign=t]{example-image-duck}
\par\medskip\footnotesize
Lady Queen Duck
& \lipsum[11]
\end{tblr}
\end{document}
编辑:
利用tabularx
表格可以获得相同的结果:
\documentclass{article}
\usepackage[export]{adjustbox}
\usepackage{tabularx}
\usepackage{lipsum}
\begin{document}
\sffamily
\noindent%
\begingroup
\renewcommand\tabularxcolumn[1]{m{#1}}
\begin{tabularx}{\linewidth}{@{} m{0.2\linewidth} X @{}}
\includegraphics[width=\linewidth,valign=t]{example-image-duck}
\par\medskip\footnotesize
Lady Queen Duck
& \lipsum[11]
\end{tabularx}
\endgroup
\end{document}
结果与以前相同。