Hi,
I have two problems regarding vertical alignment of minipages inside a figure.
In the first example, I'm putting two minipages side-by-side, one containing a figure, the other one containing text. With either positioning parameter [t,b,c] for the minipage, I cannot get them to align vertically. What can I do about this?
\begin{figure}[!h]
\begin{minipage}[!t]{0.4\textwidth}
\includegraphics[width=1\textwidth]{Images/Assembly/Shaft_axis.jpg}
\caption{Shaft axis alignment}
\label{fig:shaft_axis}
\end{minipage}
\hspace{0.1\textwidth}
\begin{minipage}[!t]{0.5\textwidth}
blabla
\end{minipage}
\end{figure}
The same problem occurs when I try putting two figures side-by-side using minipages. Vertical alignment cannot be achieved.
\begin{figure}[!h]
\begin{minipage}[!b]{0.33\textwidth}
\centering
\includegraphics[width=0.9\textwidth]{Images/Embedding/embedded_funct_spine_unit.jpg}
\caption{Molded Functional Spine Unit}
\label{fig:embed_fsu}
\end{minipage}
\vspace{0pt}
\begin{minipage}[!b]{0.66\textwidth}
\centering
\raisebox{0.5cm}{\includegraphics[width=0.9\textwidth]{Images/Embedding/embedding_vertebrae.jpg}}
\caption{Molded Single Vertebra}
\label{fig:embed_vert}
\end{minipage}
\end{figure}
Any help would be much appreciated. Thanks!
Document Classes ⇒ Vertical alignment of minipages
Vertical alignment of minipages
The ! descriptor should go in the optional argument of float environments (table, figure), not in that of minipage. Does this solve your problem? If not, build a minimal example, attach the relevant files (so everybody can compile it) and say precisely how you would like to align the minipages.
Re: Vertical alignment of minipages
Thanks a lot. The problem with the two figures was already solved using your suggestion.
However, the example with the figure and the text next to it still does not work properly. I am attaching a .rar-file with a minimal example, the picture and a pdf of what I get when I compile it.
What I would like to achieve is that the top edge of the text next to the figure is vertically aligned with the top edge of the figure. Any suggestions on this?
However, the example with the figure and the text next to it still does not work properly. I am attaching a .rar-file with a minimal example, the picture and a pdf of what I get when I compile it.
What I would like to achieve is that the top edge of the text next to the figure is vertically aligned with the top edge of the figure. Any suggestions on this?
- Attachments
-
- Minipages_vertical_alignment.rar
- (96.78 KiB) Downloaded 1782 times
Vertical alignment of minipages
Here is your code with a few changes in order to solve your problem and avoid warnings.
The tip is to add \vspace{0pt} at the beginning of every minipage, as suggested in page 37 of the epslatex document.
Code: Select all
\documentclass[a4paper,11pt,titlepage]{article}
% Packages included
\usepackage{graphicx}
\listfiles
\begin{document}
\begin{figure}[!h]
\begin{minipage}[t]{0.4\textwidth}
\vspace{0pt}
\includegraphics[width=\linewidth]{Gauge_adhesive_bonding.jpg}
\caption{Adhesive bonding using gauge}
\label{fig:gauge_adhesive_bonding}
\end{minipage}
\hfill
\begin{minipage}[t]{0.5\textwidth}
\vspace{0pt}\raggedright
blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla
blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla
blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla
blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla
blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla
blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla
\end{minipage}
\end{figure}
\end{document}
Re: Vertical alignment of minipages
Many thanks, also for the reference to the epsdocument. It seems very useful and your suggested adaptations to the code work perfectly!
Have a great day!
Have a great day!
Re: Vertical alignment of minipages
Hi,
I tried your bit of code using TexnikCenter with pdfLatex on Windows, and it didn't work for me... my problem is (i think) simpler: i just try to get the warning symbol aligned with the fbox, but vspace{} and vspace*{} won't work... I tried many combinations of minipages and parbox, and i can't work it out.
Here's my bit of code:
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\begin{center}
\vspace*{1cm}
\includegraphics[height=2cm]{../latex_066/fig/pictossignalisationjpg/DangerGeneral.jpg}
\hspace{0.5cm}
\fbox{\fbox{\parbox{8cm}{
\begin{center}
{\sf{WARNING}}: \\
\end{center}
}}}
\end{center}
\end{document}
Thanks,
Marie.
I tried your bit of code using TexnikCenter with pdfLatex on Windows, and it didn't work for me... my problem is (i think) simpler: i just try to get the warning symbol aligned with the fbox, but vspace{} and vspace*{} won't work... I tried many combinations of minipages and parbox, and i can't work it out.
Here's my bit of code:
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\begin{center}
\vspace*{1cm}
\includegraphics[height=2cm]{../latex_066/fig/pictossignalisationjpg/DangerGeneral.jpg}
\hspace{0.5cm}
\fbox{\fbox{\parbox{8cm}{
\begin{center}
{\sf{WARNING}}: \\
\end{center}
}}}
\end{center}
\end{document}
Thanks,
Marie.
- Attachments
-
- warning.JPG (6.91 KiB) Viewed 178242 times
- Stefan Kottwitz
- Site Admin
- Posts: 10283
- Joined: Mon Mar 10, 2008 9:44 pm
Vertical alignment of minipages
Hi Marie,
you will get that alignment if you put the \includegraphics command inside a parbox:
Btw. don't use \sf, \textsf would be the better choice.
Stefan
you will get that alignment if you put the \includegraphics command inside a parbox:
Code: Select all
\parbox{WIDTH}{\includegraphics[height=2cm]{../latex_066/fig/pictossignalisationjpg/DangerGeneral.jpg}}
Stefan
Vertical alignment of minipages
This also works:
Code: Select all
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\includegraphics[height=2cm]{DangerGeneral.jpg}\hspace{2cm}
\fbox{\fbox{\parbox[b][2cm][c]{8cm}{\centering\sffamily WARNING}}}
\end{document}
Re: Vertical alignment of minipages
thanks for the suggestions !
this didn't work (but thanks for the help anyways):
you will get that alignment if you put the \includegraphics command inside a parbox:
Code:
\parbox{WIDTH}{\includegraphics[height=2cm]{../latex_066/fig/pictossignalisationjpg/DangerGeneral.jpg}}
but this elegant simple code worked just fine:
Code:
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\includegraphics[height=2cm]{DangerGeneral.jpg}\hspace{2cm}
\fbox{\fbox{\parbox[2cm][c]{8cm}{\centering\sffamily WARNING}}}
\end{document}
thanks again !!
marie.
this didn't work (but thanks for the help anyways):
you will get that alignment if you put the \includegraphics command inside a parbox:
Code:
\parbox{WIDTH}{\includegraphics[height=2cm]{../latex_066/fig/pictossignalisationjpg/DangerGeneral.jpg}}
but this elegant simple code worked just fine:
Code:
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\includegraphics[height=2cm]{DangerGeneral.jpg}\hspace{2cm}
\fbox{\fbox{\parbox[2cm][c]{8cm}{\centering\sffamily WARNING}}}
\end{document}
thanks again !!
marie.