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

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

How to align two mini-page pictures?

Postby lukaszskowron96 » Wed Nov 28, 2018 11:03 pm

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?

  1. \begin{figure}[H]
  2. \begin{minipage}[b]{0.5\linewidth}
  3. \centering
  4. \includegraphics[width=0.7\textwidth]{shapesrs1}
  5. \subcaption{Example foundation with \(R=\frac{1}{\pi} \approx 0.32\)}
  6. \end{minipage}
  7. \begin{minipage}[b]{0.5\linewidth}
  8. \centering
  9. \includegraphics[width=0.7\textwidth]{shapesrs2}
  10. \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\)}
  11. \end{minipage}
  12. \caption{Ring foundations with central square perforation}
  13. \end{figure}


Thanks,

Lukasz

latexforumalingingpictures.png
latexforumalingingpictures.png (66.54 KiB) Viewed 134 times

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

Postby rais » Thu Nov 29, 2018 11:19 am

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

KR
Rainer

lukaszskowron96
Posts: 31
Joined: Tue Oct 09, 2018 1:01 pm

Postby lukaszskowron96 » Thu Nov 29, 2018 4:30 pm

I got an error:

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

?

after using this code:

  1. \begin{figure}[H]
  2. \centering
  3. \subcaptionbox{Example foundation with \(R=\frac{1}{\pi} \approx 0.32\)}
  4. {\includegraphics{shapesrs1}}
  5. \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}}
  6. {\includegraphics{shapesrs2}}
  7. \caption{Ring foundations with central square perforation}
  8. \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: 31
Joined: Tue Oct 09, 2018 1:01 pm

Postby lukaszskowron96 » Thu Nov 29, 2018 4:39 pm

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


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 7 guests