1
votes

I've just started writing my PhD thesis in Bookdown and so far things are going great. The one problem I do have though is that figure captions when outputted to PDF format seem to take up only about 60% of the page width, and are centered. This is great for short captions, but most of my figure captions are in the region of 50 words long for complicated panels. Is there some LaTeX magic to make them the width of the page?

Thanks Tom

Here is what I'm using in my .md file:

| Reagent                  | Amount   |
| ------------------------ | -------- |
| Appropriate Buffer (10x) | 1x       |
| DNA                      | 50-500ng |
| Restriction Enzyme       | 1*U*     |
| Water                    | -        |

Table: (\#tab:restriction-generic) Schematic for restriction digestion with a single restriction enzyme.
1
Can you provide a minimal reproducible example? For bookdown this is often possible via a Rmd file that uses bookdown::pdf_document2 as output. - Ralf Stubner
Added my table code to the OP. I am currently making simple tables (no R code) using Markdown alone, but I'd like all tables to be consistent: full width with full width captions - Tom Kent

1 Answers

3
votes

You can make use of the LaTeX package caption:

---
output: 
  bookdown::pdf_document2
header-includes:
- \usepackage[width=\textwidth]{caption}
---

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.

| Reagent                  | Amount   |
| ------------------------ | -------- |
| Appropriate Buffer (10x) | 1x       |
| DNA                      | 50-500ng |
| Restriction Enzyme       | 1*U*     |
| Water                    | -        |

Table: (\#tab:restriction-generic) Schematic for restriction digestion with a single restriction enzyme. Some really long text that shows how the caption is formatted when it takes multiple lines.

Output:

enter image description here