ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Line breaks, \wordright and hyphenation
@ 2021-10-24  2:12 kauśika cittūr via ntg-context
  2021-10-24  7:24 ` kauśika cittūr via ntg-context
  2021-10-25  2:04 ` kauśika cittūr via ntg-context
  0 siblings, 2 replies; 7+ messages in thread
From: kauśika cittūr via ntg-context @ 2021-10-24  2:12 UTC (permalink / raw)
  To: ntg-context; +Cc: kauśika cittūr

[-- Attachment #1: Type: text/plain, Size: 1628 bytes --]

Dear list,

In short, my question is: why does \wordright cause a line-break when the line 
preceding it breaks with hyphenation and does not otherwise? How to avoid it 
(if at all possible)?

I have this delimitedtext instance called 'amnata' defined as below:

\definemeasure[amnatamargin][3cm]
\definedelimitedtext
  [amnata]
\setupdelimitedtext
  [amnata]
  [
	left=,
	right=,
	leftmargin={\measure{amnatamargin}},
	rightmargin={\measure{amnatamargin}},
  ]

I am using this to quote paragraph(s) of other authors. 
Since, I also want to indicate where the quote is from, I use this as follows:

\startamnata
  ⋮
\wordright{author}
\stopamnata

so that the author's name appears at the right-edge of the block.

When the penultimate line inside the block breaks without hyphenation, then 
argument of \wordright is typeset as expected (i.e. in the same line).

On the other hand, when the penultimate line inside this block breaks with 
hyphenation, the argument of \wordright is pushed to the next line even when 
there is enough space for it on the same line.

Here is a sample illustrating this:

\startamnata
A quote from another author : Suppose that thereisalongwordhere.
\wordright{– author}
\stopamnata

\startamnata
A quote from another author : Here, the text does not cause 
hyphenation in the first line.
\wordright{– author}
\stopamnata

[I have attached the output here as an image] 

How do I ensure that this does not happen, if that is possible at all? I 
suppose this is expected behaviour but I am not able to understand why.

Thanks,
kauśika

[-- Attachment #2: sample-output.png --]
[-- Type: image/png, Size: 25935 bytes --]

[-- Attachment #3: 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] 7+ messages in thread

* Re: Line breaks, \wordright and hyphenation
  2021-10-24  2:12 Line breaks, \wordright and hyphenation kauśika cittūr via ntg-context
@ 2021-10-24  7:24 ` kauśika cittūr via ntg-context
  2021-10-25  2:04 ` kauśika cittūr via ntg-context
  1 sibling, 0 replies; 7+ messages in thread
From: kauśika cittūr via ntg-context @ 2021-10-24  7:24 UTC (permalink / raw)
  To: ntg-context; +Cc: kauśika cittūr

[-- Attachment #1: Type: text/plain, Size: 1908 bytes --]

On Sunday, October 24, 2021 7:42:59 AM IST kauśika cittūr wrote:
> Dear list,
> 
> In short, my question is: why does \wordright cause a line-break when the
> line preceding it breaks with hyphenation and does not otherwise? How to
> avoid it (if at all possible)?
> 
> I have this delimitedtext instance called 'amnata' defined as below:
> 
> \definemeasure[amnatamargin][3cm]
> \definedelimitedtext
>   [amnata]
> \setupdelimitedtext
>   [amnata]
>   [
> 	left=,
> 	right=,
> 	leftmargin={\measure{amnatamargin}},
> 	rightmargin={\measure{amnatamargin}},
>   ]
> 
> I am using this to quote paragraph(s) of other authors.
> Since, I also want to indicate where the quote is from, I use this as
> follows:
> 
> \startamnata
>   ⋮
> \wordright{author}
> \stopamnata
> 
> so that the author's name appears at the right-edge of the block.
> 
> When the penultimate line inside the block breaks without hyphenation, then
> argument of \wordright is typeset as expected (i.e. in the same line).
> 
> On the other hand, when the penultimate line inside this block breaks with
> hyphenation, the argument of \wordright is pushed to the next line even when
> there is enough space for it on the same line.
> 
> Here is a sample illustrating this:
> 
> \startamnata
> A quote from another author : Suppose that thereisalongwordhere.
> \wordright{– author}
> \stopamnata
> 
> \startamnata
> A quote from another author : Here, the text does not cause
> hyphenation in the first line.
> \wordright{– author}
> \stopamnata
> 
> [I have attached the output here as an image]
> 
> How do I ensure that this does not happen, if that is possible at all? I
> suppose this is expected behaviour but I am not able to understand why.
> 
> Thanks,
> kauśika

Just noticed that the attachment image does not seem to have been sent.
Resending …

kauśika

[-- Attachment #2: sample-output.jpg --]
[-- Type: image/jpeg, Size: 19305 bytes --]

[-- Attachment #3: 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] 7+ messages in thread

* Re: Line breaks, \wordright and hyphenation
  2021-10-24  2:12 Line breaks, \wordright and hyphenation kauśika cittūr via ntg-context
  2021-10-24  7:24 ` kauśika cittūr via ntg-context
@ 2021-10-25  2:04 ` kauśika cittūr via ntg-context
  2021-10-26 16:13   ` [Solved] " kauśika cittūr via ntg-context
  1 sibling, 1 reply; 7+ messages in thread
From: kauśika cittūr via ntg-context @ 2021-10-25  2:04 UTC (permalink / raw)
  To: ntg-context; +Cc: kauśika cittūr

On Sunday, October 24, 2021 7:42:59 AM IST kauśika cittūr wrote:
> Dear list,
> 
> In short, my question is: why does \wordright cause a line-break when the
> line preceding it breaks with hyphenation and does not otherwise? How to
> avoid it (if at all possible)?
> 
> I have this delimitedtext instance called 'amnata' defined as below:
> 
> \definemeasure[amnatamargin][3cm]
> \definedelimitedtext
>   [amnata]
> \setupdelimitedtext
>   [amnata]
>   [
> 	left=,
> 	right=,
> 	leftmargin={\measure{amnatamargin}},
> 	rightmargin={\measure{amnatamargin}},
>   ]
> 
> I am using this to quote paragraph(s) of other authors.
> Since, I also want to indicate where the quote is from, I use this as
> follows:
> 
> \startamnata
>   ⋮
> \wordright{author}
> \stopamnata
> 
> so that the author's name appears at the right-edge of the block.
> 
> When the penultimate line inside the block breaks without hyphenation, then
> argument of \wordright is typeset as expected (i.e. in the same line).
> 
> On the other hand, when the penultimate line inside this block breaks with
> hyphenation, the argument of \wordright is pushed to the next line even when
> there is enough space for it on the same line.
> 
> Here is a sample illustrating this:
> 
> \startamnata
> A quote from another author : Suppose that thereisalongwordhere.
> \wordright{– author}
> \stopamnata
> 
> \startamnata
> A quote from another author : Here, the text does not cause
> hyphenation in the first line.
> \wordright{– author}
> \stopamnata
> 
> [I have attached the output here as an image]
> 
> How do I ensure that this does not happen, if that is possible at all? I
> suppose this is expected behaviour but I am not able to understand why.
> 
> Thanks,
> kauśika

Dear list,

Although, not a fix for the issue, here is a workaround that allowed me to 
achieve what I wanted:

\definedescription[amnata]
\setupdescription[amnata]
  [closesymbol={​},
   closecommand=\wordright,
   before=\startamnatanarrower,
   after=\stopamnatanarrower]

\startamnata
A quote from another author : Suppose that thereisalongwordhere.
\wordright{– author}
\stopamnata

With this the argument of \wordright appears correctly at the right-edge of 
the block. Note that this does not work (as expected) when closesymbol is not 
set (or, is empty). Therefore, here I have set closesymbol={​​U+200B}, which 
is the zero width space.

Thanks,
kauśika


___________________________________________________________________________________
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] 7+ messages in thread

* Re: [Solved] Line breaks, \wordright and hyphenation
  2021-10-25  2:04 ` kauśika cittūr via ntg-context
@ 2021-10-26 16:13   ` kauśika cittūr via ntg-context
  0 siblings, 0 replies; 7+ messages in thread
From: kauśika cittūr via ntg-context @ 2021-10-26 16:13 UTC (permalink / raw)
  To: ntg-context; +Cc: kauśika cittūr

On Monday, October 25, 2021 7:34:06 AM IST kauśika cittūr wrote:
> On Sunday, October 24, 2021 7:42:59 AM IST kauśika cittūr wrote:
> > Dear list,
> > 
> > In short, my question is: why does \wordright cause a line-break when the
> > line preceding it breaks with hyphenation and does not otherwise? How to
> > avoid it (if at all possible)?
> > 
> > I have this delimitedtext instance called 'amnata' defined as below:
> > 
> > \definemeasure[amnatamargin][3cm]
> > \definedelimitedtext
> > 
> >   [amnata]
> > 
> > \setupdelimitedtext
> > 
> >   [amnata]
> >   [
> > 	
> > 	left=,
> > 	right=,
> > 	leftmargin={\measure{amnatamargin}},
> > 	rightmargin={\measure{amnatamargin}},
> > 	
> >   ]
> > 
> > I am using this to quote paragraph(s) of other authors.
> > Since, I also want to indicate where the quote is from, I use this as
> > follows:
> > 
> > \startamnata
> > 
> >   ⋮
> > 
> > \wordright{author}
> > \stopamnata
> > 
> > so that the author's name appears at the right-edge of the block.
> > 
> > When the penultimate line inside the block breaks without hyphenation,
> > then
> > argument of \wordright is typeset as expected (i.e. in the same line).
> > 
> > On the other hand, when the penultimate line inside this block breaks with
> > hyphenation, the argument of \wordright is pushed to the next line even
> > when there is enough space for it on the same line.
> > 
> > Here is a sample illustrating this:
> > 
> > \startamnata
> > A quote from another author : Suppose that thereisalongwordhere.
> > \wordright{– author}
> > \stopamnata
> > 
> > \startamnata
> > A quote from another author : Here, the text does not cause
> > hyphenation in the first line.
> > \wordright{– author}
> > \stopamnata
> > 
> > [I have attached the output here as an image]
> > 
> > How do I ensure that this does not happen, if that is possible at all? I
> > suppose this is expected behaviour but I am not able to understand why.
> > 
> > Thanks,
> > kauśika
> 
> Dear list,
> 
> Although, not a fix for the issue, here is a workaround that allowed me to
> achieve what I wanted:
> 
> \definedescription[amnata]
> \setupdescription[amnata]
>   [closesymbol={​},
>    closecommand=\wordright,
>    before=\startamnatanarrower,
>    after=\stopamnatanarrower]
> 
> \startamnata
> A quote from another author : Suppose that thereisalongwordhere.
> \wordright{– author}
> \stopamnata
> 
> With this the argument of \wordright appears correctly at the right-edge of
> the block. Note that this does not work (as expected) when closesymbol is
> not set (or, is empty). Therefore, here I have set closesymbol={​​U+200B},
> which is the zero width space.
> 
> Thanks,
> kauśika

Dear list,

As it turns out, my workaround here is subpar since it inserts an undesired 
line after the description block.

Hans was very kind to send me a fix to place in cont-new.mkxl that fixes the 
issue. However, due to my errors in properly pasting the fix correctly, it did 
not work. I updated LMTX today and the fix is already merged.

I am pasting below Hans' fix for reference (for anyone who might come across 
this later) –

\protect
\protected\def\spac_word_right_indeed#1#2%
  {\registerparwrapper
     {\v!word:\v!right}
     {\begingroup
      \frozen\parfillskip        \zeropoint
      \frozen\finalhyphendemerits\zerocount
      \endgroup}
     {\doifelseparwrapper{\v!word:\v!right}{\unregisterparwrapper{\v!word:\v!
right}}\donothing
      \removeunwantedspaces
      \doifelse{#1}\v!right{\kern-\rightskip}{\doifsomething{#1}{\kern-#1}}%
      \hfilll
      \discretionary{\strut}{\strut}{\strut}% \allowbreak % changed back from 
\hskip\zeropoint
      \hfilll
      \quad % decent spacing
      #2}}
\unprotect

kauśika


___________________________________________________________________________________
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] 7+ messages in thread

* Re: Line breaks, \wordright and hyphenation
  2021-10-24 12:01 ` Hans Hagen via ntg-context
@ 2021-10-24 12:41   ` kauśika cittūr via ntg-context
  0 siblings, 0 replies; 7+ messages in thread
From: kauśika cittūr via ntg-context @ 2021-10-24 12:41 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Hans Hagen
  Cc: kauśika cittūr, Benjamin Buchmuller

On Sunday, October 24, 2021 5:31:32 PM IST Hans Hagen wrote:
> On 10/24/2021 1:08 PM, Benjamin Buchmuller via ntg-context wrote:
> > Maybe
> > 
> > \hfill author
> 
> It's anyway nicer to use
> 
> % \definenarrower
> %   [amnata]
> %   [left=\measure{amnatamargin},
> %    right=\measure{amnatamargin},
> %    default={left,right}]
> 
> \definenarrower
>    [amnata]
>    [middle=\measure{amnatamargin}]
> 
> but then them, the fact that we get something hyphenated interferes ..
> tricky

Dear Benjamin and Hans,

Thanks for your responses.

I did not mention this in my initial question but I am not exactly doing 
'author' in the last line. Instead I usually do
\cite[alternative=authoryears,righttext={Ch. 12}][author1992].
That is, almost always, I need to refer to a specific chapter/page number in 
the work. The issue with this and \hfill is that the 'righttext' part gets 
nudged into the next line.

Sreeram


___________________________________________________________________________________
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] 7+ messages in thread

* Re: Line breaks, \wordright and hyphenation
  2021-10-24 11:08 Benjamin Buchmuller via ntg-context
@ 2021-10-24 12:01 ` Hans Hagen via ntg-context
  2021-10-24 12:41   ` kauśika cittūr via ntg-context
  0 siblings, 1 reply; 7+ messages in thread
From: Hans Hagen via ntg-context @ 2021-10-24 12:01 UTC (permalink / raw)
  To: mailing list for ConTeXt users, kauśika cittūr
  Cc: Hans Hagen, Benjamin Buchmuller

On 10/24/2021 1:08 PM, Benjamin Buchmuller via ntg-context wrote:
> Maybe
> 
> \hfill author

It's anyway nicer to use

% \definenarrower
%   [amnata]
%   [left=\measure{amnatamargin},
%    right=\measure{amnatamargin},
%    default={left,right}]

\definenarrower
   [amnata]
   [middle=\measure{amnatamargin}]

but then them, the fact that we get something hyphenated interferes .. 
tricky

>> On 24. Oct 2021, at 04:12, kauśika cittūr <citturs@gmail.com> wrote:
>>
>> Dear list,
>>
>> In short, my question is: why does \wordright cause a line-break when the line
>> preceding it breaks with hyphenation and does not otherwise? How to avoid it
>> (if at all possible)?
>>
>> I have this delimitedtext instance called 'amnata' defined as below:
>>
>> \definemeasure[amnatamargin][3cm]
>> \definedelimitedtext
>>   [amnata]
>> \setupdelimitedtext
>>   [amnata]
>>   [
>>     left=,
>>     right=,
>>     leftmargin={\measure{amnatamargin}},
>>     rightmargin={\measure{amnatamargin}},
>>   ]
>>
>> I am using this to quote paragraph(s) of other authors.
>> Since, I also want to indicate where the quote is from, I use this as follows:
>>
>> \startamnata
>>   ⋮
>> \wordright{author}
>> \stopamnata
>>
>> so that the author's name appears at the right-edge of the block.
>>
>> When the penultimate line inside the block breaks without hyphenation, then
>> argument of \wordright is typeset as expected (i.e. in the same line).
>>
>> On the other hand, when the penultimate line inside this block breaks with
>> hyphenation, the argument of \wordright is pushed to the next line even when
>> there is enough space for it on the same line.
>>
>> Here is a sample illustrating this:
>>
>> \startamnata
>> A quote from another author : Suppose that thereisalongwordhere.
>> \wordright{– author}
>> \stopamnata
>>
>> \startamnata
>> A quote from another author : Here, the text does not cause
>> hyphenation in the first line.
>> \wordright{– author}
>> \stopamnata
>>
>> [I have attached the output here as an image]
>>
>> How do I ensure that this does not happen, if that is possible at all? I
>> suppose this is expected behaviour but I am not able to understand why.
>>
>> Thanks,
>> kauśika
>> <sample-output.png>
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________
> 


-- 

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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] 7+ messages in thread

* Re: Line breaks, \wordright and hyphenation
@ 2021-10-24 11:08 Benjamin Buchmuller via ntg-context
  2021-10-24 12:01 ` Hans Hagen via ntg-context
  0 siblings, 1 reply; 7+ messages in thread
From: Benjamin Buchmuller via ntg-context @ 2021-10-24 11:08 UTC (permalink / raw)
  To: kauśika cittūr; +Cc: Benjamin Buchmuller, ntg-context

Maybe 

\hfill author

?

> On 24. Oct 2021, at 04:12, kauśika cittūr <citturs@gmail.com> wrote:
> 
> Dear list,
> 
> In short, my question is: why does \wordright cause a line-break when the line 
> preceding it breaks with hyphenation and does not otherwise? How to avoid it 
> (if at all possible)?
> 
> I have this delimitedtext instance called 'amnata' defined as below:
> 
> \definemeasure[amnatamargin][3cm]
> \definedelimitedtext
>  [amnata]
> \setupdelimitedtext
>  [amnata]
>  [
>    left=,
>    right=,
>    leftmargin={\measure{amnatamargin}},
>    rightmargin={\measure{amnatamargin}},
>  ]
> 
> I am using this to quote paragraph(s) of other authors. 
> Since, I also want to indicate where the quote is from, I use this as follows:
> 
> \startamnata
>  ⋮
> \wordright{author}
> \stopamnata
> 
> so that the author's name appears at the right-edge of the block.
> 
> When the penultimate line inside the block breaks without hyphenation, then 
> argument of \wordright is typeset as expected (i.e. in the same line).
> 
> On the other hand, when the penultimate line inside this block breaks with 
> hyphenation, the argument of \wordright is pushed to the next line even when 
> there is enough space for it on the same line.
> 
> Here is a sample illustrating this:
> 
> \startamnata
> A quote from another author : Suppose that thereisalongwordhere.
> \wordright{– author}
> \stopamnata
> 
> \startamnata
> A quote from another author : Here, the text does not cause 
> hyphenation in the first line.
> \wordright{– author}
> \stopamnata
> 
> [I have attached the output here as an image] 
> 
> How do I ensure that this does not happen, if that is possible at all? I 
> suppose this is expected behaviour but I am not able to understand why.
> 
> Thanks,
> kauśika
> <sample-output.png>
___________________________________________________________________________________
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] 7+ messages in thread

end of thread, other threads:[~2021-10-26 16:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-24  2:12 Line breaks, \wordright and hyphenation kauśika cittūr via ntg-context
2021-10-24  7:24 ` kauśika cittūr via ntg-context
2021-10-25  2:04 ` kauśika cittūr via ntg-context
2021-10-26 16:13   ` [Solved] " kauśika cittūr via ntg-context
2021-10-24 11:08 Benjamin Buchmuller via ntg-context
2021-10-24 12:01 ` Hans Hagen via ntg-context
2021-10-24 12:41   ` kauśika cittūr via ntg-context

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