Skip to content

Combining Output Formats #2568

@franceskoi

Description

@franceskoi

Is it possible that functions from the both bookdown and officedown are taken into account at the output? For instance, when I write this code (Version 1 of the .Rmd document):

---
title: "Analysis"

output: 
  officedown::rdocx_document:
    reference_docx: "reference.docx"
  bookdown::word_document2:
    reference_docx: "reference.docx"  
bibliography: references.bib
---


{r setup, include=FALSE}
knitr::opts_chunk$set(
	echo = TRUE,
	message = FALSE,
	warning = FALSE,
	out.width = NULL,
  out.height = NULL
)



# Header1

## Header2

### Header3

Lorem Ipsum Lorem Ipsum Lorem Ipsum

<br>

Lorem Ipsum:

-   Lorem Ipsum (Image: \@ref(fig:img1))

<br>




{r img1, echo=FALSE, message=FALSE, warning=FALSE, fig.height =2, fig.cap="Image 1", fig.id = "img1", fig.cap.style = "Image Caption"}
library(tidyverse)
library(readxl)
library(officer)   
library(flextable)
library(officedown)
library(ggplot2)
library(grid)
library(jpeg)

img <- readJPEG("rmarkdown_logo.jpg")

grid.raster(img)



<br>

#### Lorem Ipsum

Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum

<!---BLOCK_LANDSCAPE_START--->


{r w_height, echo=FALSE, message=FALSE, warning=FALSE, tab.cap="women height", tab.id = "rezultatiCM816", tab.cap.style = "Table Caption"}
height <- women$height
height




<!---BLOCK_LANDSCAPE_STOP--->


it ignores bookdown (it doesn't do automatic numeration of the chapters and it doesn't do me cross-referencing), but it makes me a landscape page from the officedown, but when I write this code (Version 2 of the .Rmd document):

---
title: "Analysis"

output: 
  bookdown::word_document2:
    reference_docx: "reference.docx" 
  officedown::rdocx_document:
    reference_docx: "reference.docx" 
bibliography: references.bib
---


{r setup, include=FALSE}
knitr::opts_chunk$set(
	echo = TRUE,
	message = FALSE,
	warning = FALSE,
	out.width = NULL,
  out.height = NULL
)



# Header1

## Header2

### Header3

Lorem Ipsum Lorem Ipsum Lorem Ipsum

<br>

Lorem Ipsum:

-   Lorem Ipsum (Image: \@ref(fig:img1))

<br>




{r img1, echo=FALSE, message=FALSE, warning=FALSE, fig.height =2, fig.cap="Image 1", fig.id = "img1", fig.cap.style = "Image Caption"}
library(tidyverse)
library(readxl)
library(officer)   
library(flextable)
library(officedown)
library(ggplot2)
library(grid)
library(jpeg)

img <- readJPEG("rmarkdown_logo.jpg")

grid.raster(img)



<br>

#### Lorem Ipsum

Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum

<!---BLOCK_LANDSCAPE_START--->


{r w_height, echo=FALSE, message=FALSE, warning=FALSE, tab.cap="women height", tab.id = "rezultatiCM816", tab.cap.style = "Table Caption"}
height <- women$height
height




<!---BLOCK_LANDSCAPE_STOP--->

it ignores officedown (it doesn't show me a landscape page), but it puts an automatic numeration for the chapters and cross-refferencing from bookdown.
So, it takes only what is first written. Is there a way to combine these two, so there can be shown an automatic numeration of the chapters and cross-refferencing from bookdown, as well as a landscape page from officedown?

I am sending the outputs for the Version 1 and Version 2 of the output Word documents, as well as the reference Word doc.
Version1.docx
Version2.docx
reference.docx

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions