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 6203 times

Recommended reading 2024:

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

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

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