I have two knitr chunks in LyX that work fine by themselves in their separate floats (this post applies to both figures and tables). But when I try to put them in as subfloats (by selecting both and going to Insert > Float > Table or Insert > Float > Figure), I get errors.

For information on subfloats, see User Guide section Figure Floats.

I'm using LyX 2.0.3 and svn, and knitr version .3

  • 1
    I suggest you add a tag knitr to the post as well.
    – Yihui Xie
    Mar 8, 2012 at 7:25
  • 1
    @Yihui I would like to, but there is no knitr tag and you have to have 300 reputation to create a tag. Once someone creates the tag I will come back and add it.
    – scottkosty
    Mar 8, 2012 at 8:00
  • Perhaps this thread is related to the question? stackoverflow.com/questions/68940336/…
    – Diego
    Oct 5, 2021 at 16:02

1 Answer 1


I guess a LyX example is the best way to answer your question; I have created one here (right click and save as a LyX document). Note you have to install the development version of knitr: https://github.com/yihui/knitr#readme. Below is a screenshot of the output:

use subfloats with knitr in LyX


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.