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}{.45linewidth}
includegraphics[width=linewidth]{./Figures/actual.png}
caption{First caption}
label{img1}
end{minipage}
hspace{.05linewidth}
begin{minipage}{.45linewidth}
includegraphics[width=linewidth]{./Figures/master.png}
caption{Second caption}
label{img2}
end{minipage}
end{figure}
end{document}
subcaptionbox:
begin{figure}[H]
centering
subcaptionbox{Actual Elementlabel{actual-element}}
{%
includegraphics[width=0.48columnwidth]{./Figures/actual.png}
hspace{0.04columnwidth}
}%
subcaptionbox{Master Elementlabel{master-element}}
{%
includegraphics[width=0.48columnwidth]{./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.
horizontal-alignment subfloats minipage subcaption size
add a comment |
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}{.45linewidth}
includegraphics[width=linewidth]{./Figures/actual.png}
caption{First caption}
label{img1}
end{minipage}
hspace{.05linewidth}
begin{minipage}{.45linewidth}
includegraphics[width=linewidth]{./Figures/master.png}
caption{Second caption}
label{img2}
end{minipage}
end{figure}
end{document}
subcaptionbox:
begin{figure}[H]
centering
subcaptionbox{Actual Elementlabel{actual-element}}
{%
includegraphics[width=0.48columnwidth]{./Figures/actual.png}
hspace{0.04columnwidth}
}%
subcaptionbox{Master Elementlabel{master-element}}
{%
includegraphics[width=0.48columnwidth]{./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.
horizontal-alignment subfloats minipage subcaption size
Welcome to TeX SX! There is also thefloatrowpackage.
– Bernard
Nov 23 '15 at 22:52
subfig is OK. subfigure is obsolete.
– cfr
Nov 24 '15 at 2:37
add a comment |
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}{.45linewidth}
includegraphics[width=linewidth]{./Figures/actual.png}
caption{First caption}
label{img1}
end{minipage}
hspace{.05linewidth}
begin{minipage}{.45linewidth}
includegraphics[width=linewidth]{./Figures/master.png}
caption{Second caption}
label{img2}
end{minipage}
end{figure}
end{document}
subcaptionbox:
begin{figure}[H]
centering
subcaptionbox{Actual Elementlabel{actual-element}}
{%
includegraphics[width=0.48columnwidth]{./Figures/actual.png}
hspace{0.04columnwidth}
}%
subcaptionbox{Master Elementlabel{master-element}}
{%
includegraphics[width=0.48columnwidth]{./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.
horizontal-alignment subfloats minipage subcaption size
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}{.45linewidth}
includegraphics[width=linewidth]{./Figures/actual.png}
caption{First caption}
label{img1}
end{minipage}
hspace{.05linewidth}
begin{minipage}{.45linewidth}
includegraphics[width=linewidth]{./Figures/master.png}
caption{Second caption}
label{img2}
end{minipage}
end{figure}
end{document}
subcaptionbox:
begin{figure}[H]
centering
subcaptionbox{Actual Elementlabel{actual-element}}
{%
includegraphics[width=0.48columnwidth]{./Figures/actual.png}
hspace{0.04columnwidth}
}%
subcaptionbox{Master Elementlabel{master-element}}
{%
includegraphics[width=0.48columnwidth]{./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.
horizontal-alignment subfloats minipage subcaption size
horizontal-alignment subfloats minipage subcaption size
edited Nov 23 '15 at 22:31
Werner
441k679711663
441k679711663
asked Nov 23 '15 at 22:24
chigyychigyy
133
133
Welcome to TeX SX! There is also thefloatrowpackage.
– Bernard
Nov 23 '15 at 22:52
subfig is OK. subfigure is obsolete.
– cfr
Nov 24 '15 at 2:37
add a comment |
Welcome to TeX SX! There is also thefloatrowpackage.
– Bernard
Nov 23 '15 at 22:52
subfig is OK. subfigure is obsolete.
– cfr
Nov 24 '15 at 2:37
Welcome to TeX SX! There is also the
floatrow package.– Bernard
Nov 23 '15 at 22:52
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
subfig is OK. subfigure is obsolete.
– cfr
Nov 24 '15 at 2:37
add a comment |
2 Answers
2
active
oldest
votes
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}{.48linewidth}
includegraphics[width=linewidth]{example-image-A}
caption{First caption}
label{img1}
end{minipage}
hfill
begin{minipage}{.48linewidth}
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
add a comment |
I have one question. If I have to give one main caption below these figures. How can i make a change in the above mentioned code?
This is not an answer, rather comment or new question. btw, it seems that you looking for sub figures.
– Zarko
12 mins ago
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f279669%2ftwo-figures-side-by-side-alignment-size-problem%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
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}{.48linewidth}
includegraphics[width=linewidth]{example-image-A}
caption{First caption}
label{img1}
end{minipage}
hfill
begin{minipage}{.48linewidth}
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
add a comment |
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}{.48linewidth}
includegraphics[width=linewidth]{example-image-A}
caption{First caption}
label{img1}
end{minipage}
hfill
begin{minipage}{.48linewidth}
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
add a comment |
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}{.48linewidth}
includegraphics[width=linewidth]{example-image-A}
caption{First caption}
label{img1}
end{minipage}
hfill
begin{minipage}{.48linewidth}
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.
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}{.48linewidth}
includegraphics[width=linewidth]{example-image-A}
caption{First caption}
label{img1}
end{minipage}
hfill
begin{minipage}{.48linewidth}
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.
edited Nov 23 '15 at 23:03
answered Nov 23 '15 at 22:46
AboAmmarAboAmmar
33.5k22883
33.5k22883
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
add a comment |
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
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
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
add a comment |
I have one question. If I have to give one main caption below these figures. How can i make a change in the above mentioned code?
This is not an answer, rather comment or new question. btw, it seems that you looking for sub figures.
– Zarko
12 mins ago
add a comment |
I have one question. If I have to give one main caption below these figures. How can i make a change in the above mentioned code?
This is not an answer, rather comment or new question. btw, it seems that you looking for sub figures.
– Zarko
12 mins ago
add a comment |
I have one question. If I have to give one main caption below these figures. How can i make a change in the above mentioned code?
I have one question. If I have to give one main caption below these figures. How can i make a change in the above mentioned code?
answered 21 mins ago
Ahmad BilalAhmad Bilal
213
213
This is not an answer, rather comment or new question. btw, it seems that you looking for sub figures.
– Zarko
12 mins ago
add a comment |
This is not an answer, rather comment or new question. btw, it seems that you looking for sub figures.
– Zarko
12 mins ago
This is not an answer, rather comment or new question. btw, it seems that you looking for sub figures.
– Zarko
12 mins ago
This is not an answer, rather comment or new question. btw, it seems that you looking for sub figures.
– Zarko
12 mins ago
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f279669%2ftwo-figures-side-by-side-alignment-size-problem%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Welcome to TeX SX! There is also the
floatrowpackage.– Bernard
Nov 23 '15 at 22:52
subfig is OK. subfigure is obsolete.
– cfr
Nov 24 '15 at 2:37