Am 16.01.2013 um 15:51 schrieb Marco Patzer
Hi,
I need different settings for code in inline and block mode. See the following example:
\usemodule [vim] \definetextbackground [C] [location=text] \definevimtyping [C] [syntax=c, before={\starttextbackground[C]}, after=\stoptextbackground, margin=2em]
\starttext
This is C: \inlineC{int foo();}. \blank \startC int foo(){ return 0; } \stopC
\stoptext
Inline code needs “location=text”, block code on the other hand needs “location=paragraph” as text background setting. Sure, I can create two environments “Cinline” and “Cblock”, but that feels clumsy.
What's the proper way to set up different backgrounds for inline and block code?
You can try this (untested): \definetextbackground[InlineBackground][location=text] \definetextbackground[DisplayBackground][location=paragraph] \definevimytping [C] […, before={\ifhmode\startInlineBackground\else\startDisplayBackground\fi}, after={\ifhmode\stopInlineBackground\else\stopDisplayBackground\fi}, …] You could also ask Aditya to use different keys for display (e.g. before/aftter) and inline (e.g. left/right) code blocks. Wolfgang