PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : minipages



beachen
07-05-2008, 14:38
Hallo,

ich habe zwei Minipages nebeneinnander in denen Bilder mit ihrer Bildunterschrift sind. Da eine Bildunterschrift länger als die andere sind und anscheinend die Minipages zueinander zentriert sind, ist nun das eine Bild etwas tiefer als das andere. Wie kann ich das beheben? Gibt es einen Befehl, sodass die Minipages oben miteinander abschließen?

Danke schonmal im Voraus
Beachen

Syralist
07-05-2008, 15:48
ja, gibt es.

\begin{minipage}[t]{Breite} ... \end{minipage}

der optionale Parameter t bewirkt, dass die Minipage oben ausgerichtet wird (top). Es gibt auch noch b für unten (bottom).

edico
07-05-2008, 17:19
der optionale Parameter t bewirkt, dass die Minipage oben ausgerichtet wird (top)
Das ist natürlich so nicht richtig. [t] heisst *nicht*, dass an der Oberkante ausgerichtet wird. Vielmehr werden die *Grundlinien der ersten Zeilen* beider minipages aneinander ausgerichtet. Beim Bild ist das die Unterkante des Bildes.

Sollen also beide Bilder 'top aligned' ausgerichtet werden, muss eine 'Hilfskrücke' eingebaut werden ... das MB zeigt dies eindrucksvoll.


\documentclass[paper=a5,pagesize,9pt]{scrartcl}
\usepackage{showframe}
\usepackage[demo]{graphicx}
\usepackage{calc}

\begin{document}
\section*{Option t -- pic + pic}
\begin{figure}[htb]
\fbox{%
\begin{minipage}[t]{0.4\textwidth}%
\centering
\includegraphics[width=10mm,height=10mm,keepaspectratio]{bild}%
\caption{Bild links}
\end{minipage}}
\hfill
\fbox{%
\begin{minipage}[t]{0.4\textwidth}%
\centering
\includegraphics[width=10mm,height=5mm,keepaspectratio]{bild}%
\caption{Bild rechts mit einer sehr langen Unterschrift,
die m\"oglichst zu vermeiden ist}
\end{minipage}}
\end{figure}


\section*{Option t + vspace -- pic + pic}
\begin{figure}[htb]
\fbox{%
\begin{minipage}[t]{0.4\textwidth}%
\vspace*{0pt}
\centering
\includegraphics[width=10mm,height=10mm,keepaspectratio]{bild}%
\caption{Bild links}
\end{minipage}}
\hfill
\fbox{%
\begin{minipage}[t]{0.4\textwidth}%
\vspace*{0pt}
\centering
\includegraphics[width=10mm,height=5mm,keepaspectratio]{bild}%
\caption{Bild rechts mit einer sehr langen Unterschrift,
die m\"oglichst zu vermeiden ist}
\end{minipage}}
\end{figure}


\section*{Option b -- pic + pic}
\begin{figure}[htb]
\fbox{%
\begin{minipage}[b]{0.4\textwidth}%
\centering
\includegraphics[width=10mm,height=10mm,keepaspectratio]{bild}%
\caption{Bild links}
\end{minipage}}
\hfill
\fbox{%
\begin{minipage}[b]{0.4\textwidth}%
\centering
\includegraphics[width=10mm,height=5mm,keepaspectratio]{bild}%
\caption{Bild rechts mit einer sehr langen Unterschrift,
die m\"oglichst zu vermeiden ist}
\end{minipage}}
\end{figure}
\end{document}

edico

edico
07-05-2008, 21:40
Das Beispiel meines letzten postings mag hiermit erweitert (z.T. verbessert) sein ... und die Gegenüberstellung verschiedener Optionen grundlegende Alignments etwas transparent machen (für den eine oder anderen) ...

\documentclass[paper=a5,pagesize,9pt,german,smallheadings]{scrreprt}
\usepackage{showframe}
\usepackage[top=15mm,bottom=20mm]{geometry}
\usepackage{babel}
\usepackage[demo]{graphicx}
\usepackage{xcolor}
\usepackage{calc}
\usepackage[colorlinks]{hyperref}

\begin{document}
\begin{titlepage}
\vspace*{64pt}
\begin{flushright}
\bfseries\color{blue!60!black!100!}
\Huge Minipages Alignment\par
\vspace{6pt}
\normalfont\normalcolor
\large\scshape Dokumente\par
\vspace{12pt}
\textbf{How to align minipage beside minipage\\[18pt]
Edico\\
\today}
\end{flushright}
\end{titlepage}

\tableofcontents


\begin{abstract}\noindent
{\large\bfseries Prolog -- alignment minipages}
\begin{verbatim}
was bedeutet [t]? Das heisst *nicht*, dass an der
Oberkante ausgerichtet wird. Vielmehr werden die
*Grundlinien der ersten Zeilen* beider minipages
aneinander ausgerichtet. Beim Bild ist das die
Unterkante des Bildes.


\begin{minipage}[position]
[hoehe]
[innen-position]
{breite}
\end{minipage}
dabei gilt: c=center, t=top, b=bootom
\end{verbatim}
\end{abstract}


\chapter{Bild neben Tabelle}
\section{top alignment -- [t]}
\begin{figure}[htb]
\fbox{%
\begin{minipage}[t][][c]{0.45\textwidth}%
\includegraphics[width=20mm,height=20mm,keepaspectratio]{bild}
\caption{Karte}
\end{minipage}}
\hfill
\fbox{%
\begin{minipage}[t][][c]{0.45\textwidth}%
\begin{tabular}{|c|c|}\hline
Einwohnerzahl & 705 \\\hline
Fl\"ache & 17,41km$^{2}$\\\hline
H\"ohe \"uber NN & 440m \\\hline
Kennzeichen & HZ \\\hline
\end{tabular}
\caption{Zusammenfassung}
\end{minipage}}
\end{figure}


\section{bottom alignment -- [b]}
\begin{figure}[htb]
\fbox{%
\begin{minipage}[b]{0.45\textwidth}%
\includegraphics[width=20mm,height=20mm,keepaspectratio]{bild}
\caption{Karte}
\end{minipage}}
\hfill
\fbox{%
\begin{minipage}[b]{0.45\textwidth}%
\begin{tabular}{|c|c|}\hline
Einwohnerzahl & 705 \\\hline
Fl\"ache & 17,41km$^{2}$\\\hline
H\"ohe \"uber NN & 440m \\\hline
Kennzeichen & HZ \\\hline
\end{tabular}
\caption{Zusammenfassung}
\end{minipage}}
\end{figure}





\chapter{Bild neben Bild}
\section{top alignment an der Grundlinie - [t]}
\begin{figure}[htb]
\fbox{%
\begin{minipage}[t]{0,45\textwidth}%
\centering
\includegraphics[width=10mm,height=10mm,keepaspectratio]{bild}%
\caption{Bild links}
\end{minipage}}
\hfill
\fbox{%
\begin{minipage}[t]{0,45\textwidth}%
\centering
\includegraphics[width=10mm,height=5mm,keepaspectratio]{bild}%
\caption{Bild rechts mit einer sehr langen Unterschrift,
die m\"oglichst zu vermeiden ist}
\end{minipage}}
\end{figure}


\section{top alignment -- [t] + vspace}
\begin{figure}[htb]
\fbox{%
\begin{minipage}[t]{0,45\textwidth}%
\vspace*{0pt}
\centering
\includegraphics[width=10mm,height=10mm,keepaspectratio]{bild}%
\caption{Bild links}
\end{minipage}}
\hfill
\fbox{%
\begin{minipage}[t]{0,45\textwidth}%
\vspace*{0pt}
\centering
\includegraphics[width=10mm,height=5mm,keepaspectratio]{bild}%
\caption{Bild rechts mit einer sehr langen Unterschrift,
die m\"oglichst zu vermeiden ist}
\end{minipage}}
\end{figure}


\section{top alignment -- [t][hoehe][c]\{breite\} }
\begin{figure}[htb]
\fbox{%
\begin{minipage}[t][][c]{0,45\textwidth}%
\centering
\includegraphics[width=10mm,height=10mm,keepaspectratio]{bild}%
\caption{Bild links}
\end{minipage}}
\hfill
\fbox{%
\begin{minipage}[t][][c]{0,45\textwidth}%
\centering
\includegraphics[width=10mm,height=5mm,keepaspectratio]{bild}%
\caption{Bild rechts mit einer sehr langen Unterschrift,
die m\"oglichst zu vermeiden ist}
\end{minipage}}
\end{figure}


\clearpage
\section{bottom alignment -- [b][hoehe][c]\{breite\}}
\begin{figure}[htb]
\fbox{%
\begin{minipage}[b][][c]{0,45\textwidth}%
\centering
\includegraphics[width=10mm,height=10mm,keepaspectratio]{bild}%
\caption{Bild links}
\end{minipage}}
\hfill
\fbox{%
\begin{minipage}[b][.2\textheight][c]{0,45\textwidth}%
\centering
\includegraphics[width=10mm,height=5mm,keepaspectratio]{bild}%
\caption{Bild rechts mit einer sehr langen Unterschrift,
die m\"oglichst zu vermeiden ist}
\end{minipage}}
\end{figure}

\end{document}


edico

beachen
14-05-2008, 11:58
danke, die antwort mit dem [t] hat mir sogar gereicht, weil meine Bilder gleichgroß sind.

beachen