On Sat, Apr 14, 2018 at 11:01:04AM +0000, Jürgen Spitzmüller wrote:
> Am Freitag, den 13.04.2018, 22:18 -0400 schrieb Scott Kostyshak:
> > Can we add support for a verbatim inside a simple frame? See the
> > attached, simpleFrame_verbatim.lyx.
> Done. Note that not all cases work (for instance, I don't know how to
> \cprotect a parbox).

This works well. Thank you!

Did we need to add \cprotect also for the other box modes? For the
example file, all of the options besides simple frame compiled without
error. Was that just by luck?

> > This issue also affects putting a simple frame around a knitr chunk,
> > because knitr uses verbatim.
> Try if adding
> NeedsCProtect 1
> to the respective knitr layouts helps.

It does not seem to change LaTeX output for me (I used "NeedsCProtect").
Perhaps it is because the LaTeX code has also a minipage?


To test that the LaTeX is not changed, open examples/knitr.lyx and put a
simple frame around the chunk inset. Attached is the diff containing the
change of adding a box and the change of adding NeedCProtect.

diff --git a/lib/examples/knitr.lyx b/lib/examples/knitr.lyx
index 49cc262..fd3c8b7 100644
--- a/lib/examples/knitr.lyx
+++ b/lib/examples/knitr.lyx
@@ -1,5 +1,5 @@
-#LyX 2.3 created this file. For more info see http://www.lyx.org/
-\lyxformat 544
+#LyX 2.4 created this file. For more info see https://www.lyx.org/
+\lyxformat 547
 \save_transient_properties true
@@ -242,6 +242,25 @@ knitr
 \begin_layout Standard
+\begin_inset Box Boxed
+position "t"
+hor_pos "c"
+has_inner_box 1
+inner_pos "t"
+use_parbox 0
+use_makebox 0
+width "100col%"
+special "none"
+height "1in"
+height_special "totalheight"
+thickness "0.4pt"
+separation "3pt"
+shadowsize "4pt"
+framecolor "black"
+backgroundcolor "none"
+status open
+\begin_layout Plain Layout
 \begin_inset Flex Chunk
 status open
@@ -280,6 +299,11 @@ summary(lm(y~x, data=df))
 \begin_layout Standard
 Please contact the package author in case of any problems.
diff --git a/lib/layouts/litinsets.inc b/lib/layouts/litinsets.inc
index 1a72fed..96b6794 100644
--- a/lib/layouts/litinsets.inc
+++ b/lib/layouts/litinsets.inc
@@ -51,4 +51,5 @@ InsetLayout "Flex:Chunk"
     ResetsFont            false
     ForceOwnlines         true
+    NeedCProtect          1

Attachment: signature.asc
Description: PGP signature

Reply via email to