Am Samstag, den 14.04.2018, 13:15 -0400 schrieb Scott Kostyshak:
> 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?

No, because I added the calls. Since the Box latex routine is really
ugly, chances are high, though, that I missed cases. So thanks for
checking.

> > > 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]{

The reason was that knitr chunk has the LaTeXType "none" which was
treated equivalently to "command" (which only needs cprotect for
specific content), rather than "environment" (which needs cprotect
always). Thus cprotect would have chimed in if you entered one of the
crucial chars in the chunk (e.g., #).

Please test with the attached patch after my recent commits. I did not
commit the patch since I cannot test whether it works (no R installed
here).

Jürgen
diff --git a/lib/layouts/litinsets.inc b/lib/layouts/litinsets.inc
index 11dd2d16af..7e1e9f00d7 100644
--- a/lib/layouts/litinsets.inc
+++ b/lib/layouts/litinsets.inc
@@ -51,4 +51,5 @@ InsetLayout "Flex:Chunk"
     EndArgument
     ResetsFont            false
     ForceOwnlines         true
+    NeedCProtect          true
 End

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to