ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* inline textbackgrounds across linebreaks
@ 2019-01-15 13:36 Taco Hoekwater
  2019-01-15 14:08 ` Mohammad Hossein Bateni
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Taco Hoekwater @ 2019-01-15 13:36 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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

Hi,

Quick explanation: I am trying to implement the concept of the HTML <u> tag,
which is supposed to be like a font switch, but doing underlining. I have a 
bunch of french clients, and this is a requirement I cannot get around. French
officials _love_ underlining and uppercasing :(

Because of its flexibility, I try to use text backgrounds, but that seems to
only work when the text does not break across lines: when on one line, the
background starts and stops at the right spot, great! But if there is a line 
break, then it underlines complete lines, even for the first and last line.

Is there any way to have underlining + line breaks behave correctly?
(perhaps not using text backgrounds at all?)

My current code is attached.

Best wishes,
Taco

[-- Attachment #2: s.pdf --]
[-- Type: application/pdf, Size: 9318 bytes --]

[-- Attachment #3: s.tex --]
[-- Type: application/octet-stream, Size: 462 bytes --]


\definetextbackground
  [underBar]
  [   location=text,
    framecolor=black,
   alternative=1,
       voffset=-.8\strutdp,
   background=,
         frame=off]

\starttext

Here is the start of the paragraph 
\startunderBar hello! (this looks fine) \stopunderBar{}
and some extra text running on to the next line

\blank

Here is the start of the paragraph 
\startunderBar \input ward \stopunderBar{} 
and some extra text running on to the next line

\stoptext

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



[-- Attachment #5: Type: text/plain, Size: 492 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] 6+ messages in thread

* Re: inline textbackgrounds across linebreaks
  2019-01-15 13:36 inline textbackgrounds across linebreaks Taco Hoekwater
@ 2019-01-15 14:08 ` Mohammad Hossein Bateni
  2019-01-15 14:22 ` Hans Hagen
  2019-01-15 17:39 ` Aditya Mahajan
  2 siblings, 0 replies; 6+ messages in thread
From: Mohammad Hossein Bateni @ 2019-01-15 14:08 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

I guess it works fine for me on beta 2019.01.07 16:10.

On Tue, Jan 15, 2019 at 8:37 AM Taco Hoekwater <taco@elvenkind.com> wrote:

> Hi,
>
> Quick explanation: I am trying to implement the concept of the HTML <u>
> tag,
> which is supposed to be like a font switch, but doing underlining. I have
> a
> bunch of french clients, and this is a requirement I cannot get around.
> French
> officials _love_ underlining and uppercasing :(
>
> Because of its flexibility, I try to use text backgrounds, but that seems
> to
> only work when the text does not break across lines: when on one line, the
> background starts and stops at the right spot, great! But if there is a
> line
> break, then it underlines complete lines, even for the first and last line.
>
> Is there any way to have underlining + line breaks behave correctly?
> (perhaps not using text backgrounds at all?)
>
> My current code is attached.
>
> Best wishes,
> Taco
>
>
> ___________________________________________________________________________________
> 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
>
> ___________________________________________________________________________________

[-- Attachment #1.2: Type: text/html, Size: 2273 bytes --]

[-- Attachment #2: s.pdf --]
[-- Type: application/pdf, Size: 9611 bytes --]

[-- Attachment #3: Type: text/plain, Size: 492 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] 6+ messages in thread

* Re: inline textbackgrounds across linebreaks
  2019-01-15 13:36 inline textbackgrounds across linebreaks Taco Hoekwater
  2019-01-15 14:08 ` Mohammad Hossein Bateni
@ 2019-01-15 14:22 ` Hans Hagen
  2019-01-15 15:05   ` Taco Hoekwater
  2019-01-15 17:39 ` Aditya Mahajan
  2 siblings, 1 reply; 6+ messages in thread
From: Hans Hagen @ 2019-01-15 14:22 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Taco Hoekwater

On 1/15/2019 2:36 PM, Taco Hoekwater wrote:
> Hi,
> 
> Quick explanation: I am trying to implement the concept of the HTML <u> tag,
> which is supposed to be like a font switch, but doing underlining. I have a
> bunch of french clients, and this is a requirement I cannot get around. French
> officials _love_ underlining and uppercasing :(
> 
> Because of its flexibility, I try to use text backgrounds, but that seems to
> only work when the text does not break across lines: when on one line, the
> background starts and stops at the right spot, great! But if there is a line
> break, then it underlines complete lines, even for the first and last line.
> 
> Is there any way to have underlining + line breaks behave correctly?
> (perhaps not using text backgrounds at all?)
> 
> My current code is attached.
works her ebut better is probably:

\definebar[tacobar] [method=1,dy=-0.4,offset=-0.3,continue=yes]

\starttext

Here is the start of the paragraph
{\tacobar hello! (this looks fine)}
and some extra text running on to the next line

\blank

Here is the start of the paragraph
{\tacobar \input ward }
and some extra text running on to the next line

\stoptext



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

* Re: inline textbackgrounds across linebreaks
  2019-01-15 14:22 ` Hans Hagen
@ 2019-01-15 15:05   ` Taco Hoekwater
  2019-01-16 13:27     ` Aditya Mahajan
  0 siblings, 1 reply; 6+ messages in thread
From: Taco Hoekwater @ 2019-01-15 15:05 UTC (permalink / raw)
  To: mailing list for ConTeXt users



> On 15 Jan 2019, at 15:08, Mohammad Hossein Bateni <bateni@gmail.com> wrote:
> 
> I guess it works fine for me on beta 2019.01.07 16:10.

Thanks for testing. Sorry, I should have checked myself.

> On 15 Jan 2019, at 15:22, Hans Hagen <j.hagen@xs4all.nl> wrote:
> works her ebut better is probably:
> 
> \definebar[tacobar] [method=1,dy=-0.4,offset=-0.3,continue=yes]

I had that earlier, but unfortunately there is also the <s> tag,
and this does not work the way I want:

%%%
\definebar[tacobar] [method=1,dy=-0.4,offset=-0.3,continue=yes]
\definebar[tacoover][method=1,dy=-0.4,offset=0.5,continue=yes]


Here is the start of the paragraph
{\tacobar hello! ({\tacoover this} looks fine)}
and some extra text running on to the next line
%%%

Because the \tacoover makes the \tacobar disappear :(

Taco







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

* Re: inline textbackgrounds across linebreaks
  2019-01-15 13:36 inline textbackgrounds across linebreaks Taco Hoekwater
  2019-01-15 14:08 ` Mohammad Hossein Bateni
  2019-01-15 14:22 ` Hans Hagen
@ 2019-01-15 17:39 ` Aditya Mahajan
  2 siblings, 0 replies; 6+ messages in thread
From: Aditya Mahajan @ 2019-01-15 17:39 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Tue, 15 Jan 2019, Taco Hoekwater wrote:

> Hi,
>
> Quick explanation: I am trying to implement the concept of the HTML <u> tag,
> which is supposed to be like a font switch, but doing underlining. I have a
> bunch of french clients, and this is a requirement I cannot get around. French
> officials _love_ underlining and uppercasing :(

Have you tried \underbar{\input ward\endgraf}?

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

* Re: inline textbackgrounds across linebreaks
  2019-01-15 15:05   ` Taco Hoekwater
@ 2019-01-16 13:27     ` Aditya Mahajan
  0 siblings, 0 replies; 6+ messages in thread
From: Aditya Mahajan @ 2019-01-16 13:27 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Tue, 15 Jan 2019, Taco Hoekwater wrote:

>> On 15 Jan 2019, at 15:08, Mohammad Hossein Bateni <bateni@gmail.com> wrote:
>> 
>> I guess it works fine for me on beta 2019.01.07 16:10.
>
> Thanks for testing. Sorry, I should have checked myself.
>
>> On 15 Jan 2019, at 15:22, Hans Hagen <j.hagen@xs4all.nl> wrote:
>> works her ebut better is probably:
>> 
>> \definebar[tacobar] [method=1,dy=-0.4,offset=-0.3,continue=yes]
>
> I had that earlier, but unfortunately there is also the <s> tag,
> and this does not work the way I want:
>
> %%%
> \definebar[tacobar] [method=1,dy=-0.4,offset=-0.3,continue=yes]
> \definebar[tacoover][method=1,dy=-0.4,offset=0.5,continue=yes]
>
>
> Here is the start of the paragraph
> {\tacobar hello! ({\tacoover this} looks fine)}
> and some extra text running on to the next line
> %%%
>
> Because the \tacoover makes the \tacobar disappear :(

If the text has constant interline spacing, you can try to mimick the old 
(mkii) underbar mechanism. See https://tex.stackexchange.com/a/125486/323 
for an example. I haven't tested this with nested backgrounds, but it 
should work.

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

end of thread, other threads:[~2019-01-16 13:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-15 13:36 inline textbackgrounds across linebreaks Taco Hoekwater
2019-01-15 14:08 ` Mohammad Hossein Bateni
2019-01-15 14:22 ` Hans Hagen
2019-01-15 15:05   ` Taco Hoekwater
2019-01-16 13:27     ` Aditya Mahajan
2019-01-15 17:39 ` Aditya Mahajan

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