Search code examples
r-markdownpandoctabular

Manually create a table and automatically number its caption, word output


I'd like to display my table caption on top of a manually typed table. I'm using the following code but the caption does not show in the knitted output. Please see how I could improve my code. Thank you and happy new year.

---
title:
author:
date:
output:
  word_document:
    toc: yes
  highlight: tango
documentclass: book
---

[Table: table name] 
| column 1 | column 2 | column 3|
| -------- | -------- | --------|
| 1 | a | b | 
| 2 | c | d | 

Solution

  • Pandoc's syntax for tables is

    : table name
    
    | column 1 | column 2 | column 3|
    | -------- | -------- | --------|
    | 1 | a | b | 
    | 2 | c | d |
    

    This is how it looks like in Word:

    word output

    And belated happy new year to you too!