[R] latex \subfloat{} incompatible with sweave/knitr code

Yihui Xie xie at yihui.name
Fri Aug 31 18:14:24 CEST 2012


OK, then this turns out to be a pure LaTeX problem. Thanks for the
experiments and examples, and they worked very well for me. It seems
subcaption is on the radar of LyX 2.1 now.

Regards,
Yihui
--
Yihui Xie <xieyihui at gmail.com>
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA


On Fri, Aug 31, 2012 at 9:40 AM, Liviu Andronic <landronimirc at gmail.com> wrote:
> On Thu, Aug 30, 2012 at 12:50 AM, Yihui Xie <xie at yihui.name> wrote:
>> Do you know what environments are allowed inside \subfloat{}? The
>>
> No, not really. From what I can tell, \subfloat{} is provided by the
> `subfig' package. Here's what their docs have to say about
> compatibility with verbatim and fancyvrb packages:
> "You cannot place a verbatim environment inside of the \subfloat command because
> the verbatim environment needs to change the character classes before
> the text in the environment is read by TEX. Therefore, if you really
> want to include verbatim text inside a sub-float, you will need to
> place the verbatim text into a box and then feed the box to the
> \subfloat command."
>
> And this is what CTAN says about the 'subfig' package:
> "The package 'subfigure' is now considered obsolete: it was superseded
> by 'subfig', but users may find the more recent 'subcaption' package
> more satisfactory."
>
>
>> graphics example works because it is nothing but a simple
>> \includegraphics{} command. The table example you gave is much more
>> complicated than that.
>>
> I played around with the 'subcaption' package and, although it has
> some side effects  on the figures, it accepts verbatim in its
> 'subtable' environment. See knitr LyX file and PDF:
> http://s000.tinyupload.com/index.php?file_id=00455858466446731442
> http://s000.tinyupload.com/index.php?file_id=07968719976440864387
>
> Maybe it's high time to ask the LyX devels to implement support for
> the 'subcaption' package.
>
> Liviu




More information about the R-help mailing list