Monday, August 18, 2014

multiple figures in one line in Latex

Following sample code is a way to have two figure in one single row. subcaption is the package that can do the job.

 \documentclass{article}  
 \usepackage[demo]{graphicx}  
 \usepackage{subcaption}  
 \begin{document}  
 \begin{figure}  
 \begin{subfigure}{.5\textwidth}  
  \centering  
  \includegraphics[width=.8\linewidth]{image1}  
  \caption{1a}  
  \label{fig:sfig1}  
 \end{subfigure}%  
 \begin{subfigure}{.5\textwidth}  
  \centering  
  \includegraphics[width=.8\linewidth]{image2}  
  \caption{1b}  
  \label{fig:sfig2}  
 \end{subfigure}  
 \caption{plots of....}  
 \label{fig:fig}  
 \end{figure}  
 \end{document}  


Here is the result:
enter image description here

No comments:

Post a Comment