How to get the number of lines of a paragraph?
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
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
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
2009/4/7 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.
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)
2009/4/7 Yanrui Li
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)
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
: 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.
Am 07.04.2009 um 03:00 schrieb Wei-Wei Guo:
Wolfgang Schuster 写道:
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=,
Am 06.04.2009 um 17:17 schrieb Wei-Wei Guo: 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
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
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
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
participants (3)
-
Wei-Wei Guo
-
Wolfgang Schuster
-
Yanrui Li