This document is for people who prefer to use flavors of markdown for their document writing instead of Microsoft Word. When writing in markdown issues arise when converting to pdf. In particular alt text for images are not displayed or transfered resulting in pdfs failing to pass accessibility checks. This document attempts to resolve this issue.
Convert markdown/Rmarkdown files to pdf via word to ensure accessibility checks pass.
- Write document in markdown
- Save as R markdown and add yaml header
- output to docx via a reference doc (template)
- Knit the Rmd file
- Open word doc and convert to pdf
- Open pdf and perform a
full check
(found in the accessibility tab)
To have control over formatting you will need to create a template word docx file. This file should specify things like:
- Title
- Heading 1
- Heading 2
- ...
- Footers
- Headers
- Fonts
- Image styling
etc.
This can be as simple as:
---
title: Create an accessible pdf from markdown
output:
word_document:
reference_docx: template/reference.docx
---
The reference word document (reference.docx) in this example was saved in a direcory called template
All images were created with a resolution of 96 dpi.
Each figure has different number of horizontal and vertical pixels.
Mouse over the image to see its dimensions