Am 21.09.2013 um 20:46 schrieb Thangalin
Hi, Wolfgang.
I tried dropping in the Lua code, but it does not extract the text:
\define[1]\StyleChapter{% \StyleChapterFramed{% \framed[align=right, frame=off]{% \startoverlay \color[ColourSecondaryLightest]{% \cldcontext{string.sub(#1,0,1)}
\cldcontext{string.sub("#1",0,1)}%
} \vskip-1.9em\hskip1.2em#1 \stopoverlay } } }
When this doesn’t help you have to provide a complete minimal example.
! LuaTeX error [string "\directlua "]:1: bad argument #1 to 'sub' (string expected, got nil)
I've tried a few variations:
\directlua{string.sub(tex.sprint("\luatexluaescapestring{#1}") } \directlua{string.sub("\luatexluaescapestring{#1}",0,1)} \directlua{string.sub(tex.sprint("#1"),0,1)} \cldcontext{string.sub(tex.sprint("#1"),0,1)}
1. You have to use string.sub in the parameters of tex.sprint. 2. ConTeXt uses \luaescapestring. 3. We use in ConTeXt \ctxlua instead of \directlua. Wolfgang