ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* How to get the number of lines of a paragraph?
@ 2009-04-06 15:17 Wei-Wei Guo
  2009-04-06 16:29 ` Wolfgang Schuster
  0 siblings, 1 reply; 11+ messages in thread
From: Wei-Wei Guo @ 2009-04-06 15:17 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Dear all,

I need to draw underlines under a paragraph. The number of underlines is
determined by the number of lines of the paragraph. For example:

If the paragraph have one line:

   text of paragraph, blur blur.
   ----------------------------------------------------------

If the paragraph have two lines:

   text of paragraph, blur blur blur blur blur blur blur blur
   ----------------------------------------------------------
   blur blur blur blur blur blur blur blur.
   ----------------------------------------------------------


Another question: How can I set the header of the pages of contents?

Thanks!

Best wishes,
Wei-Wei
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: How to get the number of lines of a paragraph?
  2009-04-06 15:17 How to get the number of lines of a paragraph? Wei-Wei Guo
@ 2009-04-06 16:29 ` Wolfgang Schuster
  2009-04-07  1:00   ` Wei-Wei Guo
  2009-04-08 15:30   ` Wei-Wei Guo
  0 siblings, 2 replies; 11+ messages in thread
From: Wolfgang Schuster @ 2009-04-06 16:29 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 06.04.2009 um 17:17 schrieb Wei-Wei Guo:

> Dear all,
>
> I need to draw underlines under a paragraph. The number of  
> underlines is
> determined by the number of lines of the paragraph. For example:

\definetextbackground
   [underline]
   [location=text,
    alternative=1,
    background=,
    frame=off]

\starttext

\startunderline
\input knuth
\stopunderline

\stoptext

> Another question: How can I set the header of the pages of contents?

\setupheadtext[<language>][content=...]

or

\title{...}
\placecontent

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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: How to get the number of lines of a paragraph?
  2009-04-06 16:29 ` Wolfgang Schuster
@ 2009-04-07  1:00   ` Wei-Wei Guo
  2009-04-07  2:18     ` Yanrui Li
  2009-04-07 14:19     ` Wolfgang Schuster
  2009-04-08 15:30   ` Wei-Wei Guo
  1 sibling, 2 replies; 11+ messages in thread
From: Wei-Wei Guo @ 2009-04-07  1:00 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Wolfgang Schuster 写道:
> 
> Am 06.04.2009 um 17:17 schrieb Wei-Wei Guo:
> 
>> Dear all,
>>
>> I need to draw underlines under a paragraph. The number of underlines is
>> determined by the number of lines of the paragraph. For example:
> 
> \definetextbackground
>   [underline]
>   [location=text,
>    alternative=1,
>    background=,
>    frame=off]
> 
> \starttext
> 
> \startunderline
> \input knuth
> \stopunderline
> 
> \stoptext
> 

It is not what I want. First, the underline is too close to the text. I need
to be able to manipulate the distance between the underline and the text.
Second, the underline of the last line has the same length with the last
line of the text. The underlines should be all the same length.


>> Another question: How can I set the header of the pages of contents?
> 
> \setupheadtext[<language>][content=...]
> 
> or
> 
> \title{...}
> \placecontent
> 

I don't mean the head of contents. I mean the header of the page, which is
the opposite concept to footer. It seems the head of the contents is not
treated as chapter. I tried \getmarking, but it doesn't work.


Best wishes,
Wei-Wei
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: How to get the number of lines of a paragraph?
  2009-04-07  1:00   ` Wei-Wei Guo
@ 2009-04-07  2:18     ` Yanrui Li
  2009-04-07  2:25       ` Yanrui Li
  2009-04-07 14:08       ` Wolfgang Schuster
  2009-04-07 14:19     ` Wolfgang Schuster
  1 sibling, 2 replies; 11+ messages in thread
From: Yanrui Li @ 2009-04-07  2:18 UTC (permalink / raw)
  To: mailing list for ConTeXt users

2009/4/7 Wei-Wei Guo <wwguocn@gmail.com>:
> Wolfgang Schuster 写道:
>>
>> Am 06.04.2009 um 17:17 schrieb Wei-Wei Guo:
>>
>>> Dear all,
>>>
>>> I need to draw underlines under a paragraph. The number of underlines is
>>> determined by the number of lines of the paragraph. For example:
>>
>> \definetextbackground
>>  [underline]
>>  [location=text,
>>   alternative=1,
>>   background=,
>>   frame=off]
>>
>> \starttext
>>
>> \startunderline
>> \input knuth
>> \stopunderline
>>
>> \stoptext
>>
>
> It is not what I want. First, the underline is too close to the text. I need
> to be able to manipulate the distance between the underline and the text.
> Second, the underline of the last line has the same length with the last
> line of the text. The underlines should be all the same length.
>
>

Hi,

May be this can help you.

%%%%
\startuseMPgraphic{mpos:par:columnset} % Shift underlining down a touch
   \iftracepositions show_multi_pars \else draw_multi_pars \fi ;
   path p ; p := boundingbox currentpicture ;
   currentpicture := currentpicture shifted (0,-1.2*StrutDepth) ;
   setbounds currentpicture to p ;
\stopuseMPgraphic

\definetextbackground[underline]
  [location=paragraph,alternative=1,background=,frame=off]

\definestartstop
  [underline]
  [before={\starttextbackground[underline]},
   after=\stoptextbackground]

\starttext

\startunderline
\input knuth
\stopunderline

\stoptext
%%%%

-- 
Best wishes,
Li Yanrui

* Gentoo Linux (~x86)
* ConTeXt Minimals Beta (2009.04.06 18:43)
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: How to get the number of lines of a paragraph?
  2009-04-07  2:18     ` Yanrui Li
@ 2009-04-07  2:25       ` Yanrui Li
  2009-04-07  5:50         ` Wei-Wei Guo
  2009-04-07 14:08       ` Wolfgang Schuster
  1 sibling, 1 reply; 11+ messages in thread
From: Yanrui Li @ 2009-04-07  2:25 UTC (permalink / raw)
  To: mailing list for ConTeXt users

2009/4/7 Yanrui Li <liyanrui.m2@gmail.com>:
> Hi,
>
> May be this can help you.
>
> %%%%
> \startuseMPgraphic{mpos:par:columnset} % Shift underlining down a touch
>   \iftracepositions show_multi_pars \else draw_multi_pars \fi ;
>   path p ; p := boundingbox currentpicture ;
>   currentpicture := currentpicture shifted (0,-1.2*StrutDepth) ;
>   setbounds currentpicture to p ;
> \stopuseMPgraphic
>
> \definetextbackground[underline]
>  [location=paragraph,alternative=1,background=,frame=off]
>
> \definestartstop
>  [underline]
>  [before={\starttextbackground[underline]},
>   after=\stoptextbackground]
>
> \starttext
>
> \startunderline
> \input knuth
> \stopunderline
>
> \stoptext
> %%%%
>

You can control the distances by setting up the params of
"currentpicture shifted" and linespace.

-- 
Best wishes,
Li Yanrui

* Gentoo Linux (~x86)
* ConTeXt Minimals Beta (2009.04.06 18:43)
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: How to get the number of lines of a paragraph?
  2009-04-07  2:25       ` Yanrui Li
@ 2009-04-07  5:50         ` Wei-Wei Guo
  0 siblings, 0 replies; 11+ messages in thread
From: Wei-Wei Guo @ 2009-04-07  5:50 UTC (permalink / raw)
  To: mailing list for ConTeXt users

It works, thanks!

Can \startunderline be put into a table or a tabulate? I want to implement
thing like this:

   \startbuffer[chinesetitle]
     \startunderline
     基于成本的钉耙强度与应用——东方视角分析
     \stopunderline
   \stopbuffer

   \startbuffer[englishtitle]
     \startunderline
     Cost Based Rake Strength and Application: An Oriental View
     \stopunderline
   \stopbuffer

   \starttabulate[|l|l|]
   \NC 中文论文题目: \NC \getbuffer[chinesetitle] \NC \NR
   \NC 英文论文题目: \NC \getbuffer[englishtitle] \NC \NR
   \stoptabulate

Of cause, the codes do not work. Is there any alternative way?


Best wishes,
Wei-Wei




Yanrui Li 写道:
> 2009/4/7 Yanrui Li <liyanrui.m2@gmail.com>:
>> Hi,
>>
>> May be this can help you.
>>
>> %%%%
>> \startuseMPgraphic{mpos:par:columnset} % Shift underlining down a touch
>>   \iftracepositions show_multi_pars \else draw_multi_pars \fi ;
>>   path p ; p := boundingbox currentpicture ;
>>   currentpicture := currentpicture shifted (0,-1.2*StrutDepth) ;
>>   setbounds currentpicture to p ;
>> \stopuseMPgraphic
>>
>> \definetextbackground[underline]
>>  [location=paragraph,alternative=1,background=,frame=off]
>>
>> \definestartstop
>>  [underline]
>>  [before={\starttextbackground[underline]},
>>   after=\stoptextbackground]
>>
>> \starttext
>>
>> \startunderline
>> \input knuth
>> \stopunderline
>>
>> \stoptext
>> %%%%
>>
> 
> You can control the distances by setting up the params of
> "currentpicture shifted" and linespace.
> 
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: How to get the number of lines of a paragraph?
  2009-04-07  2:18     ` Yanrui Li
  2009-04-07  2:25       ` Yanrui Li
@ 2009-04-07 14:08       ` Wolfgang Schuster
  1 sibling, 0 replies; 11+ messages in thread
From: Wolfgang Schuster @ 2009-04-07 14:08 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 07.04.2009 um 04:18 schrieb Yanrui Li:

> \definestartstop
>  [underline]
>  [before={\starttextbackground[underline]},
>   after=\stoptextbackground]

You don't need this, \definetextbackground creates start/stopunderline  
itself.

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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: How to get the number of lines of a paragraph?
  2009-04-07  1:00   ` Wei-Wei Guo
  2009-04-07  2:18     ` Yanrui Li
@ 2009-04-07 14:19     ` Wolfgang Schuster
  1 sibling, 0 replies; 11+ messages in thread
From: Wolfgang Schuster @ 2009-04-07 14:19 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 07.04.2009 um 03:00 schrieb Wei-Wei Guo:

> Wolfgang Schuster 写道:
>> Am 06.04.2009 um 17:17 schrieb Wei-Wei Guo:
>>> Dear all,
>>>
>>> I need to draw underlines under a paragraph. The number of  
>>> underlines is
>>> determined by the number of lines of the paragraph. For example:
>> \definetextbackground
>>  [underline]
>>  [location=text,
>>   alternative=1,
>>   background=,
>>   frame=off]
>> \starttext
>> \startunderline
>> \input knuth
>> \stopunderline
>> \stoptext
>
> It is not what I want. First, the underline is too close to the  
> text. I need
> to be able to manipulate the distance between the underline and the  
> text.
> Second, the underline of the last line has the same length with the  
> last
> line of the text. The underlines should be all the same length.

location=paragraph

>>> Another question: How can I set the header of the pages of contents?
>> \setupheadtext[<language>][content=...]
>> or
>> \title{...}
>> \placecontent
>
> I don't mean the head of contents. I mean the header of the page,  
> which is
> the opposite concept to footer. It seems the head of the contents is  
> not
> treated as chapter. I tried \getmarking, but it doesn't work.

The context term is headertext and \title is used for the header,
try \getmarking[title].

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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: How to get the number of lines of a paragraph?
  2009-04-08 15:30   ` Wei-Wei Guo
@ 2009-04-08 15:28     ` Wolfgang Schuster
  2009-04-09  2:28       ` Wei-Wei Guo
  0 siblings, 1 reply; 11+ messages in thread
From: Wolfgang Schuster @ 2009-04-08 15:28 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 08.04.2009 um 17:30 schrieb Wei-Wei Guo:

> Hi Wolfgang,
>
> I tried many ways, but could not make the following effect:
>
>  Title Head: Here is text, blur blur blur blur blur blur
>              -------------------------------------------
>              blur blur blur blur
>              -------------------------------------------
>
> I tried \starttabulate, \starttable, \setupTABLE, and  
> \definedescription
> with \underline{} and \startunderline.
>
> - Tabulate will get error.
> - Table do not show underline.
> - Natural table displays the underline with only half length as the  
> text
>  line's. And the vertical positions are also not right.
> - Description seems more promising, but the head will be about one  
> line
>  height higher than the text with underline (I use location=left).
>
> Could you help me with it?


You can need a p column in table/tabulate.

The wrong position of the line is a bug, make a bug report and use Li  
Yanruis
fix for the moment.

\definetextbackground
   [underline]
   [location=paragraph,
    alternative=1,
    background=,
    frame=off]

\starttext

\starttabulate
\NC Title Head \EQ \underline{Here is text, \dorecurse{20}{blur }} \NC 
\NR
\stoptabulate

\stoptext

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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: How to get the number of lines of a paragraph?
  2009-04-06 16:29 ` Wolfgang Schuster
  2009-04-07  1:00   ` Wei-Wei Guo
@ 2009-04-08 15:30   ` Wei-Wei Guo
  2009-04-08 15:28     ` Wolfgang Schuster
  1 sibling, 1 reply; 11+ messages in thread
From: Wei-Wei Guo @ 2009-04-08 15:30 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi Wolfgang,

I tried many ways, but could not make the following effect:

   Title Head: Here is text, blur blur blur blur blur blur
               -------------------------------------------
               blur blur blur blur
               -------------------------------------------

I tried \starttabulate, \starttable, \setupTABLE, and \definedescription
with \underline{} and \startunderline.

- Tabulate will get error.
- Table do not show underline.
- Natural table displays the underline with only half length as the text
   line's. And the vertical positions are also not right.
- Description seems more promising, but the head will be about one line
   height higher than the text with underline (I use location=left).

Could you help me with it?


Wei-Wei


Wolfgang Schuster 写道:
> 
> Am 06.04.2009 um 17:17 schrieb Wei-Wei Guo:
> 
>> Dear all,
>>
>> I need to draw underlines under a paragraph. The number of underlines is
>> determined by the number of lines of the paragraph. For example:
> 
> \definetextbackground
>   [underline]
>   [location=text,
>    alternative=1,
>    background=,
>    frame=off]
> 
> \starttext
> 
> \startunderline
> \input knuth
> \stopunderline
> 
> \stoptext

___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: How to get the number of lines of a paragraph?
  2009-04-08 15:28     ` Wolfgang Schuster
@ 2009-04-09  2:28       ` Wei-Wei Guo
  0 siblings, 0 replies; 11+ messages in thread
From: Wei-Wei Guo @ 2009-04-09  2:28 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Thanks! The p solves my problem.

Wei-Wei


Wolfgang Schuster 写道:
> You can need a p column in table/tabulate.
> 
> The wrong position of the line is a bug, make a bug report and use Li 
> Yanruis
> fix for the moment.
> 
> \definetextbackground
>   [underline]
>   [location=paragraph,
>    alternative=1,
>    background=,
>    frame=off]
> 
> \starttext
> 
> \starttabulate
> \NC Title Head \EQ \underline{Here is text, \dorecurse{20}{blur }} \NC\NR
> \stoptabulate
> 
> \stoptext
> 
> 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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

end of thread, other threads:[~2009-04-09  2:28 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-06 15:17 How to get the number of lines of a paragraph? Wei-Wei Guo
2009-04-06 16:29 ` Wolfgang Schuster
2009-04-07  1:00   ` Wei-Wei Guo
2009-04-07  2:18     ` Yanrui Li
2009-04-07  2:25       ` Yanrui Li
2009-04-07  5:50         ` Wei-Wei Guo
2009-04-07 14:08       ` Wolfgang Schuster
2009-04-07 14:19     ` Wolfgang Schuster
2009-04-08 15:30   ` Wei-Wei Guo
2009-04-08 15:28     ` Wolfgang Schuster
2009-04-09  2:28       ` Wei-Wei Guo

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