Graphics, Figures & Tablestable + picture = misalignment?

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Sagil
Posts: 20
Joined: Tue Mar 24, 2009 1:15 am

table + picture = misalignment?

Post by Sagil »

I've been trying to stick a table and a picture next to each other:

Code: Select all

\newcommand{\domwedge}{\pswedge[fillstyle=solid,fillcolor=lightgray,linestyle=none]{20}{-26.565}{116.565}}
\newcommand{\domedge}{\pswedge[linestyle=dashed]{20}{-26.565}{116.565}}
\newcommand{\skyline}[1]{\rmultiput{\domwedge}#1 \rmultiput{\domedge}#1 \psdots#1}
\[
\begin{tabular}{|c|c|c|}
\hline ID & price & milage\\
\hhline 1 & 4,900 & 180\\
\hline 2 & 5,000 & 150\\
\hline 3 & 9,499 & 100\\
\hline 4 & 9,500 & 98\\
\hline 5 & 9,600 & 97\\
\hline 6 & 9,900 & 96\\
\hline 7 & 9,950 & 96\\
\hline 8 & 9,999 & 96\\
\hline 9 & 10,000 & 96\\
\hline 10 & 15,000 & 50\\
\hline 11 & 17,500 & 49\\
\hline
\end{tabular}
\quad
\begin{pspicture*}[xunit=2.5mm,yunit=2.5mm](-1.4,-1.2)(5,5)
\psaxes[Dx=5,dx=5,Dy=50,dy=5]{->}(20,20)
\rput(10,-4){price \small($\times \$1000$)}
\rput{90}(-5,10){milage \small($\times 1000km$)}
\skyline{(5,14)(14,5)(9,9)}
\psdots(4.5,16)(16,4.5)(8.5,11)(11,8.5)
\psdots(8,13.5)(13.5,8)
\end{pspicture*}
\]
Unfortunately, I get a somewhat mal-aligned result:
latexskylineproblem.gif
latexskylineproblem.gif (24.38 KiB) Viewed 2907 times
Having just the table or just the picture works fine. Any ideas what's causing this?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Re: table + picture = misalignment?

Post by localghost »

Why do you place these two objects into a display math environment?


Best regards
Thorsten
Sagil
Posts: 20
Joined: Tue Mar 24, 2009 1:15 am

Re: table + picture = misalignment?

Post by Sagil »

That was just a quick way for centering. The same thing (slightly worse even) happens with a center environment though. I've also tried sticking them into array cells, same result.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

table + picture = misalignment?

Post by localghost »

Try an optional alignment parameter for the tabular environment.

Code: Select all

\begin{tabular}[b]{|c|c|c|}
% table contents
\end{tabular}
Now you can go back to using the center environment.
Sagil
Posts: 20
Joined: Tue Mar 24, 2009 1:15 am

Re: table + picture = misalignment?

Post by Sagil »

Great, that works! Regardless of center or display math! :)

Thanks, Henning
Post Reply