A Small Question

Doug Martin martinrd3d at gmail.com
Sun Apr 11 15:12:15 UTC 2021


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20210411/ea734bf4/attachment.html>


More information about the lyx-devel mailing list