Rendering citation in flextable to Word document

Open
#10,582 1 comment 0 reactions 1 assignee View on GitHub

@cscheid is already working on this.

Since Aug 22, 2024.

Assessment

This issue has not been assessed yet.

Description

bug docx tables
Bug description

When rendering a citation in a flextable cell to a Word document, the citation formats, but the hypertext linkage to the reference is not included. The hand icon appears when the ctrl button is pushed and hovered over blue text in the citation, but no linkage. The citation and linkage works fine in text.

Steps to reproduce
---
title: "Flextable Rendering in Word"
format:
  docx:
    number-figures: true
    number-tables: true
    number-sections: true
    toc: false

execute:
  echo: false

bibliography: flextable_render_example.bib
link-citations: true
---

```{r setup}
#| warning: false

library(flextable)
library(ftExtra)
library(tidyr)
library(dplyr)

knitr::opts_chunk$set(cache = TRUE)

```

As shown in @tbl-chum-lh-param by @Tynan1997.

```{r}
#| label: tbl-chum-lh-param
#| tbl-cap: "Summer chum salmon life cycle model parameters"

tb <- tibble(
  Parameter = "Average number of natural spawners",
  `Value(s)` = "2,343.6",
  Source = "@Tynan1997",
  Comment = "Years 2017 - 2021"
) 

  ft <- flextable(tb) |> 
  fontsize(size = 9, part = "all") |>
  width(
    j = c(1:4),
    width = c(2.0, 1.5, 1.5, 1.5)
  ) |> 
  bold(part="header") |> 
  align(align="center", part = "header") |> 
    colformat_md("Source")
  
  ft

```

References

::: {#refs}
:::

flextable_render_example.bib.txt
flextable_example.docx

Expected behavior

The citation should be rendered just like in text and be hyperlinked to the references.

Actual behavior

The citation renders, but there is no hyperlink.

Your environment

RStudio 2023.12.1 Build 402

Windows 10 Enterprise

Quarto check output

$ quarto check
Quarto 1.4.551
[>] Checking versions of quarto binary dependencies...
Pandoc version 3.1.11: OK
Dart Sass version 1.69.5: OK
Deno version 1.37.2: OK
[>] Checking versions of quarto dependencies......OK
[>] Checking Quarto installation......OK
Version: 1.4.551
Path: C:\Program Files\Quarto\bin
CodePage: 1252

[>] Checking tools....................OK
TinyTeX: (external install)
Chromium: (not installed)

(|) Checking LaTeX....................
(/) Checking LaTeX....................
(-) Checking LaTeX....................
() Checking LaTeX....................
(|) Checking LaTeX....................
(/) Checking LaTeX....................
[>] Checking LaTeX....................OK
Using: TinyTex
Path: C:\Users\alan.olson\AppData\Roaming\TinyTeX\bin\windows
Version: 2023

(|) Checking basic markdown render....
(/) Checking basic markdown render....
(-) Checking basic markdown render....
() Checking basic markdown render....
(|) Checking basic markdown render....
(/) Checking basic markdown render....
[>] Checking basic markdown render....OK

(|) Checking Python 3 installation....
(/) Checking Python 3 installation....
[>] Checking Python 3 installation....OK
Version: 3.12.1
Path: C:/Users/alan.olson/AppData/Local/Programs/Python/Python312/python.exe
Jupyter: (None)

  Jupyter is not available in this Python installation.
  Install with py -m pip install jupyter

(|) Checking R installation...........
(/) Checking R installation...........
(-) Checking R installation...........
[>] Checking R installation...........OK
Version: 4.3.2
Path: C:/PROGRA1/R/R-431.2
LibPaths:
- C:/Users/alan.olson/AppData/Local/R/win-library/4.3
- C:/Program Files/R/R-4.3.2/library
knitr: 1.48
rmarkdown: 2.28

(|) Checking Knitr engine render......
(/) Checking Knitr engine render......
(-) Checking Knitr engine render......
() Checking Knitr engine render......
(|) Checking Knitr engine render......
(/) Checking Knitr engine render......
(-) Checking Knitr engine render......
() Checking Knitr engine render......
(|) Checking Knitr engine render......
(/) Checking Knitr engine render......
(-) Checking Knitr engine render......
() Checking Knitr engine render......
(|) Checking Knitr engine render......
(/) Checking Knitr engine render......
[>] Checking Knitr engine render......OK

Dominant language
JavaScript
Stars
6k
Forks
458
Avg merge
1d 9h
Merged PRs (30d)
41

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from quarto-dev/quarto-cli

All issues in quarto-dev/quarto-cli

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.