On Mon, Jun 13, 2011 at 3:52 PM, Steffen Wolfrum <cont...@st.estfiles.de> wrote:
>> Where is the difference ? >> >> \starttext >> >> >> \showframe >> >> \define[1]\ThisHelps {\handletokens#1\with{\hskip 0pt plus >> .1pt\firstofoneargument}} >> >> Test text test text\ThisHelps >> {9769387937933hhgiuiuziuziduzid93739837fhieuhifeuhfeiu39739837938398zfhfdkuhfiufhz398739837r98z379dihhfiu} >> >> \define[1]\ThisHelpsLuigi{% >> \startluacode >> s='#1' >> s= string.gsub(s,'(.)',"\%1\\hskip0sp") >> % maybe only some chars... >> %s= string.gsub(s,'[=/]',"\%1\\hskip0sp") >> context(s) >> \stopluacode} >> >> Test text test text\ThisHelpsLuigi >> {9769387937933hhgiuiuziuziduzid93739837fhieuhifeuhfeiu39739837938398zfhfdkuhfiufhz398739837r98z379dihhfiu} >> >> \stoptext > > > Just my "greenness" with luacode ... > > I didn't expect that it could be wrapped so easily in an handy \define > command: > context(s) is wrapped in start/stopluacode is wrapped in > \define[1]\LuigiHelps{...} The key point is % maybe only some chars... %s= string.gsub(s,'[=/]',"\%1\\hskip0sp") With '[=/]' you define a set of chars (only '=' and '/' in this example) so that only '=' => '=\hskip0sp' and '/' => '/\hskip0sp' i.e. breaks appear only on '=' and '/'. It' possible to define whatever char you want, but you must pay attention to '%' '#' etc. (as you do with \catcode) -- luigi ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________