ekstroem
ekstroem

Reputation: 6151

Remove toc when printing rmarkdown site

I've used the super versatile Rmarkdown package to create a site for a set of seminars extracted and modified using R.

The _site.yml file looks like this

name: "Seminars at Biostatistics, UCPH"
exclude: ["*.Rmd*", "*.json", "Makefile"]
navbar:
  title: "Seminars @ Biostatistics, UCPH"
  left:
    - text: "Upcoming seminars"
      icon: fa-lightbulb-o
      href: index.html
    - text: "Previous seminars"
      icon: fa-calendar
      href: previous.html      
  right:
    - icon: fa-question fa-lg
      href: http://biostat.ku.dk
output:
  html_document:
    theme: readable
    highlight: textmate
    include:
      after_body: footer.html
    toc: true
    toc_float: true
    css: style.css

When the page is printed on paper then the table-of-content is overlapping the main text which makes it rather useless.

Is it possible to remove the toc when printing? Either directly through arguments in the yaml or possibly through css and @media commands

Upvotes: 1

Views: 469

Answers (1)

JDewitt
JDewitt

Reputation: 557

Of course. In your stylesheet:

@media print {

  #TOC { display: none; }

}

Upvotes: 3

Related Questions