rmarkdown 1.12 -- TOC (table of contents) is broken

Room is made for the TOC along the left side, but only a horizontal line appears.

When I downgraded to rmarkdown 1.11, the TOC worked again.

install.packages("https://cran.r-project.org/src/contrib/Archive/rmarkdown/rmarkdown_1.11.tar.gz", repos = NULL,type='source')

This is reproducible, going back & forth between 1.11 and 1.12,
across my complicated app and a very simple example.

I thought this was the kind of problem that packrat is supposed to prevent... My buddy cloned my project with 1.10 in it, but apparently his rmarkdown 1.12 overrode packrat's rmarkdown 1.10. Anyone wish to give me a better understanding of packrat?

Is your primary question about the TOC issue or packrat? It might help to clarify that.

In some quick tests I didn't see any problems with adding a TOC in a variety of different formats with rmarkdown_1.12. It would be great to get a reproducible example. Can you add the code for the simple example you referenced in your question that demonstrates the problem?

The key question is, why is packrat not working.
If it works right, whatever problem there is with 1.12 is (for me) moot.
But this thread can help others who encounter the same problem,
and maybe the developer will be interested.

Here is my test code. Clicking "Run Document",
it looks like the TOC flashes briefly and disappears.
Removing the "runtime: shiny" ,
it doesn't run at all (knitr button).

---
title: "TestingTOC"
runtime: shiny
output:
  html_document:
    number_sections: yes
    toc: yes
    toc_depth: 6
    toc_float:
      collapsed: no
      smooth_scroll: no
---

# A title
## A subtitle
### A subsubtitle

# A title
## A subtitle
### A subsubtitle

About packrat, several points to check :

  • Is packrat project activated when you open the project ?
    Check that .libPaths() points to your project library.
    if not, you need to activate packrat::on()
  • Are packages all restored inside packrat library ?
    packrat::status() should help you with that to see if the :package: mentioned in the lockfile are already all installed.
  • Is the packrat lockfile up to date ? Does it contains the correct version you want your project to depend about.

Hope it helps.

Note: Next version of packrat will be in this new package

Easier to use and clearer API but still in dev.

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.

FYI this issue has been fixed in the current development version of rmarkdown: https://github.com/rstudio/rmarkdown/issues/1577#issuecomment-502876695

1 Like