参考此链接, 使用子图将图像放在行中
当我使用相同的表格格式的代码时双栏页面格式,它超出了第一列的宽度。我已经习惯\columnwidth
将其放在单列内,但是不起作用。
\begin{figure}
\centering
\begin{tabular}[c]{cccc}
\begin{subfigure}[b]{0.24\columnwidth}
\includegraphics[width=\textwidth]{figure/E_field_513_THz_X_normal.eps}
\caption{E field at 513 THz x-normal direction.}
\end{subfigure}&
\begin{subfigure}[b]{0.24\columnwidth}
\includegraphics[width=\textwidth]{figure/E_field_513_THz_Y_normal.eps}
\caption{E field at 513 THz in y-normal direction.}
\end{subfigure}&
\begin{subfigure}[b]{0.24\columnwidth}
\includegraphics[width=\textwidth]{figure/H_field_513_THz_Y_normal.eps}
\caption{H field at 513 THz y-normal direction.}
\end{subfigure}&
\begin{subfigure}[b]{0.24\columnwidth}
\includegraphics[width=\textwidth]{figure/H_field_513_THz_X_normal.eps}
\caption{H field at 513 THz x-normal direction.}
\end{subfigure}
\end{tabular}
\caption{The electric and magnetic fields pattern at 513 THz.}
\label{E_and_H_field_at_513}
\end{figure}
有人可以帮忙吗?
答案1
很晚了……
\documentclass[9pt,twocolumn,twoside]{article}% {osajnl} sorry i can't find this document class
%\journal{ol} % Choose journal (ao, aop, josaa, josab, ol, pr)
\usepackage[demo]{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\captionsetup[subfigure]{font=footnotesize,
justification= raggedright}
\usepackage{lipsum}
\begin{document}
\lipsum[1]
\begin{figure}[htb]
\setkeys{Gin}{width=\linewidth}
\begin{subfigure}[b]{0.23\columnwidth}
\includegraphics{figure/E_field_455_THz_X_normal.eps}
\caption{E field at 455THz in x-normal direction.}
\label{fig:bear}%?
\end{subfigure}\hfill
\begin{subfigure}[b]{0.23\columnwidth}
\includegraphics{figure/E_field_455_THz_Y_normal.eps}
\caption{E field at 455THz in y-normal direction.}
\label{fig:lion}%?
\end{subfigure}\hfill
\begin{subfigure}[b]{0.23\columnwidth}
\includegraphics{figure/H_field_455_THz_X_normal.eps}
\caption{H field at 455THz x-normal direction.}
\label{fig:tiger}
\end{subfigure}\hfill%
\begin{subfigure}[b]{0.23\columnwidth}
\includegraphics{figure/H_field_455_THz_Y_normal.eps}
\caption{H field at 455THz y-normal direction.}
\label{fig:mouse}
\end{subfigure}
\caption{Same figure as previous figure in single row}
\label{figure_in_line}
\end{figure}
\lipsum[2]
\end{document}
答案2
我使用了以下代码,它解决了问题,但每个图的标题仍然存在问题。图标题几乎重叠彼此。
\documentclass[9pt,twocolumn,twoside]{osajnl}
\journal{ol} % Choose journal (ao, aop, josaa, josab, ol, pr)
\begin{document}
\begin{figure}
\begin{subfigure}[b]{0.24\columnwidth}
\centering \includegraphics[width=.95\linewidth]{figure/E_field_455_THz_X_normal.eps}
\caption{E field at 455THz in x-normal direction.}
\end{subfigure}%
\begin{subfigure}[b]{0.24\columnwidth}
\centering
\includegraphics[width=.95\linewidth]{figure/E_field_455_THz_Y_normal.eps}
\caption{E field at 455THz in y-normal direction.}
\end{subfigure}%
\begin{subfigure}[b]{0.24\columnwidth}
\centering
\includegraphics[width=.95\linewidth]{figure/H_field_455_THz_X_normal.eps}
\caption{H field at 455THz x-normal direction.}
\label{fig:tiger}
\end{subfigure}%
\begin{subfigure}[b]{0.24\columnwidth}
\centering
\includegraphics[width=.95\linewidth]{figure/H_field_455_THz_Y_normal.eps}
\caption{H field at 455THz y-normal direction.}
\label{fig:mouse}
\end{subfigure}
\caption{Same figure as previous figure in single row}
\label{figure_in_line}
\end{figure}
\end{document}