ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Hyphentation/Linebreak after x characters inside \WORD?
@ 2020-04-23 18:46 Benjamin Buchmuller
  2020-04-23 19:01 ` Benjamin Buchmuller
  0 siblings, 1 reply; 3+ messages in thread
From: Benjamin Buchmuller @ 2020-04-23 18:46 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi again,

I am reading a CSV file into ConTeXt which contains long DNA sequences (>> 40 characters) to place in xtables. So far, this works fine. However, I need to uppercase the entries and need to \tt them. When I do this inside \WORD however, they don’t hyphenate any more.

I’m using:

\defineseparatedlist
	[mylist]
	[
	separator={,}, quotechar={"},
	command=\mycommand
	]

\define[2]\mycommand{
	\startxrow
	\startxcell o#1 \stopxcell
	\startxcell 5’-{\tt\WORD{#2}}-3' \stopxcell
	\stopxrow
	}

Since I don’t have access to each entry, I cant place hyphenation marks directly. Is there a way to tell ConTeXt to hyphenate after say, 12 characters?

Thanks for your help.


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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Hyphentation/Linebreak after x characters inside \WORD?
  2020-04-23 18:46 Hyphentation/Linebreak after x characters inside \WORD? Benjamin Buchmuller
@ 2020-04-23 19:01 ` Benjamin Buchmuller
  2020-04-23 19:46   ` Rik Kabel
  0 siblings, 1 reply; 3+ messages in thread
From: Benjamin Buchmuller @ 2020-04-23 19:01 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Sorry, I have just realized that the problem might not be \WORD{} actually, so this one hyphenates:

\define[2]\mycommand{
	\startxrow
	\startxcell o#1 \stopxcell
	\startxcell \tt\WORD #2 \stopxcell
	\stopxrow
	}

Whereas these ones don’t: 


\define[2]\mycommand{
	\startxrow
	\startxcell o#1 \stopxcell
	\startxcell \tt\WORD #2-3' \stopxcell
	\stopxrow
	}

\define[2]\mycommand{
	\startxrow
	\startxcell o#1 \stopxcell
	\startxcell 5'-\tt\WORD #2 \stopxcell
	\stopxrow
	}

Assuming that this has to do with the presence of “-“ which will be the preferred breakpoint. So, I guess the questions boils down to how to define the second argument of

\definebreakpoint[mybreaks][][nright=12,nleft=12,type=1]

in this case or how to “deactivate” the default \setbreakpoints[compound]?


> On 23 Apr 2020, at 20:46, Benjamin Buchmuller <benjamin.buchmuller@gmail.com> wrote:
> 
> Hi again,
> 
> I am reading a CSV file into ConTeXt which contains long DNA sequences (>> 40 characters) to place in xtables. So far, this works fine. However, I need to uppercase the entries and need to \tt them. When I do this inside \WORD however, they don’t hyphenate any more.
> 
> I’m using:
> 
> \defineseparatedlist
> 	[mylist]
> 	[
> 	separator={,}, quotechar={"},
> 	command=\mycommand
> 	]
> 
> \define[2]\mycommand{
> 	\startxrow
> 	\startxcell o#1 \stopxcell
> 	\startxcell 5’-{\tt\WORD{#2}}-3' \stopxcell
> 	\stopxrow
> 	}
> 
> Since I don’t have access to each entry, I cant place hyphenation marks directly. Is there a way to tell ConTeXt to hyphenate after say, 12 characters?
> 
> Thanks for your help.
> 
> 
> Benjamin

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Hyphentation/Linebreak after x characters inside \WORD?
  2020-04-23 19:01 ` Benjamin Buchmuller
@ 2020-04-23 19:46   ` Rik Kabel
  0 siblings, 0 replies; 3+ messages in thread
From: Rik Kabel @ 2020-04-23 19:46 UTC (permalink / raw)
  To: ntg-context, benjamin.buchmuller


[-- Attachment #1.1: Type: text/plain, Size: 2897 bytes --]


On 4/23/2020 15:01, Benjamin Buchmuller wrote:
> Sorry, I have just realized that the problem might not be \WORD{} actually, so this one hyphenates:
>
> \define[2]\mycommand{
> 	\startxrow
> 	\startxcell o#1 \stopxcell
> 	\startxcell \tt\WORD #2 \stopxcell
> 	\stopxrow
> 	}
>
> Whereas these ones don’t:
>
>
> \define[2]\mycommand{
> 	\startxrow
> 	\startxcell o#1 \stopxcell
> 	\startxcell \tt\WORD #2-3' \stopxcell
> 	\stopxrow
> 	}
>
> \define[2]\mycommand{
> 	\startxrow
> 	\startxcell o#1 \stopxcell
> 	\startxcell 5'-\tt\WORD #2 \stopxcell
> 	\stopxrow
> 	}
>
> Assuming that this has to do with the presence of “-“ which will be the preferred breakpoint. So, I guess the questions boils down to how to define the second argument of
>
> \definebreakpoint[mybreaks][][nright=12,nleft=12,type=1]
>
> in this case or how to “deactivate” the default \setbreakpoints[compound]?
>
>
>> On 23 Apr 2020, at 20:46, Benjamin Buchmuller <benjamin.buchmuller@gmail.com> wrote:
>>
>> Hi again,
>>
>> I am reading a CSV file into ConTeXt which contains long DNA sequences (>> 40 characters) to place in xtables. So far, this works fine. However, I need to uppercase the entries and need to \tt them. When I do this inside \WORD however, they don’t hyphenate any more.
>>
>> I’m using:
>>
>> \defineseparatedlist
>> 	[mylist]
>> 	[
>> 	separator={,}, quotechar={"},
>> 	command=\mycommand
>> 	]
>>
>> \define[2]\mycommand{
>> 	\startxrow
>> 	\startxcell o#1 \stopxcell
>> 	\startxcell 5’-{\tt\WORD{#2}}-3' \stopxcell
>> 	\stopxrow
>> 	}
>>
>> Since I don’t have access to each entry, I cant place hyphenation marks directly. Is there a way to tell ConTeXt to hyphenate after say, 12 characters?
>>
>> Thanks for your help.
>>
>>
>> Benjamin

The following works for me:

    \define[2]\mycommanda{
         \startxrow
         \startxcell o#1 \stopxcell
         \startxcell \tt\WORD #2 \stopxcell
         \stopxrow
         }

    \define[2]\mycommandb{
         \startxrow
         \startxcell o#1 \stopxcell
         \startxcell \tt\WORD #2-3' \stopxcell
         \stopxrow
         }

    \define[2]\mycommandc{
         \startxrow
         \startxcell o#1 \stopxcell
         \startxcell 5'-\tt\WORD #2 \stopxcell
         \stopxrow
         }

    \definebreakpoint[mybreaks][][nright=12,nleft=12,type=1]
    \setbreakpoints[mybreaks]

    \starttext

    \setupxtable[width=5cm]
    \startxtablex
    \mycommanda{A}{lsfkgjfkgshgkhigewhgajkdkfkalhfdklahfkhaakfakfh}
    \mycommandb{B}{lsfkgjfkgshgkhigewhgajkdkfkalhfdklahfkhaakfakfh}
    \mycommandc{C}{lsfkgjfkgshgkhigewhgajkdkfkalhfdklahfkhaakfakfh}
    \stopxtable

    \stoptext

Producing:

Indeed, it produces the same when nleft and nright are both set to 1 or 
12 or 100, but not when setbreakpoints is removed.

If you are trying to do something else, please provide an MWE.

[-- Attachment #1.2.1: Type: text/html, Size: 4017 bytes --]

[-- Attachment #1.2.2: nijiabomaaejpjhk.png --]
[-- Type: image/png, Size: 36876 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-04-23 19:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-23 18:46 Hyphentation/Linebreak after x characters inside \WORD? Benjamin Buchmuller
2020-04-23 19:01 ` Benjamin Buchmuller
2020-04-23 19:46   ` Rik Kabel

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).