Document Classes ⇒ Vertical alignment of minipages
Vertical alignment of minipages
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!
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
Vertical alignment of minipages
Re: Vertical alignment of minipages
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 1838 times
Vertical alignment of minipages
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
Have a great day!
Re: Vertical alignment of minipages
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 184709 times
- Stefan Kottwitz
- Site Admin
- Posts: 10360
- Joined: Mon Mar 10, 2008 9:44 pm
Vertical alignment of minipages
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
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
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.