Knit to pdf has disappeared from dropdown menu

I simply wish to knit a document to PDF using rmarkdown in RStudio. I don't understand what has happened, but when I select knit, it no longer shows the different knitting options (e.g., pdf, html etc.) and just automatically knits to html every time (see screenshot). Only 30 minutes ago I'm sure the option was right in this dropdown menu, and I have previously successfully made the document into a pdf. Is there something I can do to get back the option to knit to pdf?

knit example

What does your YAML header look like?

Thanks for responding quickly - is this the part you mean?

yaml

Exactly - try indenting the pdf_ and html_ parts, as follows:

output:
  pdf_document: default
  html_document: default
1 Like

Thank you @Equation - yes this works! I think the indentation must have disappeared when I copy-pasted from another doc or something, and I tried putting it in/taking it out without it making a difference. However, you have to put it in and then save the document, and then the dropdown menu reappears with the different knit options again.

This topic was automatically closed 7 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.