[texhax] How to put the chapter into report title
Alan T Litchfield
alan at alphabyte.co.nz
Wed Oct 6 23:01:27 CEST 2010
On 6/10/2010, at 7:39 PM, Uwe Lueck wrote:
> "Alan T Litchfield" <alan at alphabyte.co.nz>, 06.10.2010 01:46:35
>> Do not tell me what you think I should have. I know what I want. What
>> I want to know is how to get there. If that is not possible then
>> fine,
>> I can live with that.
> [...]
>> Sorry, but your response is increasingly offensive.
>
> Sorry, it was after midnight here. Next morning:
No problem. Strikes us all at some point :)
>
> "Alan T Litchfield" <[alan at alphabyte.co.nz]>, 15.09.2010 21:55:24:
>> I am using the report class with pdfLaTeX to generate chapter proofs
>> (that's because the whole thing uses report and I want easy
>> consistency).
>>
>> The preamble looks pretty much the same as the header file for the
>> whole document. For the whole document all the chapters are linked
>> using \include{..} and for this chapter proof the content references
>> only one chapter to include at a time.
>>
>> What I want to achieve is to put the contents of \chapter{...} into
>> \title{...} so when I run \maketitle the chapter title appears as the
>> report title,along the lines of:
>>
>> Chapter proof
>> The name of the chapter
>>
>> I am using \maketitle to capture the date of the proof.
>>
>> How can I use the chapter title as the report title?
>
> main file:
>
> \usepackage{nameref} % unless you load hyperref
> \title{Report\\[1ex]Chapter proof\\\nameref{ch:X}}
> \author{Alan T. Litchfield}
> \begin{document}
> \maketitle
>
> included file:
>
> \chapter{...}\label{ch:X}
>
> I really tested the \nameref thing, not having found an explicit
> statement on how to use \nameref.
>
> You may get errors in the first or second run, then just try again,
> third run should be fine.
>
I had not thought of that approach at all! :)
Often it is the simplest solution that escapes us.
What I have done though, from a suggestion from Peter Zimmerman, is
this:
I have put this into the draft chapter header file preamble:
\providecommand{\myChapter}[1]{\title{Draft chapter \\ #1}
\date{\today}
\author{Alan
Litchfield}
\maketitle
\chapter{#1}}
In the custom class file based on report.cls I have now added:
\providecommand{\myChapter}[1]{\chapter{#1}}
Then in all the chapters \chapter{...} has been replaced with
\myChapter{...}
So that I can produce random drafts and when the whole job is run it
will still work, producing chapter counters and a table of contents.
Hopefully nothing will be messed up by this but it seems to work for
now.
This all means I do not have to remember to change anything between
drafts and overall processing.
> HTH really -- Uwe.
It does. Thank you.
Alan
More information about the texhax
mailing list