# Two figures side by side - Alignment & Size Problem

There are some ways to put the figures side by side such as subfig (which is not recommended), subfigure, subcaption, subcaptionbox and minipage. I tried minipage and subcaption and here the codes and results:

minipage:

\documentclass{article} %Document type
\usepackage{amssymb,amsmath} %Inserting symbols
\usepackage{graphicx} %Inserting graphics
\usepackage{fullpage}
\usepackage{indentfirst} %Indentation of the first paragraphs
\usepackage{float} %Forcing exact graphic placement - H
\usepackage{chngcntr} %Required package in order to use the macro.
\counterwithin{figure}{section} %Macro: Article class - per-section numbering for figure
\counterwithin{equation}{section} %Macro: Article class - per-section numbering for equation
\counterwithin{table}{section} %Macro: Article class - per-section numbering for tables
\usepackage{physics} %In order to type PDEs easily
\usepackage{bm} %Bold math symbols
\usepackage{booktabs} %Making tables
\usepackage{subcaption} %subfigure and subtable environment
\begin{document}
This is a test document in order to put figures side by side, increase/decrease the sizes of the figures and align horizontally.
\begin{figure}[H]
\centering
\begin{minipage}{.45\linewidth}
\includegraphics[width=\linewidth]{./Figures/actual.png}
\caption{First caption}
\label{img1}
\end{minipage}
\hspace{.05\linewidth}
\begin{minipage}{.45\linewidth}
\includegraphics[width=\linewidth]{./Figures/master.png}
\caption{Second caption}
\label{img2}
\end{minipage}
\end{figure}
\end{document}


subcaptionbox:

\begin{figure}[H]
\centering
\subcaptionbox{Actual Element\label{actual-element}}
{%
\includegraphics[width=0.48\columnwidth]{./Figures/actual.png}
\hspace{0.04\columnwidth}
}%
\subcaptionbox{Master Element\label{master-element}}
{%
\includegraphics[width=0.48\columnwidth]{./Figures/master.png}
\hspace*{\fill}
}%
\caption{Coordinate Transformation}\label{animals}
\end{figure}


The result is

As it is seen, both of the results are the same.

I want to make this two figures closer and bigger. These figures should not exceed the \linewidth and should center the page.

• Welcome to TeX SX! There is also the floatrow package. – Bernard Nov 23 '15 at 22:52
• subfig is OK. subfigure is obsolete. – cfr Nov 24 '15 at 2:37

The problem is mostly due to the .png images having extra wide space around them. Please check your images or try to upload them in your post. Here is your code with experimental images:

\documentclass{article} %Document type
\usepackage{amssymb,amsmath} %Inserting symbols
\usepackage{graphicx} %Inserting graphics
\usepackage{fullpage}
\usepackage{indentfirst} %Indentation of the first paragraphs
\usepackage{float} %Forcing exact graphic placement - H
\usepackage{chngcntr} %Required package in order to use the macro.
\counterwithin{figure}{section} %Macro: Article class - per-section numbering for figure
\counterwithin{equation}{section} %Macro: Article class - per-section numbering for equation
\counterwithin{table}{section} %Macro: Article class - per-section numbering for tables
\usepackage{physics} %In order to type PDEs easily
\usepackage{bm} %Bold math symbols
\usepackage{booktabs} %Making tables
\usepackage{subcaption} %subfigure and subtable environment
\begin{document}
This is a test document in order to put figures side by side, increase/decrease the sizes of the figures and align horizontally.
\begin{figure}[H]
\centering
\begin{minipage}{.48\linewidth}
\includegraphics[width=\linewidth]{example-image-A}
\caption{First caption}
\label{img1}
\end{minipage}
\hfill
\begin{minipage}{.48\linewidth}
\includegraphics[width=\linewidth]{example-image-B}
\caption{Second caption}
\label{img2}
\end{minipage}
\end{figure}
\end{document}


And here is a low-quality version of your .png images copied from your post:

As you see, the images now have thinner space in-between and are larger. I've cut any extra white space around each one on my computer.

• Thanks a lot @AboAmmar . Well I checked the size of original pictures before asking this question but since they are .png files, I was mistaken. When you warned me, I checked it via photoshop and I figured it out. Thanks a lot once more and sorry for this silly question :/ – chigyy Nov 24 '15 at 19:02