ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* CLD setupheadertexts
@ 2022-08-25 17:32 Willi Egger via ntg-context
  2022-08-25 17:45 ` Hans Hagen via ntg-context
  0 siblings, 1 reply; 11+ messages in thread
From: Willi Egger via ntg-context @ 2022-08-25 17:32 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Willi Egger

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

Hello!

I have a ConTeXt Lua Document where I need to have headertexts.

When running the enclosed file I get 6 pages where only page 1 and 2 have header texts and the others none. — Why is that?

Thanks for hints!

Kind regards

Willi

[-- Attachment #2: Test-headertexts.pdf --]
[-- Type: application/pdf, Size: 16577 bytes --]

[-- Attachment #3: Test-headertexts.tex --]
[-- Type: application/octet-stream, Size: 1283 bytes --]

% Context file
% Filename: Test-headertexts.tex
% 
% 25-08-2022


\setuppagenumbering[alternative=doublesided,location=footer]

\setuppapersize[A5][A5]

\setuplayout
	[topspace=.6cm,
	 backspace=1.5cm,
	 header=2\bodyfontsize,
	 headerdistance=.5\bodyfontsize,
	 footer=1.2\bodyfontsize,
	 footerdistance=.5\bodyfontsize,
	 margin=0pt,
	 height=middle,
	 width=middle,
	 location=middle]
		
\startluacode
  thirddata      = thirddata or { }
  thirddata.diary = { }
  local diary     = thirddata.diary
	
  local report = logs.reporter("Test")

  function thirddata.diary.blocks(year)
	
	  report("Working in function: diary.blocks")
	  	
	  for i= 1,2 do
	  	local monthname = string.lower(os.date
	  	                  ("%B",os.time{year=year,month=i,day=1}))
	  	
	  	context.strut()
	  	
	  	context.setupheadertexts(
	  	  {function()
	  		  context("\\bf")
	  	    context(monthname)
	  		end},
	  		{function()
	  			context(year)
	  		end},
	  		{function()
	        context("\\bf")
          context(monthname)
	  		end},
	  	  {function()
	  			  context(year)
	  		end})
	  	for i = 1,20 do
	  				context.input("ward")
						context.crlf()
	  	end
	  end
  end
\stopluacode

\define[1]\Test{\ctxlua{thirddata.diary.blocks(#1)}}

\starttext
  \strut 
  \Test{2022}
\stoptext

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

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 11+ messages in thread
* CLD: setupheadertexts
@ 2011-12-24 10:10 Willi Egger
  2011-12-24 11:02 ` Wolfgang Schuster
  0 siblings, 1 reply; 11+ messages in thread
From: Willi Egger @ 2011-12-24 10:10 UTC (permalink / raw)
  To: NTG-Context ConTeXt users

Hi,

there are still questions how to use the context.setupheadertexts.

- why is on even pages the header not set when using the example below?
- how to make odd and even pages carrying a different header text?


\setuplabeltext[en][A=Happy New Year]

\startluacode
  function myheadertext(s)
     context.setupheadertexts{
        function()
            context.labeltext(s)
            context(": ")
        end}
  end   
\stopluacode

\starttext
\ctxlua{myheadertext("A")}
\input knuth
\page
\input ward
\stoptext

Thanks for enlighten me!

Willi
___________________________________________________________________________________
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
___________________________________________________________________________________


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

end of thread, other threads:[~2022-08-25 18:48 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-25 17:32 CLD setupheadertexts Willi Egger via ntg-context
2022-08-25 17:45 ` Hans Hagen via ntg-context
2022-08-25 17:56   ` Willi Egger via ntg-context
2022-08-25 18:48   ` Willi Egger via ntg-context
  -- strict thread matches above, loose matches on Subject: below --
2011-12-24 10:10 CLD: setupheadertexts Willi Egger
2011-12-24 11:02 ` Wolfgang Schuster
2011-12-24 13:32   ` Willi Egger
2011-12-24 14:25     ` Wolfgang Schuster
2011-12-24 17:09       ` Willi Egger
2011-12-25  9:21         ` Wolfgang Schuster
2011-12-26 12:49           ` Willi Egger

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