Graphics, Figures & TablesHow to align two mini-page pictures?

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
lukaszskowron96
Posts: 36
Joined: Tue Oct 09, 2018 1:01 pm

How to align two mini-page pictures?

Post by lukaszskowron96 »

Hi. My problem is very simple, as you can see on the picture below, the two pictures are not perfectly aligned i.e. right hand one is higher than left hand one. How can I align them?

Code: Select all

\begin{figure}[H]
\begin{minipage}[b]{0.5\linewidth}
\centering
\includegraphics[width=0.7\textwidth]{shapesrs1}
\subcaption{Example foundation with \(R=\frac{1}{\pi} \approx 0.32\)}
\end{minipage}
\begin{minipage}[b]{0.5\linewidth}
\centering
\includegraphics[width=0.7\textwidth]{shapesrs2}
\subcaption{\(\left. R_{RSmax}=\frac{B_{i}^2}{\pi r_{o}^2}\right\vert_{r_{o}=\frac{\sqrt{2}B_{i}}{2}}=\frac{2}{\pi}\approx0.64\)}
\end{minipage}
\caption{Ring foundations with central square perforation}
\end{figure}
Thanks,

Lukasz
latexforumalingingpictures.png
latexforumalingingpictures.png (66.54 KiB) Viewed 5914 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

rais
Posts: 419
Joined: Sun Nov 16, 2014 8:51 pm

How to align two mini-page pictures?

Post by rais »

Have a look at the subcaption package.
Its \subcaptionbox commad may just be, what you're after.

KR
Rainer
lukaszskowron96
Posts: 36
Joined: Tue Oct 09, 2018 1:01 pm

How to align two mini-page pictures?

Post by lukaszskowron96 »

I got an error:

! Missing $ inserted.
<inserted text>
$
l.524 {\includegraphics{shapesrs2}}

?

after using this code:

Code: Select all

\begin{figure}[H]
\centering
\subcaptionbox{Example foundation with \(R=\frac{1}{\pi} \approx 0.32\)}
{\includegraphics{shapesrs1}}
\subcaptionbox{\(\left. R_{RSmax}=\frac{B_{i}^2}{\pi r_{o}^2}\right\vert_{r_{o}=\frac{\sqrt{2}B_{i}}{2}}=\frac{2}{\pi}}
{\includegraphics{shapesrs2}}
\caption{Ring foundations with central square perforation}
\end{figure}
Also had to change to \usepackage{caption} instead of \usepackage[center]{caption} and now captions are not centered for some figures.
lukaszskowron96
Posts: 36
Joined: Tue Oct 09, 2018 1:01 pm

How to align two mini-page pictures?

Post by lukaszskowron96 »

I actually added some white space under the picture in the .png file and now they are aligned ;)
Post Reply