TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
I suggest you add a tag knitr to the post as well. – Yihui Mar 8 '12 at 7:25
@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 '12 at 8:00
up vote 3 down vote accepted

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

share|improve this answer
Thank you Yihui – scottkosty Mar 8 '12 at 7:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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