需要一条命令来捕获多个浮点数。浮点数的 PDF 输出应并排设置。我尝试了以下宏。我得到了
! LaTeX Error: Not in outer par mode
有没有办法用多个浮点数来生成单个命令?
\documentclass{book}
\def\sidebysidefig#1#2{\begin{minipage}{0.45\textwidth}{#1}{#2}\end{minipage}}
\begin{document}
\chapter{Mathematical Expression $\sin\theta\,\cos\theta$}
\sidebysidefig{\begin{figure}
%\includegraphics{fig1.eps}
\caption{This is sample caption}\end{figure}}{\begin{figure}
%\includegraphics{fig2.eps}
\caption{This is sample caption}\end{figure}}
\end{document}
答案1
figure
环境需要处于顶层以便它们可以浮动,但您不需要任何特殊的东西来将内容并排放置:
\documentclass{book}
\usepackage{graphicx}
\begin{document}
\chapter{Mathematical Expression $\sin\theta\,\cos\theta$}
\begin{figure}
\begin{minipage}{.45\textwidth}
\includegraphics[width=\linewidth]{example-image-a}
\caption{This is sample caption}
\end{minipage}\hfill
\begin{minipage}{.45\textwidth}
\includegraphics[width=\linewidth]{example-image-b}
\caption{This is sample caption}
\end{minipage}
\end{figure}
\end{document}