Graphics, Figures & TablesFigure and Table side by side

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Amitavo Roy
Posts: 14
Joined: Sat Apr 06, 2013 11:50 am

Figure and Table side by side

Post by Amitavo Roy »

I want to make table and figure side by side. I am using this code, but output looks not good (table and figure both are going far from each other horizontally). Could you please suggest me how I can put them together with small horizontal gap between them? Figure is attached.

Code: Select all

\newsavebox{\tempbox}
\begin{figure}
        \centering
        \sbox{\tempbox}{
    \begin{tabular}{|l|l|}
        \hline
        $\bf Parameters$  & $\bf Values$ \\ \hline
        $L_d/L_R/L_u$(mm) & 20/14/10     \\ \hline
        $\theta_d/\theta_R/\theta_u(^0)$ & 2.4/0/3.2  \\ \hline
        Smoothing $L_{s,d}/L_{s,u}$(mm)  & 3.2/3.2    \\ \hline
        $R_R/R_i/R_b$(mm) & 33/10/11.4  \\ \hline
        $\theta_i(^0)$ & -1  \\ \hline
    \end{tabular}
        }
        \subfloat[]{\usebox{\tempbox}}%
        \subfloat[]{
                \vbox to \ht\tempbox{\includegraphics[width=5cm]{graphics/12a}}
        }
\caption{Optimized sample cavity geometry -----}
\end{figure}
Attachments
12a.pdf
Figure
(24.57 KiB) Downloaded 501 times

Recommended reading 2024:

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

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

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Figure and Table side by side

Post by Johannes_B »

Can you please provide a proper Infominimal working example? It's just easier for us to help you. Also, you might want to take a look at the booktabs package.

Regards
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Amitavo Roy
Posts: 14
Joined: Sat Apr 06, 2013 11:50 am

Figure and Table side by side

Post by Amitavo Roy »

I want to make table and figure side by side. I am using this code, but output looks not good (table and figure both are going far from each other horizontally). Could you please suggest me how I can put them together with small horizontal gap between them. Figure is attached.

Code: Select all

\newsavebox{\tempbox}
\begin{figure}
\centering
\sbox{\tempbox}{
\begin{tabular}{|l|l|}
\hline
Parameters    &     Values$             \\ \hline
L             &     20                   \\ \hline
d             &     2.4                  \\ \hline
L             &     3.2                  \\ \hline
R             &     33                   \\ \hline
i             &     -1                   \\ \hline
\end{tabular}
}
\subfloat[]{\usebox{\tempbox}}%
\subfloat[]{
\vbox to \ht\tempbox{\includegraphics[width=5cm]{graphics/12a}}
}
\caption{Optimized sample cavity geometry -----}
\end{figure}
Attachments
12a.pdf
Figure
(24.57 KiB) Downloaded 516 times
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Figure and Table side by side

Post by localghost »

You have been asked for a proper, self-contained and minimal example. For some reason you decided not to follow the link that Johannes has given you but to repeat your inadequate problem description instead. If you expect help here, it is recommendable that you follow the corresponding link and obey the instructions you will find.

And by the way. One full stop to end a sentence is enough (others have been edited out). We are in a serious forum here and not in a chat. So we can expect properly written and formatted messages. Furthermore you should use the »Code« button in the button list right above the input window when composing a message to tag code as such. Please keep that in mind for the future so that editing in this regard won't be necessary any more.


Thorsten
Amitavo Roy
Posts: 14
Joined: Sat Apr 06, 2013 11:50 am

Re: Figure and Table side by side

Post by Amitavo Roy »

Thanks Thorsten

Sorry If you have problem with my code presentation...
But I know it is a serious forum to learn LaTex...I also dont want to chat...I want to learn as a beginner I am trying to gain some good points from you people..not to creat any problem...

Regarding your previous masg...I assume that my code lines are so dense that no one can not understand properly what I want to do with this code line thats why I did clear seperation of those line to represent it clearly...not any intension not to follow your instructions...Here I want to learn by following your instructions...

Anyway sorry...
User avatar
sommerfee
Posts: 503
Joined: Mon Apr 09, 2007 4:20 pm

Re: Figure and Table side by side

Post by sommerfee »

Amitavo Roy,

If your car is making problems in curves, what do you do? Do you go to the mechanics just with the steering wheel? No, you give him your car so he is able to reproduce the problem and able to repair the car for you.

But this is what you are doing here, you just offer us your steering wheel (=code snipped) and not a car (=example document).

Without minimal example document we don't even know the requested LaTeX environment (required packages to show the unwanted behavior, what document class is used etc.), and without it we have no example document to play around with, and are not able to post it back fixed.

So in short: To be able to help you we need a minimal example document. If you don't know what this is and how to prepare one for us, please read the link already given: http://theoval.cmp.uea.ac.uk/~nlct/late ... index.html
Post Reply