我有以下 tex 标记:
\documentclass[a4paper]{article}
\usepackage{geometry}
\geometry{a4paper,total={170mm,257mm},left=20mm,top=20mm}
\usepackage{makeidx}
\usepackage{csquotes}
\usepackage{xltxtra}
\usepackage{xunicode}
\usepackage{libertine}
\usepackage{fontspec}
\usepackage{calc}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{lipsum}
\begin{document}
\lipsum{1-3}
\begin{wrapfigure}{l}{0.5\textwidth}
\begin{center}
\includegraphics[width=0.4\textwidth,keepaspectratio]{./600x400.png}
\end{center}
\caption{Account data export in Diaspora* control panel}
\label{DIASPORA:ACC:TRANSF}
\end{wrapfigure}
\begin{wrapfigure}{r}{0.5\textwidth}
\begin{center}
\includegraphics[width=0.4\textwidth,keepaspectratio]{./600x400_2.png}
\end{center}
\caption{Account Deletion in Diaspora* control panel}
\label{DIASPORA:ACC:DEL}
\end{wrapfigure}
\lipsum{5}
\end{document}
并在pdf。
我想要实现的是将两个包装图像这样并排放置:
我怎样才能做到这一点?
答案1
您可以使用此floatrow
包来实现此目的:
\documentclass[a4paper]{article}
\usepackage{geometry}
\geometry{a4paper,total={170mm,257mm},left=20mm,top=20mm}
\usepackage{makeidx}
\usepackage{csquotes}
\usepackage{xltxtra}
\usepackage{xunicode}
\usepackage{libertine}
\usepackage{fontspec}
\usepackage{calc}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{floatrow}
\usepackage{mwe}
\usepackage{lipsum}
\begin{document}
\lipsum[1-2]
\begin{figure}[!htb]
\centering\floatsetup{floatrowsep=qquad}
\begin{floatrow}[2]
\ffigbox[\FBwidth]{%
\includegraphics[width=0.4\textwidth,keepaspectratio]{example-image-16x10.png}}
{\caption{Account data export in Diaspora* control panel}
\label{DIASPORA:ACC:TRANSF}}
\ffigbox[\FBwidth]{%
\includegraphics[width=0.4\textwidth,keepaspectratio]{example-image-16x10.png}}
{\caption{Account Deletion in Diaspora* control panel}
\label{DIASPORA:ACC:DEL}}
\end{floatrow}
\end{figure}
\lipsum
\end{document}
答案2
在 XeLaTex 中,这可以通过以下方式实现figure
,minipage
如以下示例所示:
\documentclass[a4paper]{article}
\usepackage{geometry}
\geometry{a4paper,total={170mm,257mm},left=20mm,top=20mm}
\usepackage{makeidx}
\usepackage{csquotes}
\usepackage{xltxtra}
\usepackage{xunicode}
\usepackage{libertine}
\usepackage{fontspec}
\usepackage{calc}
\usepackage{graphicx}
\usepackage{multicol}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{lipsum}
\begin{document}
\lipsum{1-3}
\begin{figure}[ht]
\centering
\begin{minipage}{0.5\textwidth}
\begin{center}
% The line is as wide as is defined subpage.
% Meaning the overall width of this section is 0.5*\textwith
\includegraphics[width=0.8\linewidth,keepaspectratio]{./600x400.png}
\end{center}
\captionof{figure}{Account data export in Diaspora* control panel}
\label{DIASPORA:ACC:TRANSF}
\end{minipage}%
\begin{minipage}{0.5\textwidth}
\begin{center}
\includegraphics[width=0.8\linewidth,keepaspectratio]{./600x400_2.png}
\end{center}
\captionof{figure}{Account Deletion in Diaspora* control panel}
\label{DIASPORA:ACC:DEL}
\end{minipage}
\end{figure}
\lipsum{5-6}
\end{document}