ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Benjamin Buchmuller <benjamin.buchmuller@gmail.com>
To: Wolfgang Schuster <wolfgang.schuster.lists@gmail.com>
Cc: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Hyphentation/Linebreak after x characters
Date: Fri, 24 Apr 2020 00:03:14 +0200	[thread overview]
Message-ID: <D9BACCD1-2D4A-4D54-890C-516C4FD3B09F@gmail.com> (raw)
In-Reply-To: <1c87df68-4a69-5165-052a-d23b4aab187a@gmail.com>

Thanks Wolfgang, this works perfectly. I will add this hint tomorrow to the Wiki.

> On 23 Apr 2020, at 23:50, Wolfgang Schuster <wolfgang.schuster.lists@gmail.com> wrote:
> 
> Benjamin Buchmuller schrieb am 23.04.2020 um 23:16:
>> Hi Rik,
>> Thanks for the fast reply! Your example works indeed nicely. However, within this solution my problem has shifted now (fully) towards breaking after the same number of characters, which seems to work for your sample string, but not for the sequences that I need to place.
>> What I would like to achieve is something like:
>> 5’-GATTGCTTACTCCTGGTTGG
>> TGGGGCTTACATTCTGTCGCCTC
>> AAAACTACTAGAGCCGGCATATT
>> CTAGAAGGGCCGCCTTCATGTGG
>> etc.
>> (There might be hyphens or not, this is not so much important to me.)
>> But what I get is currently:
>> 5'-GATTGCTTACTCCTG-
>> GTTGGTGGGGCTTACATTCT-
>> GTCGCCTCAAAACTACTA-
>> GAGCCGGCATATTCTA-
>> GAAGGGCCGCCTTCATGTGGC-
>> etc.
>> Which looks ragged with \tt. Certainly, this is because ConTeXt applies the default hyphenation pattern. But I guess, there might be no “no language” pattern or is there? Also, I agree, it’s a bit odd that nright/nleft seem to make no difference towards the result.
> 
> Hans posted a solution for a similar problem a few years ago [1]
> which can be adapted to your problem.
> 
> \startluacode
> 
>     local shared = {
>         start  = 1,
>         length = 1,
>         before = nil,
>         after  = nil,
>         left   = false,
>         right  = false,
>     }
> 
>     local all = table.setmetatableindex({ }, function(t,k)
>         return shared
>     end)
> 
>     languages.hyphenators.traditional.installmethod("dna",
>         function(dictionary,word,n)
>             return all
>         end
>     )
> \stopluacode
> 
> \definehyphenationfeatures
>  [dna]
>  [characters=all,
>   alternative=dna]
> 
> \starttext
> 
> \startframedtext[width=6cm,style=mono]
>  \sethyphenationfeatures[dna]
>  \setuphyphenation[method=traditional]
>  GATTGCTTACTCCTGGTTGG%
>  TGGGGCTTACATTCTGTCGCCTC%
>  AAAACTACTAGAGCCGGCATATT%
>  CTAGAAGGGCCGCCTTCATGTGG%
> \stopframedtext
> 
> \stoptext
> 
> [1] https://mailman.ntg.nl/pipermail/ntg-context/2017/089106.html
> 
> Wolfgang

___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2020-04-23 22:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.281.1587672163.1194.ntg-context@ntg.nl>
2020-04-23 21:16 ` Benjamin Buchmuller
2020-04-23 21:50   ` Wolfgang Schuster
2020-04-23 22:03     ` Benjamin Buchmuller [this message]
2020-04-23 22:45     ` Rik Kabel
2020-04-24  8:50       ` Benjamin Buchmuller

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=D9BACCD1-2D4A-4D54-890C-516C4FD3B09F@gmail.com \
    --to=benjamin.buchmuller@gmail.com \
    --cc=ntg-context@ntg.nl \
    --cc=wolfgang.schuster.lists@gmail.com \
    /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).