Skip to content

21 col width@main#22

Open
ayogasekaram wants to merge 4 commits into
mainfrom
21_col_width@main
Open

21 col width@main#22
ayogasekaram wants to merge 4 commits into
mainfrom
21_col_width@main

Conversation

@ayogasekaram
Copy link
Copy Markdown
Contributor

closes #21

@ayogasekaram ayogasekaram requested a review from ddsjoberg March 6, 2025 22:05
Comment thread 12_col_widths.qmd Outdated
```

[Preview the Output](outputs/pdf/col_widths_qmd_pdf.pdf)
- column width applied but the table is cut off if it doesn't fit in the page
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you update the widths using gt::pct() so they don't flow over the page? We just want to know if the Word and PDF outputs respect the specified widths.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done! The results in the exported docs seem to be the same as the ones with the px() function.

@ddsjoberg
Copy link
Copy Markdown
Collaborator

The home page has a github icon, but when we click it, it does not direct to the GH page. Can you update that?

Comment thread 12_col_widths.qmd Outdated

library(gtsummary)
tbl <- gtsummary::tbl_summary(gtsummary::trial, by = trt, include = c(age, grade), missing = "always", label = list(age = "Age \n\U00A0\U00A0linebreak in a cell")) |> add_overall()
gt_table <- tbl$table_body |>
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does the table look like if instead of tbl$table_body we used as_tibble(cols_label=FALSE)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed it so that it's just modifying the gtsummary table converted to gt with as_gt()

Comment thread 12_col_widths.qmd Outdated
gt::tab_header(gt::md("This is the Title \nwith a linebreak"), subtitle = "This is the Subtitle") |>
gt::cols_width(everything() ~ px(200)) #apply a 200 px width to all columns
```

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be helpful to print the table here that we're exporting to Word and PDF. Then we know what the goal is. Can you make that change in all the sections?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great point! I've updated all the pages so that first chunk of code is evaluated and the table is displayed in the html output.

… adjust column width. Reorder docs 11 and 12
@Melkiades
Copy link
Copy Markdown
Contributor

I think there are too many conflicts here. What do you think it is best to do @ayogasekaram?

Merge branch 'main' into 21_col_width@main

# Conflicts:
#	01_line_breaks.qmd
#	02_indentation.qmd
#	03_spanning_header.qmd
#	04_footnotes.qmd
#	05_source_notes.qmd
#	06_titles.qmd
#	07_alignment.qmd
#	08_text_styling.qmd
#	09_tbl_too_long.qmd
#	10_tbl_too_wide.qmd
#	_quarto.yml
#	_site/outputs/docx/col_widths_gt_word.docx
#	_site/outputs/docx/col_widths_qmd_word.docx
#	_site/outputs/docx/col_widths_rmd_word.docx
#	_site/outputs/pdf/col_widths_gt_pdf.pdf
#	_site/outputs/pdf/col_widths_qmd_pdf.pdf
#	_site/outputs/pdf/col_widths_rmd_pdf.pdf
#	docs/01_line_breaks.html
#	docs/02_indentation.html
#	docs/03_spanning_header.html
#	docs/04_footnotes.html
#	docs/05_source_notes.html
#	docs/06_titles.html
#	docs/07_alignment.html
#	docs/08_text_styling.html
#	docs/09_tbl_too_long.html
#	docs/10_tbl_too_wide.html
#	docs/12_other_engines.html
#	docs/index.html
#	docs/search.json
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

Successfully merging this pull request may close these issues.

Can we add a section for setting column widths?

3 participants