LaTeX Latex: minipage for list and table side-by-side

Click For Summary
SUMMARY

The discussion focuses on using the LaTeX minipage environment to align a list and a table side-by-side. The user, gsal, encounters unexpected vertical spacing issues despite adjusting vspace settings. Key insights include the importance of understanding how TeX manages box alignment and the recommendation to use the [b], [m], or [t] options for minipage baselines. Ultimately, the outer tabular environment is suggested as a more effective solution for achieving proper alignment without excessive adjustments.

PREREQUISITES
  • Familiarity with LaTeX minipage environment
  • Understanding of TeX box model and vertical alignment
  • Knowledge of LaTeX tabular environment
  • Experience with LaTeX spacing commands such as \vspace and \hspace
NEXT STEPS
  • Explore LaTeX minipage options for vertical alignment
  • Learn about the TeX box model and how it affects document layout
  • Investigate the use of nested tabular environments in LaTeX
  • Research advanced LaTeX spacing techniques, including negative spaces
USEFUL FOR

LaTeX users, document designers, and anyone looking to improve the layout of complex documents with side-by-side elements.

gsal
Messages
1,065
Reaction score
54
Say, I am trying to learn how to use minipage but there is some space on top of the table that seems to be coming from nowhere...any idea what might be going on? The huge space is still there even when I remove vspace 10pt, besides, 10pt is not that much...anyway.

thanks,

gsal

Code:
\begin{minipage}[b]{0.58\textwidth}
\begin{itemize}
\item Blower flow=1.951 $kg/s$ and uses profiles from equivalent blower model for velocities, temperatures, and turbulence quantities.  The resulting static pressure plus axial velocity head is 4599$Pa$.
\item Vent scoop flow=0.145 $kg/s$ at Tt=334.8$K$.
\item Rotor flow=0.45327 $kg/s$.
\item Static pressure in endbox=3848.7 $Pa$.
\item For stator finger and stator exhaust vents Ps=1051 $Pa$ (the value reported back is 1049.94).
\item For stator intake vents Pt=3741.92 $Pa$.
\item Sector angle for model is 20 deg.
\end{itemize}  
\vspace*{10pt}
\end{minipage}
\hspace{0.5cm}
\begin{minipage}[b]{0.15\textwidth}
\begin{tabular}{|p{1.5cm}|p{2cm}|p{1.cm}|}
\hline
Rotor Vent No. & Radial mass flow ($kg/s$) & Tt ($K$) \\
\hline
1	& 0.014816	& 332.4 \\
2	& 0.014453	& 332.2 \\
3	& 0.013824	& 332.1 \\
4	& 0.013304	& 332.0 \\
5	& 0.012819	& 332.0 \\
6	& 0.012415	& 331.9 \\
7	& 0.012082	& 331.9 \\
8	& 0.011662	& 331.9 \\
9	& 0.011328	& 331.9 \\
10	& 0.011072	& 331.8 \\
11	& 0.010860	& 331.8 \\
12	& 0.010585	& 331.7 \\
13	& 0.010406	& 331.7 \\
14	& 0.010309	& 331.7 \\
15	& 0.010318	& 331.7 \\
16	& 0.010284	& 331.8 \\
17	& 0.010206	& 331.8 \\
18	& 0.010210	& 331.8 \\
19	& 0.010255	& 331.8 \\
20	& 0.010340	& 331.7 \\
21	& 0.010465	& 331.7 \\
22	& 0.010622	& 331.6 \\
23	& 0.010808	& 331.5 \\
24	& 0.010961	& 331.4 \\
25	& 0.011113	& 331.3 \\
26	& 0.011271	& 331.2 \\
27	& 0.011430	& 331.1 \\
\hline
\end{tabular}
\end{minipage}
 

Attachments

  • minipage.png
    minipage.png
    30.9 KB · Views: 2,158
Physics news on Phys.org
You need to understand how TeX builds a page from "boxes and glue".

For normal text, you don't need to bother much about that, because each letter in the font is enclosed by a box that is the right size and shape to fit together properly.

But effectively, you have a "line of text" consisting of a minipage, some space (\hspace), and another minipage. TeX treats each minipage as a single "box" when it is figuring out how to build the line.

Every box has a "baseline position" and TeX adjusts their vertical positions so the baselines match up.

You can set where the baseline is relative to the box with the [m] or [t] options of the minipage. These set the baseline to the bottom, middle, or top of the minipage. Probably you want both to be [t] or both [m], but play around with all the options to see what is going on.

While playing, replace the \hspace between the minipages by a bit of ordinary text, so you can see where TeX is putting the baseline of the complete line.

Your \vspace* inside the first minipage seems like a bad move, because it adds space to the bottom of the minipage and make the alignment even worse. A bigger amount of \vspace at the end of the second minipage might be a different way to fix the problem.
 
Thanks for the hints, they did help, including adding ordinary text to see how the minipages alignment relate to the line.

As you may have noticed, though, the second minipage contains a 'tabular' environment...I removed the table, put ordinary text, played around with widths and alignments and it seems to me that the "tabular" environment does not quite honor the minipage alignment option...the table seems to always be vertically centered with the line...

...is this clear? and most importantly...does it make sense to you?
 
Hm... I played around with your code before I made the post, and I didn't see anything strange from the tabular environment (nor did I expect to).

IIRC "tabular" also has an option to set its top/middle/bottom position, but that should be irrelevant because there is nothing else inside the minipage, and the tabular environment shouldn't leak "outside" the minipage whatever happens.

Try putting \hrule at the top and bottom of your minipages, to see where the space is coming from.

It's possible that "itemize" is adding some white space at the top and bottom, not "tabular".

If all else fails, "negative spaces" like \vspace*{-10pt} are legal.

Or, you could try something like
Code:
begin{tabular}{@{}p{0.58\textwidth)@{\hspace{0.5cm}}p{0.15\textwidth}@{}}
\begin{itemize}
... 
\end{itemize} &
{\begin{tabular}
...
\end{tabular}}
\end{tabular}

You can nest tabular environments, but note the extra pair of { } around the nested one. Mostly I use an document class that has its own version of the tabular environments, and I can't remember if the extra { } are needed with the "standard" tabular, but they won't do any harm.
 
Oh, just re-read your post and noticed the full contents of it...yes, I ended up "fixing" the problem by increasing vspace in the first minipage...in my case, the table is taller than my text, so...

thanks.
 
gsal said:
in my case, the table is taller than my text, so...

I noticed that as well. Plus, your OP didn't say exactly what you wanted the document to look like :smile:
 
It looks like I started my 12:30 post before seeing your 12:24...so, my answer still refers to your 9:49 post.

What I had tried was "table" and then the "minipages" inside of it and it did not make a difference...but I should give a try to your latest suggestion with "tabular" and see if things line up out of the box without having to play around with vspace.

Thanks again.
 
o.k., I checked. The outer "tabular" approach works better and honors the inner "tabular" request for top vertical alignment...no need for minipage and playing around with vspace.

Thanks, again.
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 2 ·
Replies
2
Views
6K
  • · Replies 0 ·
Replies
0
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 2 ·
Replies
2
Views
6K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 5 ·
Replies
5
Views
6K
  • · Replies 2 ·
Replies
2
Views
3K