Discussion:
is there anything like \sectionmark for \section*
(too old to reply)
boukeas
2008-09-16 18:56:44 UTC
Permalink
Hello,

i am trying to use the title of an unnumbered section (\section*) in
my header and i have not been able to find any relevant references. is
there an equivalent to \sectionmark for \section*?
let me point out i am using the memoir class, just in case this
simplifies things.

Thanks,

George Boukeas
jon
2008-09-16 19:12:59 UTC
Permalink
Post by boukeas
Hello,
i am trying to use the title of an unnumbered section (\section*) in
my header and i have not been able to find any relevant references. is
there an equivalent to \sectionmark for \section*?
let me point out i am using the memoir class, just in case this
simplifies things.
if i understand you correctly, you could do something like this
(though there's probably a better way):

\makepsmarks{myheaders}{% this comes from the memoir
manual
\let\@mkboth\markboth
\def\chaptermark##1{\markboth{##1}{##1}} % left & right marks
\def\sectionmark##1{\markright{% % right mark
\ifnum \***@secnumdepth>\z@
\thesection. \ %
\fi
##1}}
} %

\makepagestyle{myheaders}
\makeevenhead{myheaders}{\thepage}{ \emph{\thetitle} }{} % assuming
you want the title on even pages
\makeoddhead{myheaders}{}{\rightmark }{\thepage}
\makeevenfoot{myheaders}{}{}{}
\makeoddfoot{myheaders}{}{}{}
\pagestyle{myheaders}


then, for a new section in your paper:

\phantomsection\addcontentsline{toc}{chapter}{%
\protect\numberline{}Section Title}% % note these two lines are for
hyperref stuff
% i
like using 'chapter' for this even if section is the highest level....
\section*{Section Title}
\markright{Section Title}


like i said, though, there's probably a more elegant solution.

cheers,
jon.
boukeas
2008-09-16 21:59:23 UTC
Permalink
Thank you for your reply.

This is a (stripped down) version of my pagestyle - its a onesided
document with no footers, so my definitions pertain only to odd pages:

\makepagestyle{handouts}
\makeoddhead{handouts}{\leftmark\quad\rightmark}{}{\thepage}
\makepsmarks{handouts}{
\createmark{chapter}{left}{nonumber}{}{}
\createmark{section}{right}{nonumber}{}{}
}

In your code, you manually define \chaptermark and \sectionmark,
whereas i use
\createmark to do exactly the same thing.
\makepsmarks{myheaders}{% this comes from the memoir manual
\def\chaptermark##1{\markboth{##1}{##1}} % left & right marks
\def\sectionmark##1{\markright{% % right mark
\thesection. \ %
\fi
##1}}
} %
The issue is that (either way) \sectionmark is NOT called whenever a
new \section* begins. Therefore,
\markright is also not called whenever a new \section* begins. This is
why you need to manually call
\markright{Section Title}.
\section*{Section Title}
\markright{Section Title}
Of course this works, and the simplest thing to do is:

\newcommand{\sectionAug}[1]{\section*{#1}\markright{#1}}

I was just looking for something... nicer! It is interesting to note
that there exists a separate \poemtitlestarmark for the starred
version of \PoemTitle (memoir manual p. 166).

regards,

George.
jon
2008-09-17 13:57:11 UTC
Permalink
Post by boukeas
Post by jon
\section*{Section Title}
\markright{Section Title}
\newcommand{\sectionAug}[1]{\section*{#1}\markright{#1}}
I was just looking for something... nicer! It is interesting to note
... i don't know. that wraps up what i was trying to get at in a very
neat and tidy way in my opinion!

cheers,
jon.
Lars Madsen
2008-09-17 14:09:26 UTC
Permalink
Post by boukeas
Hello,
i am trying to use the title of an unnumbered section (\section*) in
my header and i have not been able to find any relevant references. is
there an equivalent to \sectionmark for \section*?
let me point out i am using the memoir class, just in case this
simplifies things.
Thanks,
George Boukeas
just wondering, why do you want something in the headers but not in the toc?

That sounds a bit odd to me, might confuse users

there might be other ways of getting round this problem if we knew a bit
more about the reasoning
--
/daleif (remove RTFSIGNATURE from email address)

LaTeX FAQ: http://www.tex.ac.uk/faq
LaTeX book: http://www.imf.au.dk/system/latex/bog/ (in Danish)
Remember to post minimal examples, see URL below
http://www.tex.ac.uk/cgi-bin/texfaq2html?label=minxampl
http://www.minimalbeispiel.de/mini-en.html
boukeas
2008-09-17 17:45:48 UTC
Permalink
Hello, thank you all for your replies.
Post by Lars Madsen
just wondering, why do you want something in the headers but not in the toc?
there might be other ways of getting round this problem if we knew a bit
more about the reasoning
To be honest, i was initially trying to solve the header problem
before actually getting to the toc problem.
But i DO want the sections* in the toc as well. Let me explain:

What i am preparing is handouts for my students. Each time, they will
be receiving a group of exercises belonging
to a particular chapter in the course.

so the first time, they will get: chapter 1, group I (possibly some
sub-title)
the second time, they will get: chapter 1, group II (possibly some
sub-title)
...
at some point, the chapter changes and the group is reset: chapter
2, group I
...
the last handout will be: chapter 6, group IV

So you see, initially the toc does not concern me because each handout
comprises a single chapter
with a single (unnumbered section) - the exercise group.

Eventually, at the end of the course, i would be interested in
compiling all handouts into a single 'book', and then
the toc problem comes into play. I would like the toc to include the
unnumbered sections, looking like:

Chapter 1
Group I
Group II
...
Chapter 2
Group I
Group II
...

So, any thoughts?

Oh, there is something i would like to add concerning the memoir
manual. Table 11.2 on page p.166 includes the starred version of
sectional commands (e.g. \book(*), \chapter(*)), giving me the
impression that \chaptermark, \sectionmark, etc. can be used whether
one uses a starred or unstarred version. It does not seem to be so -
either the table is misleading or there is something i have not
understood. And let me once again mention the notable exception of
\PoemTitle*, for which \poemtitlestarmark is explicitly defined.
Essentially, what I am asking is why something like \sectionstarmark
does not exist.

In general, I cannot understand why starred sectioning commands do not
call \...mark. I simply want the \section* title on the header, and it
seems to me that should be possible, as long as i don't try to include
the (non-existent) section number in the header. In other words,
something like the following seems perfectly natural to me:

\createmark{section*}{right}{nonumber}{}{} % there can be no other
option than nonumber

Eagerly expecting feedback,

George Boukeas.
Ulrike Fischer
2008-09-17 17:58:54 UTC
Permalink
Post by boukeas
Post by Lars Madsen
just wondering, why do you want something in the headers but not in the toc?
there might be other ways of getting round this problem if we knew a bit
more about the reasoning
To be honest, i was initially trying to solve the header problem
before actually getting to the toc problem.
The Koma-Classes have an \addsec-command which does that.

But on the whole I have the impression that you simply want unnumbered
sections. So why don't you change secnumdepth and use \section instead
of \section*?
--
Ulrike Fischer
boukeas
2008-09-17 19:20:16 UTC
Permalink
On the whole... you are absolutely right! Using secnumdepth never
occurred to me
in the first place -- i was too focused on getting the effect i wanted
with \...marks.

Thank you all very much, this works perfectly.

George Boukeas.
Post by Ulrike Fischer
But on the whole I have the impression that you simply want unnumbered
sections. So why don't you change secnumdepth and use \section instead
of \section*?
Bjoern Pedersen
2008-09-18 08:26:02 UTC
Permalink
So what you really want is to change the section numbering to "Group
\Roman(\thesection}. This should be possible with memoir.

Björn

Loading...