Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gt table alignment in main column. #79

Open
cassidybargell opened this issue Jun 22, 2020 · 1 comment
Open

gt table alignment in main column. #79

cassidybargell opened this issue Jun 22, 2020 · 1 comment

Comments

@cassidybargell
Copy link

cassidybargell commented Jun 22, 2020

I am including gt tables in a Rmarkdown Tufte-style HTML. I want to align the gt tables in the center of the main column, rather than in the center of the HTML spanning both the main column and margin. I have tried using the fig.align knitr option (does not move the gt table at all) as well as tab.align command (will align the gt table all the way to the left, rather than centered in the main column: tab_options(table.align='left')). Here is a repo with an rmd that can be cloned to show the issue I am having: https://github.com/cassidybargell/gt-tufte.

I have asked this question on Stackoverflow , which includes a screenshot of the html.

Example code of a gt table being used in the Tufte-HTML:

---
title: "gt Alignment"
author: "Cassidy Bargell"
date: "6/20/2020"
output: 
  tufte::tufte_html:
    tufte_variant: "envisioned"
    
  tufte::tufte_handout: default
---

``` {r gt table}

library(gt)

tibble(subject = "Joe",
       ytreat = "13",
       ycontrol = "9",
       ydiff = "+4") %>%  
  gt()

---

By filing an issue to this repo, I promise that

- [x] I have fully read the issue guide at https://yihui.name/issue/.
- [x] I have provided the necessary information about my issue.
    - If I'm asking a question, I have already asked it on Stack Overflow or RStudio Community, waited for at least 24 hours, and included a link to my question there.
    - If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included `xfun::session_info('tufte')`. I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version: `remotes::install_github('rstudio/tufte')`.
    - If I have posted the same issue elsewhere, I have also mentioned it in this issue.
- [x] I have learned the Github Markdown syntax, and formatted my issue correctly.

I understand that my issue may be closed if I don't fulfill my promises.
@cassidybargell
Copy link
Author

The issue can be fixed by making your own css file. Here are the lines of code:

.gt_table {
  margin-left: 0 !important;
  margin-right: 0 !important;
  width: 55% !important;
}

Thank you to Yaodong Yu for the help! @itsyaoyu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant