ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* The name of the current section?
@ 2004-05-19 12:06 Michal Kvasnicka
  2004-05-19 19:26 ` Willi Egger
  0 siblings, 1 reply; 5+ messages in thread
From: Michal Kvasnicka @ 2004-05-19 12:06 UTC (permalink / raw)


Good evening.

Is there some command simmilar to \headnumber[section] that would tell 
me the name of the current chapter/section/...?

I want to have the headertext on the left like this:
    [pagenumber] [chapter title] (chap. [chapter number])
and on the right side like this:
    [section title] (sec. [section number]) [pagenumber]
where [x] is value of x, e.g. [pagenumber] is the number of the current 
page.

How can I do it?

Many thanks
Michal Kvasnicka

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

* Re: The name of the current section?
  2004-05-19 12:06 The name of the current section? Michal Kvasnicka
@ 2004-05-19 19:26 ` Willi Egger
  2004-05-20 16:47   ` Michal Kvasnicka
  0 siblings, 1 reply; 5+ messages in thread
From: Willi Egger @ 2004-05-19 19:26 UTC (permalink / raw)


Hi,

Humble, I thought that your layout kan be setup with

\setupheadertexts[location][left text][right text][left .][right .]

\setupoutput[pdftex]
\usetypescript[palatino][texnansi]
\setupbodyfont[palatino,rm,12pt]
\setuppagenumbering[alternative=doublesided,
    location={header,marginedge}]
\setupheadertexts
    [section][{\headnumber[section]}][chapter][{\headnumber[chapter]}]

%leftpage: [pagenumber] [chapter title] (chap. [chapter number])
%rightpage: [section title] (sec. [section number]) [pagenumber]

\starttext
\chapter{Cheese}
\section{Parmiggiano Reggiano}
\blank[15cm]
\section{Grana Padano}
\blank[15cm]
\section{Gruy\`ere}
\blank[15cm]
\section{Tilsiter}
\blank[15cm]
\section{Appenzeller}
\chapter{Wine}
\section{Cabernet Sauvignon}
\blank[15cm]
\section{Pinot noir}
\blank[15cm]
\section{M\"uller-Thurgau}
\blank[15cm]
\section{Chasselat}
\stoptext

Willi


Michal Kvasnicka wrote:

> Good evening.
> 
> Is there some command simmilar to \headnumber[section] that would tell 
> me the name of the current chapter/section/...?
> 
> I want to have the headertext on the left like this:
>    [pagenumber] [chapter title] (chap. [chapter number])
> and on the right side like this:
>    [section title] (sec. [section number]) [pagenumber]
> where [x] is value of x, e.g. [pagenumber] is the number of the current 
> page.
> 
> How can I do it?
> 
> Many thanks
> Michal Kvasnicka
> 
> 
> _______________________________________________
> ntg-context mailing list
> ntg-context@ntg.nl
> http://www.ntg.nl/mailman/listinfo/ntg-context

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

* Re: The name of the current section?
  2004-05-20 16:47   ` Michal Kvasnicka
@ 2004-05-20 15:15     ` Mikael Persson
  2004-05-21 12:59       ` Michal Kvasnicka
  0 siblings, 1 reply; 5+ messages in thread
From: Mikael Persson @ 2004-05-20 15:15 UTC (permalink / raw)


> Hi.
>
> Many thanks for your kind answer.
>
>> \setuppagenumbering[alternative=doublesided,
>>    location={header,marginedge}]
>> \setupheadertexts
>>    [section][{\headnumber[section]}][chapter][{\headnumber[chapter]}]
>
> Your code is rather nice (I have learned one nice trick from it), but it
> doesn't what I need. I want all the header stuff to go just separated by
> spaces, not on different sides of the header. Something like this
>
> 117_This_is_an_chapter_name_(chap._5)___________________________________________________________________
> where "_" stands for a space.
>
> Well, with your trick I could possibly to it with some \hfill, but it's
> a rather tricky solution. Moreover, I may need the name of a current
> chapter and section in the document itself. I guess there must be some
> system solution for such a case in the ConTeXt (I think there is almost
> everything in it.) :-)
>
> Of course, as the last instance I can redefine \chapter and \section in
> a way like this
>     \let\OriChapter=\chapter
>     \def\chapter#1{\def\currentchaptername{#1}\chapter{#1}}
> but I don't want to do it -- it is dirty and involves more programming
> to cover crossreferences.
>
> Any more hint how to get the name of current chapter/section?
>
> With best regards
> Michal Kvasnicka
>

I found this in one of my old docs. Is that what you want?

\setupheadertexts
    [{\headnumber[section]\quad\getmarking[section][current]}]
    []
    []
    [{Chapter \headnumber[chapter]:\quad\getmarking[chapter][current]}]


Regards, Micke P

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

* Re: The name of the current section?
  2004-05-19 19:26 ` Willi Egger
@ 2004-05-20 16:47   ` Michal Kvasnicka
  2004-05-20 15:15     ` Mikael Persson
  0 siblings, 1 reply; 5+ messages in thread
From: Michal Kvasnicka @ 2004-05-20 16:47 UTC (permalink / raw)


Hi.

Many thanks for your kind answer.

> \setuppagenumbering[alternative=doublesided,
>    location={header,marginedge}]
> \setupheadertexts
>    [section][{\headnumber[section]}][chapter][{\headnumber[chapter]}]

Your code is rather nice (I have learned one nice trick from it), but it 
doesn't what I need. I want all the header stuff to go just separated by 
spaces, not on different sides of the header. Something like this
    
117_This_is_an_chapter_name_(chap._5)___________________________________________________________________
where "_" stands for a space.

Well, with your trick I could possibly to it with some \hfill, but it's 
a rather tricky solution. Moreover, I may need the name of a current 
chapter and section in the document itself. I guess there must be some 
system solution for such a case in the ConTeXt (I think there is almost 
everything in it.) :-)

Of course, as the last instance I can redefine \chapter and \section in 
a way like this
    \let\OriChapter=\chapter
    \def\chapter#1{\def\currentchaptername{#1}\chapter{#1}}
but I don't want to do it -- it is dirty and involves more programming 
to cover crossreferences.

Any more hint how to get the name of current chapter/section?

With best regards
Michal Kvasnicka

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

* Re: The name of the current section?
  2004-05-20 15:15     ` Mikael Persson
@ 2004-05-21 12:59       ` Michal Kvasnicka
  0 siblings, 0 replies; 5+ messages in thread
From: Michal Kvasnicka @ 2004-05-21 12:59 UTC (permalink / raw)


Dear Mikael.

Many thanks. Your solution

>\setupheadertexts
>    [{\headnumber[section]\quad\getmarking[section][current]}]
>    []
>    []
>    [{Chapter \headnumber[chapter]:\quad\getmarking[chapter][current]}]
>
>  
>
is precisely what I searched for. Many thanks once more.
With best regards
M.K.

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

end of thread, other threads:[~2004-05-21 12:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-19 12:06 The name of the current section? Michal Kvasnicka
2004-05-19 19:26 ` Willi Egger
2004-05-20 16:47   ` Michal Kvasnicka
2004-05-20 15:15     ` Mikael Persson
2004-05-21 12:59       ` Michal Kvasnicka

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