From: Steffen Wolfrum <context@st.estfiles.de>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: break strings
Date: Mon, 13 Jun 2011 15:52:18 +0200 [thread overview]
Message-ID: <DB6DE1BB-95F5-4BD3-931A-473247FFC39F@st.estfiles.de> (raw)
In-Reply-To: <BANLkTimNppe5sPYMB50RP7PJDbEMpkazAg@mail.gmail.com>
Am 13.06.2011 um 15:40 schrieb luigi scarso:
> On Mon, Jun 13, 2011 at 3:18 PM, Steffen Wolfrum <context@st.estfiles.de> wrote:
>>
>> Am 13.06.2011 um 14:25 schrieb Wolfgang Schuster:
>>
>>>
>>> Am 13.06.2011 um 14:12 schrieb Steffen Wolfrum:
>>>
>>>> Hi,
>>>>
>>>> say I have arbitrary string of alphanumeric characters:
>>>>
>>>>
>>>> \starttext
>>>>
>>>> \showframe
>>>>
>>>> 9769387937933hhgiuiuziuziduzid93739837fhieuhifeuhfeiu39739837938398zfhfdkuhfiufhz398739837r98z379dihhfiu
>>>>
>>>> \stoptext
>>>>
>>>> How can I (automatically) force a break at end of line, without manually adding \crlf or \break at break points?
>>>
>>> \handletokens ...\with{\hskip 0pt plus .1pt\firstofoneargument}
>>
>>
>> Yes, this helps:
>>
>> \showframe
>>
>> \define[1]\ThisHelps {\handletokens#1\with{\hskip 0pt plus .1pt\firstofoneargument}}
>>
>> Test text test text\ThisHelps {9769387937933hhgiuiuziuziduzid93739837fhieuhifeuhfeiu39739837938398zfhfdkuhfiufhz398739837r98z379dihhfiu}
>>
>> \stoptext
>>
>>
>> Thank you!!
>>
>> Steffen
> 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{...}
Endless possibilities ... great!
Thank you very much for making this clear :o)
Steffen
___________________________________________________________________________________
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
___________________________________________________________________________________
next prev parent reply other threads:[~2011-06-13 13:52 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-13 12:12 Steffen Wolfrum
2011-06-13 12:19 ` luigi scarso
2011-06-13 13:07 ` Steffen Wolfrum
2011-06-13 12:25 ` Wolfgang Schuster
2011-06-13 13:18 ` Steffen Wolfrum
2011-06-13 13:40 ` luigi scarso
2011-06-13 13:52 ` Steffen Wolfrum [this message]
2011-06-13 13:59 ` luigi scarso
2011-06-13 13:58 ` Wolfgang Schuster
2011-06-13 14:02 ` luigi scarso
2011-06-13 20:19 ` Hans Hagen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DB6DE1BB-95F5-4BD3-931A-473247FFC39F@st.estfiles.de \
--to=context@st.estfiles.de \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).