ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: luigi scarso <luigi.scarso@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: break strings
Date: Mon, 13 Jun 2011 15:40:52 +0200	[thread overview]
Message-ID: <BANLkTimNppe5sPYMB50RP7PJDbEMpkazAg@mail.gmail.com> (raw)
In-Reply-To: <ABB52A03-17D8-4BE7-9352-D86D90B285D6@st.estfiles.de>

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


-- 
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
___________________________________________________________________________________


  reply	other threads:[~2011-06-13 13:40 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 [this message]
2011-06-13 13:52       ` Steffen Wolfrum
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=BANLkTimNppe5sPYMB50RP7PJDbEMpkazAg@mail.gmail.com \
    --to=luigi.scarso@gmail.com \
    --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).