A Small Question

Doug Martin martinrd3d at gmail.com
Mon Apr 12 19:30:26 UTC 2021


P.S.  Some time ago I tried using xtable, but I found use of kable
(included in
the knitr package) enhanced with the kableExtra package and its
documentation, e.g.,
"Create Awesome LaTeX Table with knitr::kable and kableExtra" as of
2021-02-19,
at CRAN "https://cran.r-project.org/web/packages/kableExtra/index.html",
easier
to use.  (others might not agree).

Doug

On Sun, Apr 11, 2021 at 2:55 PM Scott Kostyshak <skostysh at lyx.org> wrote:

> On Sun, Apr 11, 2021 at 02:07:51PM -0600, Doug Martin wrote:
> > Scott and all,
> >
> > Here you go.  As you will see, the Table is fine, but we get the "knitr
> > errors" message:
> > LaTeX Error: Not in outer par mode.
> >
> > Doug
> >
> > P.S. We like various capabilities that the kableExtra package provides us
> > with, e.g.,
> > in this simple example the add_header_above via kable_styling.
> > Of course if we ever find out how to directly import a data frame into
> the
> > LYX table
> > capability, we will probably use it a lot.
>
> Can you try replacing the line
>
>   kable_styling %>%
>
> in your .lyx file with
>
>   kable_styling(table.env = "centering") %>%
>
> or perhaps instead the following:
>
>   kable_styling(table.env = "@empty") %>%
>
> When I do that, the .lyx file compiles. This is a hack. Ideally, the
> table.env argument would treat the value NA to mean "don't output any
> table environment", but it does not behave that way. Perhaps worth an
> enhancement request to the kableExtra authors? Note that with xtable you
> can achieve this with the argument "floating = FALSE". Perhaps
> kable_styling has a way to do it but I couldn't find it.
>
> In any case, does that "hack" work for you? In case my instructions
> above are not clear, I attach the .lyx file with the change. I went with
> the first suggested change (using "centering"), but the second one
> (using "@empty") might be better. If one doesn't work, try the other.
>
> Scott
>


-- 
R. Douglas Martin
Professor Emeritus in Applied Mathematics and Statistics
Founder and Former Director of MS-CFRM Program
depts.washington.edu/compfin/
University of Washington
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20210412/0956465c/attachment-0001.html>


More information about the lyx-devel mailing list