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. On Sun, Apr 11, 2021 at 12:05 PM Scott Kostyshak <skost...@lyx.org> wrote: > On Sun, Apr 11, 2021 at 09:12:15AM -0600, Doug Martin wrote: > > Tom Philips and I create tables in LYX using the knitr package function > > kable (with the package kableExtra) in the > > following way: > > > > > > > > 1. Insert > Float > Table > > 2. In the float, enter a name and header for the table in the space > > provided > > 3. Just below the name, *but still inside the float*, press Ctrl-L to > > create a box for Latex code > > 4. Enter all the code for the table including the kable code that > > actually generates it into the box for Latex code > > > > This causes a “Not in outer par mode” error (see below), but creates a > > table that we are quite fine with. Our Tech > > Support person at Springer told us that the reason is due to embedding > the > > Rnw file for Table output in the LYX file, > > so that there is a table code inside another table in LaTeX as > highlighted > > below. > > > > > > > > \begin{table}[H] > > > > \caption{Equity Returns in Twenty--One Countries: 12/31/1899--12/31/2019} > > > > \begin{table} > > > > \centering\begingroup\fontsize{10}{12}\selectfont > > > > \begin{tabular}{lcccc} > > > > \toprule > > > > ….. > > > > ….. > > > > \end{tabular} > > > > \endgroup{} > > > > \end{table} > > > > \label{tab:GlobalEquityReturns} > > > > \end{table} > > > > and he suggested to solve the problem by adding the yellow highlighted > > lines below. > > > > \begin{table}[H] > > > > \caption{Global Annualized Real Returns For Stocks, Bonds and Bills} > > > > \begingroup > > > > \def\table{\begin{center}\fontsize{10}{12}\selectfont} > > > > \def\endtable{\end{center}} > > > > \begin{table} > > > > …… > > > > > > > > *And the second insertion will be: * > > > > \end{table} > > > > \endgroup > > > > \label{tab:GlobalEquityBondsCashReturns} > > > > \end{table} > > > > > > This actually works fine. Except that for every table we have to do that > > insertion, and Tom and I are just > > wondering if there some capability of LYX to accomplish the same thing > > without us having to do those insertions > > for every table? > > > > Doug > > Hi Doug, > > Could you send (to the list) a minimal example .lyx file (complete with > a simple knitr chunk with kable code) that we can experiment with? > > Thanks, > 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
outerparErrorExample.lyx
Description: application/lyx
-- lyx-devel mailing list lyx-devel@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-devel