quarto-dev / quarto-dev/quarto-cli

Figure rendered inside a table in MS Word when using fig-cap

Open
#4,004 10 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

It'd be nice to change how this is laid out for the reasons pointed out, but we currently hard code that decision.

Discussed in https://github.com/quarto-dev/quarto-cli/discussions/3999

Originally posted by jtrecenti January 17, 2023
Hi! Thank you very much for developing Quarto. It is awesome.

I was trying to tweak table styles in MS Word (painful, but needed) when I realized that this code:

---
title: "Untitled"
format: docx
---

Lets's see @fig-aaa.

```{r}
#| label: fig-aaa
#| fig-cap: a nice figure.
plot(1:10)

generates this document:

image

Note the "+" sign on the top left of the image and the table styling options at the top menu, indicating that we are inside a table.

So, apparently, when we use fig-cap:, it wraps the figure and the caption inside a 1-cell table.

Two questions

  1. Is this the desired behavior?
  2. Is it possible to turn it off?

Thanks!

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.

Research direction

Start by reading the linked Discussion #3999 and reproducing the supplied R example with docx output and fig-cap. Trace how Quarto represents a figure with a caption and how that becomes a one-cell table in the Word document. Done means the intended layout is established and the hard-coded table behavior is either changed or made controllable without losing the caption.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.