Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5991639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:24:58+00:00 2026-05-22T23:24:58+00:00

I have data tables (d1 and d2) which I would like to print side

  • 0

I have data tables (d1 and d2) which I would like to print side by side or on top of each other in latex with their own individual titles. Is it possible to do that directly with xtable()? The two tables should be distinct, i.e. we could call them Table x(a) and Table x(b), but they should be either adjacent, or stacked.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T23:24:59+00:00Added an answer on May 22, 2026 at 11:24 pm

    I would recommend saving the results as two separate tables in different files (see the file= option to print.xtable()), and then input them into your LaTeX document with any command you find appropriate for your layout (tabular, subfloat, minipage, etc.). This is what I do in general, although I generally rely on LaTeX facilities in the Hmisc package. Should you want only to print them as a standalone PDF, use the standalone class for your document.

    So, here is an example:

    data(tli)
    fm1 <- aov(tlimth ~ sex + ethnicty + grade + disadvg, data=tli)
    print(xtable(fm1), file="ta.tex", floating=FALSE)
    print(xtable(head(tli, n=5)), file="tb.tex", floating=FALSE)
    

    then, a quick tex wrapper (compile with pdflatex):

    \documentclass{article}
    \usepackage{subfig}
    \usepackage{graphicx}
    
    \begin{document}
    
    \begin{table}[ht]
    \centering
    \subfloat[Table x(a)]{\label{tab:tab1a}\scalebox{.5}{\input{./ta}}}\quad
    \subfloat[Table x(b)]{\label{tab:tab1b}\scalebox{.5}{\input{./tb}}}
    \caption{Caption about here}
    \label{tab:tab1}
    \end{table}
    
    \end{document}
    

    Here is the result:

    enter image description here

    Remove the \scalebox command for default (stacked) layout, unless they are narrow enough to fit at their default size, as noted by @David.

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two different tables from which I need to pull data blogs which
I have approx 10M rows of data across 20 tables, which I process once
I have a small database with tables containing a small amount of data which
I have an html table which i bind data dynamically on the server side
I have legacy database and tables that I would like to try to import
I have a data table which already has some values, plus it is getting
I have tabled data in which most of the cells are text inputs or
I have a sql table which have the following data, Id City Country ---
I have to get data from Oracle Table in which I have one datefield
I have a table which holds flight schedule data. Every schedule have an effective_from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.