Discussion:
header problem - \chaptername without "Chapter X."?
(too old to reply)
PmI
2009-11-09 14:02:12 UTC
Permalink
Raw Message
How do I get a chaptername to print as just the title I gave it in my source,
rather than with "Chapter X." in front of it?

My source has, for instance, \Chapter{Syntax}, and the header will say
"Chapter 1. Synax"... which is not what I exptected.

With some help from the internet, fancyhdr, and some testing I got it down
to:

\renewcommand{\chaptername}{}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesubsection\ #1}}
\fancyhead{} % clear all header fields
\fancyhead[RO,LE]{\thepage}
\fancyhead[LO,RE]{\nouppercase{\leftmark} — section \nouppercase{\rightmark}}

Which already strips the word "Chapter"from the chaptername, but the number
is still there, so that the header now looks like "1. syntax - section ..."

How do I get rid of this number, too?

And where do I find this information listed in a convenient way, because I
search the net for hours trying to find this explained using a plethora of
search terms, and nothing actually explains why "chaptername" isn't actually
the chapter name, but some concatenated strong of "Chapter", its order
number, and then the actual chapter title. Which I assume is magically added
into it when the chaptermark is requested, because if there is a command that
gives the ACTUAL chapter title, the internet sure as heck isn't telling me
what that command is =(

- Mike Kamermans
Lars Madsen
2009-11-09 14:10:39 UTC
Permalink
Raw Message
Post by PmI
How do I get a chaptername to print as just the title I gave it in my source,
rather than with "Chapter X." in front of it?
My source has, for instance, \Chapter{Syntax}, and the header will say
"Chapter 1. Synax"... which is not what I exptected.
With some help from the internet, fancyhdr, and some testing I got it down
\renewcommand{\chaptername}{}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesubsection\ #1}}
\fancyhead{} % clear all header fields
\fancyhead[RO,LE]{\thepage}
\fancyhead[LO,RE]{\nouppercase{\leftmark} — section \nouppercase{\rightmark}}
Which already strips the word "Chapter"from the chaptername, but the number
is still there, so that the header now looks like "1. syntax - section ..."
How do I get rid of this number, too?
And where do I find this information listed in a convenient way, because I
search the net for hours trying to find this explained using a plethora of
search terms, and nothing actually explains why "chaptername" isn't actually
the chapter name, but some concatenated strong of "Chapter", its order
number, and then the actual chapter title. Which I assume is magically added
into it when the chaptermark is requested, because if there is a command that
gives the ACTUAL chapter title, the internet sure as heck isn't telling me
what that command is =(
- Mike Kamermans
would you please provide a minimal example please (I'd like to see a
compailable example that gives the result you mention).

It sounds a bit weird that the number is still there.
--
/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
PmI
2009-11-09 15:25:48 UTC
Permalink
Raw Message
Ah yes, certainly.

You may find the .tex file and consequent .pdf on
http://pomax.nihongoresources.com/downloads/temp (texated.tex and
texated.pdf)

The pdf was generated using xelatex, using the following series of commands

xelatex texated.tex % initial run
xelatex texated.tex % to add ToC
makeindex -s texated.ist -t texated.glg -o texated.gls texated.glo
xelatex texated.tex % to add glossary
makeindex texated.idx
xelatex texated.tex % to add index
xelatex texated.tex % final realign run

- Mike "Pomax" Kamermans
nihongoresources.com
Lars Madsen
2009-11-09 15:37:31 UTC
Permalink
Raw Message
Post by PmI
Ah yes, certainly.
You may find the .tex file and consequent .pdf on
http://pomax.nihongoresources.com/downloads/temp (texated.tex and
texated.pdf)
The pdf was generated using xelatex, using the following series of commands
xelatex texated.tex % initial run
xelatex texated.tex % to add ToC
makeindex -s texated.ist -t texated.glg -o texated.gls texated.glo
xelatex texated.tex % to add glossary
makeindex texated.idx
xelatex texated.tex % to add index
xelatex texated.tex % final realign run
- Mike "Pomax" Kamermans
nihongoresources.com
easy fix, place your change to \chaptermark AFTER \pagestyle{fancy}
--
/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
PmI
2009-11-09 20:03:48 UTC
Permalink
Raw Message
Post by Lars Madsen
easy fix, place your change to \chaptermark AFTER \pagestyle{fancy}
Excellent, thank you. For future reference, where might one find this kind of
information so that the fix is indeed "easy" rather than "easy, but only if
you happened to know about it"? =)

- Mike
Lars Madsen
2009-11-09 21:59:24 UTC
Permalink
Raw Message
Post by PmI
Post by Lars Madsen
easy fix, place your change to \chaptermark AFTER \pagestyle{fancy}
Excellent, thank you. For future reference, where might one find this kind of
information so that the fix is indeed "easy" rather than "easy, but only if
you happened to know about it"? =)
- Mike
cannot say much more than look in the code. And in particular read the
manuals for the packages being used.

/daleif
Peter Flynn
2009-11-09 22:02:03 UTC
Permalink
Raw Message
Post by PmI
How do I get a chaptername to print as just the title I gave it in my
source, rather than with "Chapter X." in front of it?
My source has, for instance, \Chapter{Syntax}, and the header will
say "Chapter 1. Synax"... which is not what I exptected.
Why not? That is exactly what I would expect a chapter head to say.

\Chapter (with the capital C) is not defined in any of the basic
classes, so you are presumably using some other document class you
haven't told us about.

The book and report classes provide \chapter but also \chapter*, which
does what you ask. If \Chapter*{Syntax} doesn't do this, tell us what
document class you are using.
Post by PmI
Post by Lars Madsen
easy fix, place your change to \chaptermark AFTER \pagestyle{fancy}
Excellent, thank you. For future reference, where might one find this kind of
information so that the fix is indeed "easy" rather than "easy, but only if
you happened to know about it"? =)
If there is no package to do what you want (which should always be the
first thing to look for), then the procedure is to find the command
causing the effect by looking in the .cls or .sty file, copy it to your
own .sty file (or into the Preamble of your document), and change it there.

A quick look into book.cls reveals that \chapter end up by calling
Post by PmI
\par\nobreak
\fi
\fi
\Huge \bfseries #1\par\nobreak
}}
If you copy this into your own .sty file, you can edit it to do whatever
you want with a chapter heading; in your case, removing everything from
\ifnum \***@secnumdepth down to the second \fi.

But \chapter* does exactly this. See if \Chapter* also does it.

///Peter
l***@gmail.com
2018-01-02 19:00:48 UTC
Permalink
Raw Message
在 2009年11月9日星期一 UTC+8下午11:37:31,Lars Madsen写道:
Post by Lars Madsen
Post by PmI
Ah yes, certainly.
You may find the .tex file and consequent .pdf on
http://pomax.nihongoresources.com/downloads/temp (texated.tex and
texated.pdf)
The pdf was generated using xelatex, using the following series of commands
xelatex texated.tex % initial run
xelatex texated.tex % to add ToC
makeindex -s texated.ist -t texated.glg -o texated.gls texated.glo
xelatex texated.tex % to add glossary
makeindex texated.idx
xelatex texated.tex % to add index
xelatex texated.tex % final realign run
- Mike "Pomax" Kamermans
nihongoresources.com
easy fix, place your change to \chaptermark AFTER \pagestyle{fancy}
--
/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
Excellent, thank you! This has solved successfully my problem.

Loading...