michal-h21 / make4ht

Build system for tex4ht
137 stars 15 forks source link

Using preprocess_input for an Rmd file does not work with citations #64

Closed jmclawson closed 2 years ago

jmclawson commented 2 years ago

The option of using preprocess_input on an R Markdown file uses some default Pandoc template that doesn't support Biblatex (or indeed Markdown citations), and it doesn't respect Knitr's common YAML interface for choosing a different document template.

Consider the following simple R Markdown document:

---
title: Simple R Markdown
author: John Smith
output: 
  pdf_document:
    keep_tex: yes
    template: mytemplate.tex
    citation_package: biblatex
biblio-style: mla
bibliography: sample.bib
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)

Introduction

It is common to use citations in academic writing [@darwin1859aa, 12].



When this document is knit by R Studio, it'll use Knitr and Pandoc to produce a `.tex` file from my template and then use Latex to typeset it into a PDF. If I then use make4ht on this intermediary `.tex` file, that will successfully produce an `.odt` file to open in Microsoft Word using this: `make4ht -f odt -e mybuild.mk4 simple.tex` (The `mybuild.mk4` file is [described here](https://tex.stackexchange.com/questions/301287/chicago-style-punctuation-in-references-with-tex4ht-and-biblatex-chicago/450009#450009).)

But I can't skip the intermediary step using `+ preprocess_input` on the original `.rmd` file:
`make4ht -e mybuild.mk4 -f odt+preprocess_input simple.rmd`
The resulting file does not convert the citations into the expected format.
michal-h21 commented 2 years ago

Thanks for the fix!