0

In a R markdown html file I constructed, toc works on my laptop but not if I open the saved file on other computers. By “not working” I mean, clicking the toc bullet points won’t lead to the respective section. Either nothing happens or the result is a blank page, depends on the browser. The computers “elsewhere” belong to an institution (hospital), not sure what are the implications of that except that I have no administrate privilege to them.

Here are more details:

The file is something like this:


---
title: 'very interesting analysis'
author: "my name"
date: "3/14/1592"
output:
  html_document:
    toc: yes
    theme: united
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)

headline 1a

headline 2a

Text, code chunks, output

headline 2b

Text, code chunks, output

headline 2c

Text, code chunks, output

headline 1b

headline 2c

Text, code chunks, output

headline 2d

Text, code chunks, output

Here is what I tried so far:

  • When I knit the code on my laptops - toc works well on the two of them.
  • I open the file on a browser - Chrome or Edge - toc still works well.
  • I save the html file locally, then open it - still works well.
  • I attach the html to a draft email – this is so I can download it anywhere. If I download from the draft email to my laptops, toc still works well.
  • But when I download the file to computers elsewhere, the toc is printed but clicking the toc bullet point doesn’t lead to the respective section, as described above.

Does anyone have an idea why is that, and whether there is anything I can change in the file to have a more consistent effect across computers?

Gal Levin
  • 39
  • 7
  • It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input that can be used to test and verify possible solutions. Does this happen for any Rmarkdown document or just one in particular. It would be helpful to at least see the YAML header in your file. Are you using math typesetting in your document? Are testing your own file in your own browser, or just using RStudio? – MrFlick Jun 30 '21 at 19:39
  • Thanks. I assumes this is a more general issue than the details of my "case", but following your suggestion, I added more details. – Gal Levin Jul 04 '21 at 23:14

0 Answers0