Re: [NTG-context] how to place getmarking[title] in header instead of getmarking[chapter]
can use this for the header: \setupheadertexts [text] [{\namedstructurevariable{chapter}{title}}] [] [] [{\namedstructurevariable{chapter}{title}}] juh via ntg-context 於 2022年1月5日 週三 上午12:28寫道: > Hi all, > > I know how to put the current chapter in the header. > > But how can I also put the value of \starttitle in the header. > > In this mwe the \starttitle command does not modify the header. > > Is it possible to do something like: > > \getmarking[chapter or title] > > I cannot include > \setmarking[chapter]{title headline} > right before \starttitle as the source is created automatically. > > > \setupheadertexts > [text] > [{\getmarking[chapter]}] > [] > [] > [{\getmarking[chapter]}] > > \setupcombinedlist[content][list={chapter}] > \starttext > \placecontent > \startchapter > [title=Lorem] > > \startsection > [title=Lorem subsection] > \stopsection > \stopchapter > \startchapter > [title=Ipsum] > \stopchapter > \starttitle > [title=title headline] > > Pellentesque dapibus suscipit ligula. Donec posuere augue in quam. > Etiam vel tortor sodales tellus ultricies commodo. > > \page > > Nullam eu ante vel est convallis dignissim. > > \stoptitle > \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://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : http://contextgarden.net > > ___ > ___ 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 ___
[NTG-context] how to place getmarking[title] in header instead of getmarking[chapter]
Hi all, I know how to put the current chapter in the header. But how can I also put the value of \starttitle in the header. In this mwe the \starttitle command does not modify the header. Is it possible to do something like: \getmarking[chapter or title] I cannot include \setmarking[chapter]{title headline} right before \starttitle as the source is created automatically. \setupheadertexts [text] [{\getmarking[chapter]}] [] [] [{\getmarking[chapter]}] \setupcombinedlist[content][list={chapter}] \starttext \placecontent \startchapter [title=Lorem] \startsection [title=Lorem subsection] \stopsection \stopchapter \startchapter [title=Ipsum] \stopchapter \starttitle [title=title headline] Pellentesque dapibus suscipit ligula. Donec posuere augue in quam. Etiam vel tortor sodales tellus ultricies commodo. \page Nullam eu ante vel est convallis dignissim. \stoptitle \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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
[NTG-context] linenumbers in marking
Hi all, 5 years ago, on the mailing list, there was a thread started by Pablo Rodríguez (http://www.mail-archive.com/ntg-context@ntg.nl/msg62140.html) about line numbers in headers. Wolfgang Schuster replied that in principle, it's possible to have line numbers in headers, "but it’s not usable because the numbers are always shown on the next page." He made the following example (which I have slightly adapted): \definemarking[linenumber] \define\LinenumberCommand {\normalexpanded{\setmarking[linenumber]{\linenumber}}} \setuplinenumbering[command=\LinenumberCommand] \startsetups linenumber \doiftext { \getmarking[linenumber] } { \getmarking[linenumber][top] – \getmarking[linenumber][bottom] } \stopsetups \setupheadertexts[\texsetup{linenumber}] \starttext \dorecurse{6}{\input tufte\par} \startlinenumbering \dorecurse{20}{\input knuth\par} \stoplinenumbering \resetmarking[linenumber] \dorecurse{6}{\input tufte\par} \stoptext Hans wrote: "currently it's not possible but it's no big deal to add that feature at some point." I have now a similar problem with markings in a header. Is there a solution to this? Could it be implemented now? Thanks, and best wishes Thomas ___ 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 ___
Re: [NTG-context] is it possible to have first and last line numbers from page?
On 06/03/12 19:48, luigi scarso wrote: > 2012/3/6 Pablo Rodríguez > > Luigi, I'm afraid it doesn't work as expected in the real file > > I'm not surprised My fault, because I didn' realize that numbers only appeared on each fifth line. > Lines are numbered there with [step=5]. So I get in headers only > actually numbered lines, although it header should contain the real line > numbers (even with the line number isn't shown on that line). > > How would it the the code in that case? (Sorry for asking this, but I'm > afraid I cannot code in lua [or in any other language].) > > Do you have an example ? Adapting from your code: \startluacode document.my_name_space = document.my_name_space or {} document.my_name_space.pages = document.my_name_space.pages or {} local f = io.open(file.addsuffix(tex.jobname,"tuc") ) print('>>>>> ',f) if f==nil then --[=[ do nothin ]=] else f:close() local tuc = dofile(file.addsuffix(tex.jobname,"tuc")) local data = tuc.structures.references.collected[""] local w local pages = document.my_name_space.pages local realpage,ref for k, v in pairs(data) do w=string.gmatch(k,'LIN:(\%d+):\%d+') ref = tonumber(w()) realpage = tostring(v.references.realpage) pages[realpage]= pages[realpage] or {} table.insert(pages[realpage],ref) end for page,array in pairs(pages) do table.sort(array) end end \stopluacode \definemarking[linenumber] \define\LinenumberCommand {\normalexpanded{\setmarking[linenumber]{\linenumber}}\pagereference[LIN:\linenumber:\currentpage]} \setuplinenumbering[command=\LinenumberCommand,step=5] \startsetups linenumber \startluacode local l=0; if document.my_name_space == nil then return end; if document.my_name_space.pages == nil then return end; local pages = document.my_name_space.pages; for _,_ in pairs(pages) do l=l+1 end; if l== 0 then return end; --[=[ OK, we have some data to print ]=] local array = pages[tostring(tex.count.realpageno)] l=0; if array ==nil then return end; for _,_ in pairs(array) do l=l+1 end; if l>0 then context(array[1].." -- "..array[l]) end; \stopluacode \stopsetups \setupheadertexts[\texsetup{linenumber}] \starttext \dorecurse{6}{\input tufte\par} \startlinenumbering \dorecurse{20}{\input knuth\par} \stoplinenumbering \startlinenumbering \dorecurse{20}{\input knuth\par} \stoplinenumbering \stoptext On page 7 lines are numbered from lowest to highest values. A purist might consider this wrong, but this is unlikely to happen on a real book, since (I guess) line numbers on headers only make sense when they two different series cannot be on the same page. Many thanks for your help, Pablo -- http://www.ousia.tk ___ 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] is it possible to have first and last line numbers from page?
2012/3/4 Pablo Rodríguez > On 03/04/2012 12:04 PM, Wolfgang Schuster wrote: > > Am 04.03.2012 um 11:20 schrieb Pablo Rodríguez: > >> > >> I wanted to be able to have in the headers the first and last line > >> number from page. This feature is extremely useful when typesetting some > >> kinds of poetry. > >> [...] > >> Is that possible to achieve with ConTeXt? > > > > Yes but it’s not usable because the numbers are always shown on the next > page. > > Many thanks for your reply, Wolfgang. > > If you allow me one more question: is showing the numbers on the same > page they refer to beyond the limits of TeX/LuaTeX? > Absolutely no. As Hans said, a quick/dirty trick is possible: just mark the object with \pagereference[]. The data is stored into the *tuc file, which can be read from the second pass. Then always run with $>context --purgeall ; context .mkiv Of course, "it's possible " doesn't mean "it's the right context way". \startluacode document.my_name_space = document.my_name_space or {} document.my_name_space.pages = document.my_name_space.pages or {} local f = io.open(file.addsuffix(tex.jobname,"tuc") ) print('>>>>> ',f) if f==nil then --[=[ do nothin ]=] else f:close() local tuc = dofile(file.addsuffix(tex.jobname,"tuc")) local data = tuc.structures.references.collected[""] local w local pages = document.my_name_space.pages local realpage,ref for k, v in pairs(data) do w=string.gmatch(k,'LIN:(\%d+):\%d+') ref = tonumber(w()) realpage = tostring(v.references.realpage) pages[realpage]= pages[realpage] or {} table.insert(pages[realpage],ref) end for page,array in pairs(pages) do table.sort(array) end end \stopluacode \definemarking[linenumber] \define\LinenumberCommand {\normalexpanded{\setmarking[linenumber]{\linenumber}}\pagereference[LIN:\linenumber:\currentpage]} \setuplinenumbering[command=\LinenumberCommand] \startsetups linenumber % \doiftext { % \getmarking[linenumber] % } % { % \getmarking[linenumber][first] – \getmarking[linenumber][last] % } \startluacode local l=0; if document.my_name_space == nil then return end; if document.my_name_space.pages == nil then return end; local pages = document.my_name_space.pages; for _,_ in pairs(pages) do l=l+1 end; if l== 0 then return end; --[=[ OK, we have some data to print ]=] local array = pages[tostring(tex.count.realpageno)] l=0; if array ==nil then return end; for _,_ in pairs(array) do l=l+1 end; if l>0 then context(" nr. "..array[1].." --- "..array[l]) end; \stopluacode \stopsetups \setupheadertexts[\texsetup{linenumber}] \starttext \dorecurse{6}{\input tufte\par} \startlinenumbering \dorecurse{20}{\input knuth\par} \stoplinenumbering \resetmarking[linenumber] \dorecurse{6}{\input tufte\par} \stoptext -- luigi ___ 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] is it possible to have first and last line numbers from page?
Am 04.03.2012 um 11:20 schrieb Pablo Rodríguez: > I have asked this question before (more than twice), after I found no > answer in the ConTeXt reference manual, the wiki or the mailing list. > > I wanted to be able to have in the headers the first and last line > number from page. This feature is extremely useful when typesetting some > kinds of poetry. > > The most basic sample would be: > > \starttext > \startlinenumbering > \dorecurse{10}{\input zapf\par\input knuth} > \stoplinenumbering > \stoptext > > Is that possible to achieve with ConTeXt? Yes but it’s not usable because the numbers are always shown on the next page. \definemarking[linenumber] \define\LinenumberCommand {\normalexpanded{\setmarking[linenumber]{\linenumber}}} \setuplinenumbering[command=\LinenumberCommand] \startsetups linenumber \doiftext { \getmarking[linenumber] } { \getmarking[linenumber][first] – \getmarking[linenumber][last] } \stopsetups \setupheadertexts[\texsetup{linenumber}] \starttext \dorecurse{6}{\input tufte\par} \startlinenumbering \dorecurse{20}{\input knuth\par} \stoplinenumbering \resetmarking[linenumber] \dorecurse{6}{\input tufte\par} \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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___