Rmarkdown document format requires a nonempty <title> element.

I have always used the following YAML header for my Rmarkdown files without any problems:

---
title: "Testfile"
author: "Name"
date: "`r Sys.Date()`"
output: 
  html_notebook: 
    pandoc_args: [ 
      "--number-offset=1,0" 
    ]
    fig_caption: true
    number_sections: yes
    toc: yes
    toc_depth: 3
---

But starting with today I got the following warning message whenever I save the file:

[WARNING] Could not parse YAML metadata at line 21 column 1: :8:28: Unexpected '
  '
[WARNING] This document format requires a nonempty <title> element.
  Please specify either 'title' or 'pagetitle' in the metadata,
  e.g. by using --metadata pagetitle="..." on the command line.
  Falling back to '02-Data-Summaries.utf8'

02-Data-Summaries.Rmd" was the name of the file when I saved it the first time. So any changes to the title have no effect.

All the text and code of the Rmarkdown file is created correctly except that it misses the first three lines of the YAML header: title, name, and date.

I found out that the problem is related to the pandoc_arcs directive. When I delete the offending lines

    pandoc_args: [ 
      "--number-offset=1,0" 
    ]

then saving the file does not produce a warning anymore.
UPDATE: I noticed that it worked without brackets:

pandoc_args: --number-offset=1,0

What might be wrong here? A missing or wrong update? See my session info:

─ Session info 
 setting  value                       
 version  R version 3.6.1 (2019-07-05)
 os       macOS Mojave 10.14.6        
 system   x86_64, darwin15.6.0        
 ui       RStudio                     
 language (EN)                        
 collate  en_US.UTF-8                 
 ctype    en_US.UTF-8                 
 tz       Europe/Vienna               
 date     2019-08-04                  

─ Packages 
 package     * version date       lib source        
 assertthat    0.2.1   2019-03-21 [1] CRAN (R 3.6.0)
 backports     1.1.4   2019-04-10 [1] CRAN (R 3.6.0)
 base64enc     0.1-3   2015-07-28 [1] CRAN (R 3.6.0)
 callr         3.3.1   2019-07-18 [1] CRAN (R 3.6.0)
 cli           1.1.0   2019-03-19 [1] CRAN (R 3.6.0)
 clipr         0.7.0   2019-07-23 [1] CRAN (R 3.6.0)
 crayon        1.3.4   2017-09-16 [1] CRAN (R 3.6.0)
 curl          4.0     2019-07-22 [1] CRAN (R 3.6.0)
 desc          1.2.0   2018-05-01 [1] CRAN (R 3.6.0)
 devtools    * 2.1.0   2019-07-06 [1] CRAN (R 3.6.0)
 digest        0.6.20  2019-07-04 [1] CRAN (R 3.6.0)
 evaluate      0.14    2019-05-28 [1] CRAN (R 3.6.0)
 fs            1.3.1   2019-05-06 [1] CRAN (R 3.6.0)
 glue          1.3.1   2019-03-12 [1] CRAN (R 3.6.0)
 htmltools     0.3.6   2017-04-28 [1] CRAN (R 3.6.0)
 jsonlite      1.6     2018-12-07 [1] CRAN (R 3.6.0)
 knitr         1.23    2019-05-18 [1] CRAN (R 3.6.0)
 magrittr      1.5     2014-11-22 [1] CRAN (R 3.6.0)
 memoise       1.1.0   2017-04-21 [1] CRAN (R 3.6.0)
 packrat       0.5.0   2018-11-14 [1] CRAN (R 3.6.0)
 pkgbuild      1.0.3   2019-03-20 [1] CRAN (R 3.6.0)
 pkgload       1.0.2   2018-10-29 [1] CRAN (R 3.6.0)
 prettyunits   1.0.2   2015-07-13 [1] CRAN (R 3.6.0)
 processx      3.4.1   2019-07-18 [1] CRAN (R 3.6.0)
 ps            1.3.0   2018-12-21 [1] CRAN (R 3.6.0)
 R6            2.4.0   2019-02-14 [1] CRAN (R 3.6.0)
 Rcpp          1.0.2   2019-07-25 [1] CRAN (R 3.6.0)
 remotes       2.1.0   2019-06-24 [1] CRAN (R 3.6.0)
 reprex      * 0.3.0   2019-05-16 [1] CRAN (R 3.6.0)
 rlang         0.4.0   2019-06-25 [1] CRAN (R 3.6.0)
 rmarkdown     1.14    2019-07-12 [1] CRAN (R 3.6.0)
 rprojroot     1.3-2   2018-01-03 [1] CRAN (R 3.6.0)
 rsconnect     0.8.15  2019-07-22 [1] CRAN (R 3.6.0)
 rstudioapi    0.10    2019-03-19 [1] CRAN (R 3.6.0)
 rversions     2.0.0   2019-05-09 [1] CRAN (R 3.6.0)
 sessioninfo   1.1.1   2018-11-05 [1] CRAN (R 3.6.0)
 stringi       1.4.3   2019-03-12 [1] CRAN (R 3.6.0)
 stringr       1.4.0   2019-02-10 [1] CRAN (R 3.6.0)
 testthat      2.2.1   2019-07-25 [1] CRAN (R 3.6.0)
 usethis     * 1.5.1   2019-07-04 [1] CRAN (R 3.6.0)
 whisker       0.3-2   2013-04-28 [1] CRAN (R 3.6.0)
 withr         2.1.2   2018-03-15 [1] CRAN (R 3.6.0)
 xfun          0.8     2019-06-25 [1] CRAN (R 3.6.0)
 xml2          1.2.1   2019-07-29 [1] CRAN (R 3.6.0)
 yaml          2.2.0   2018-07-25 [1] CRAN (R 3.6.0)

I don't know where it changed but I think the format is this one

    pandoc_args: [ 
      "--number-offset", "1,0" 
    ]

At least it is as is in the Documentation Book

ok. This is just an incorrect indentation.

This works for me

---
title: "Testfile"
author: "Name"
date: "`r Sys.Date()`"
output: 
  html_notebook:
    pandoc_args: [
      "--number-offset=1,0"
      ]
    fig_caption: true
    number_sections: yes
    toc: yes
    toc_depth: 3
---

not the closing ] is indented 2 more spaces. I think Rmarkdown gets it correct this way.
Can you try on your setup ?

Yep! Thank you! The missing/wrong indention was the problem.

This upcoming package might be helpful for the future! Let the computer figure out the indents :grin:

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.