LaTeX forum ⇒ Theses, Books, Title pagesMaster/doctoral thesis figures next to each other Topic is solved

Classicthesis, Bachelor and Master thesis, PhD, Doctoral degree
Shafiq Popal
Posts: 9
Joined: Thu Mar 02, 2017 8:31 pm

Master/doctoral thesis figures next to each other

Postby Shafiq Popal » Fri May 05, 2017 7:42 pm

Hello everyone,
I am not very good at latex but I am quite interested to know if it is possible to put the figures next to each other? Secondly, can I use float package in this template?
I would really appreciate your kind cooperation.
Respectfully,

Tags:

User avatar
Johannes_B
Site Moderator
Posts: 3805
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Sat May 06, 2017 6:43 am

Yes, of course you can put two images next to each other, why shouln't there any difference?

You can also use the float package. But why would you need it?
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

Shafiq Popal
Posts: 9
Joined: Thu Mar 02, 2017 8:31 pm

Postby Shafiq Popal » Sat May 06, 2017 6:42 pm

Thanks a lot for your kind reply. May I know the input code for placing two figures side by side?
I need float package because I also face problem with the positioning of figures. I want them below a specific text but it doesn't work that way after compiling. I would appreciate if you let me know any solution for that.

Kindest Regards,

erir
Posts: 1
Joined: Sat May 06, 2017 6:12 pm

Postby erir » Sat May 06, 2017 7:00 pm

Take a look at the top answer here:

https://tex.stackexchange.com/questions ... each-other

There are different methods of achieving two pictures which are side by side. You can choose the easiest one for you.

User avatar
Stefan Kottwitz
Site Admin
Posts: 8980
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Sat May 06, 2017 7:24 pm

To cite the solutions of Masroor, linked by erir above:

----

Without Using Any Package

  1. \documentclass{article}
  2. \usepackage{graphicx}
  3. \begin{document}
  4. \begin{figure}[!tbp]
  5. \centering
  6. \begin{minipage}[b]{0.4\textwidth}
  7. \includegraphics[width=\textwidth]{flower1.jpg}
  8. \caption{Flower one.}
  9. \end{minipage}
  10. \hfill
  11. \begin{minipage}[b]{0.4\textwidth}
  12. \includegraphics[width=\textwidth]{flower2.jpg}
  13. \caption{Flower two.}
  14. \end{minipage}
  15. \end{figure}
  16. \end{document}


images-1.png
images-1.png (46.42 KiB) Viewed 1765 times


Using Packages

You can use either subfig or subcaption.

Using subfig:

  1. \documentclass{article}
  2. \usepackage{graphicx}
  3. \usepackage{subfig}
  4. \begin{document}
  5. \begin{figure}[!tbp]
  6. \centering
  7. \subfloat[Flower one.]{\includegraphics[width=0.4\textwidth]{flower1.jpg}\label{fig:f1}}
  8. \hfill
  9. \subfloat[Flower two.]{\includegraphics[width=0.4\textwidth]{flower2.jpg}\label{fig:f2}}
  10. \caption{My flowers.}
  11. \end{figure}
  12. \end{document}


images-2.png
images-2.png (88.51 KiB) Viewed 1765 times


Using subcaption:

  1. \documentclass{article}
  2. \usepackage{graphicx}
  3. \usepackage{caption}
  4. \usepackage{subcaption}
  5. \begin{document}
  6. \begin{figure}[!tbp]
  7. \begin{subfigure}[b]{0.4\textwidth}
  8. \includegraphics[width=\textwidth]{flower1.jpg}
  9. \caption{Flower one.}
  10. \label{fig:f1}
  11. \end{subfigure}
  12. \hfill
  13. \begin{subfigure}[b]{0.4\textwidth}
  14. \includegraphics[width=\textwidth]{flower2.jpg}
  15. \caption{Flower two.}
  16. \label{fig:f2}
  17. \end{subfigure}
  18. \caption{My flowers.}
  19. \end{figure}
  20. \end{document}


images-3.png
images-3.png (89.25 KiB) Viewed 1765 times


Pros and Cons of the Approaches:

  • It is actually difficult to call one method superior over the other. Which one you want to use will depend on the result you are expecting. So, see the results presented above and choose yourself.

  • The first one which uses the minipage environment is actually very simple. But as you can see the figures are number individually. If want to present a group of related figures, it may not be the one you are looking for.

  • The results from subfig and subcaption are very similar. Though each has its own way of usage. However, there are reports on subfig not working properly with hyperref. This question provides an excellent discussion on the comparative analysis on subcaption vs. subfig.

Further Reading

In order to get a better understanding of the placement and width controlling issues, I strongly suggest the you go through the documentation of the above two packages (subfig and subcaption). These documentations contain some excellent hints and examples.

Also, for comprehending the solutions of related issues, these questions (A, B, C, D, E, F) are worth taking a look at.

----
Site admin

Shafiq Popal
Posts: 9
Joined: Thu Mar 02, 2017 8:31 pm

Postby Shafiq Popal » Sat May 06, 2017 8:42 pm

Thank you all for your kind replies. the first method that doesn't use any package really works for me. Many thanks again

User avatar
Johannes_B
Site Moderator
Posts: 3805
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Sat May 06, 2017 10:15 pm

Package subfig won't really work with the template, package subcaption will work just fine. The class already uses the caption package internally.

If you don't need a caption, and don't want the image to flow to another place, avoid the figure environment.
You could also use \captionof{figure}{This is the caption} to use a caption without a floating environment (like figure).
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.


Return to “Theses, Books, Title pages”

Who is online

Users browsing this forum: No registered users and 4 guests