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?

\fbox{\begin{minipage}[t]{

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.

Scott
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
 \begin_document
 \begin_header
 \save_transient_properties true
@@ -242,6 +242,25 @@ knitr
 \end_layout
 
 \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))
 
 \end_layout
 
+\end_inset
+
+
+\end_layout
+
 \begin_layout Standard
 Please contact the package author in case of any problems.
 \end_layout
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"
     EndArgument
     ResetsFont            false
     ForceOwnlines         true
+    NeedCProtect          1
 End

Attachment: signature.asc
Description: PGP signature

Reply via email to