Title and author at the table of contents

  • Follow


Hi all:

Please consider this file:

\documentclass{memoir}
\newcommand*{\capauthor}{}
\newcommand*{\captit}{}
\makechapterstyle{up}{%
\renewcommand*{\printchaptername}{}
\renewcommand*{\chapternamenum}{}
\renewcommand*{\chaptitlefont}{\huge\sffamily}
\renewcommand*{\printchapternum}{}
\renewcommand*{\afterchapternum}{}
}
\chapterstyle{up}
\makepagestyle{up}
   \makeevenhead{up}{\textsf{\captit}}{}{}
   \makeoddhead{up}{}{}{\textsf{\capauthor}}
   \makeevenfoot{up}{\textsf{\thepage}}{}{}
   \makeoddfoot{up}{}{}{\textsf{\thepage}}
\pagestyle{up}
\renewcommand*{\cftchapterfont}{\sffamily\large}
\renewcommand*{\chapternumberline}[1]{}
\renewcommand*{\cftchapterpagefont}{\sffamily\large}
\newcommand*{\mychapter}[2]{\renewcommand*{\captit}{#1}%
   \renewcommand*{\capauthor}{#2}%
   \chapter[{#1\\[1ex]\textit{#2}}][#1]{#1\\[1em]\Large\textit{#2}}}
\begin{document}
\frontmatter
\tableofcontents
\mainmatter
\mychapter{The doctor}{Dr.\ Jeckyll}
Some text.\newpage Some more text.\newpage Some more text.\newpage

\mychapter{The monster}{Mr.\ Hyde}
Some text.\newpage Some more text.\newpage Some more text.
\end{document}

Here's what I wanted to achieve with this (among other things):

1) The chapter numbers do not appear (both at table of contents and at
the first page of each chapter).

2) For each chapter, both at the first page of the chapter and at the
table of contents, we get both the title and the author (in one line
for each).

3) Everything, except the body of the text, is typeset in a sans serif
font.

Well, I got all this. But I also got two unwanted side effects at the
table of contents:

1) There is a space before the the name of the author;

2) The number of the first page of the chapter appears at the same line
as the name of the author; it should appear, of course, at the same line
as the chapter title.

Can anyone tell me how to correct this?

Best regards,

Jose Carlos Santos
0
Reply jcsantos (1099) 3/11/2010 11:38:07 PM

Jos� Carlos Santos wrote:
> Hi all:
> 
> Please consider this file:
> 
> \documentclass{memoir}
> \newcommand*{\capauthor}{}
> \newcommand*{\captit}{}
> \makechapterstyle{up}{%
> \renewcommand*{\printchaptername}{}
> \renewcommand*{\chapternamenum}{}
> \renewcommand*{\chaptitlefont}{\huge\sffamily}
> \renewcommand*{\printchapternum}{}
> \renewcommand*{\afterchapternum}{}
> }
> \chapterstyle{up}
> \makepagestyle{up}
>   \makeevenhead{up}{\textsf{\captit}}{}{}
>   \makeoddhead{up}{}{}{\textsf{\capauthor}}
>   \makeevenfoot{up}{\textsf{\thepage}}{}{}
>   \makeoddfoot{up}{}{}{\textsf{\thepage}}
> \pagestyle{up}
> \renewcommand*{\cftchapterfont}{\sffamily\large}
> \renewcommand*{\chapternumberline}[1]{}
> \renewcommand*{\cftchapterpagefont}{\sffamily\large}
> \newcommand*{\mychapter}[2]{\renewcommand*{\captit}{#1}%
>   \renewcommand*{\capauthor}{#2}%
>   \chapter[{#1\\[1ex]\textit{#2}}][#1]{#1\\[1em]\Large\textit{#2}}}
> \begin{document}
> \frontmatter
> \tableofcontents
> \mainmatter
> \mychapter{The doctor}{Dr.\ Jeckyll}
> Some text.\newpage Some more text.\newpage Some more text.\newpage
> 
> \mychapter{The monster}{Mr.\ Hyde}
> Some text.\newpage Some more text.\newpage Some more text.
> \end{document}
> 
> Here's what I wanted to achieve with this (among other things):
> 
> 1) The chapter numbers do not appear (both at table of contents and at
> the first page of each chapter).
> 
> 2) For each chapter, both at the first page of the chapter and at the
> table of contents, we get both the title and the author (in one line
> for each).
> 
> 3) Everything, except the body of the text, is typeset in a sans serif
> font.
> 
> Well, I got all this. But I also got two unwanted side effects at the
> table of contents:
> 
> 1) There is a space before the the name of the author;
> 
> 2) The number of the first page of the chapter appears at the same line
> as the name of the author; it should appear, of course, at the same line
> as the chapter title.
> 
> Can anyone tell me how to correct this?
> 
> Best regards,
> 
> Jose Carlos Santos

use the tools memoir provides you with

\documentclass{memoir}
\makechapterstyle{up}{%
   \renewcommand*{\printchaptername}{}
   \renewcommand*{\chapternamenum}{}
   \renewcommand*{\chaptitlefont}{\huge\sffamily}
   \renewcommand*{\printchapternum}{}
\renewcommand*{\afterchapternum}{}
}
\chapterstyle{up}
\makepagestyle{up}
\makeevenhead{up}{\textsf{\rightmark}}{}{}
\makeoddhead{up}{}{}{\textsf{\leftmark}}
\makeevenfoot{up}{\textsf{\thepage}}{}{}
\makeoddfoot{up}{}{}{\textsf{\thepage}}
\pagestyle{up}
\renewcommand*{\cftchapterfont}{\sffamily\large}
\renewcommand*{\chapternumberline}[1]{}
\renewcommand*{\cftchapterpagefont}{\sffamily\large}
\newcommand*{\mychapter}[2]{%
   \chapter*{#1}%
   \addcontentsline{toc}{chapter}{#1}%
   \chapterprecishere{#2}%
   \chapterprecistoc{#1}%
   \markboth{#1}{#2}%
}
\makeatletter
\DeclareRobustCommand{\precistoctext}[1]{%
   {%
    \nopagebreak\noindent\memRTLleftskip0pt\relax
    \memRTLrightskip \@tocrmarg\relax
    \precistocfont #1\par}}



\makeatother
\renewcommand*{\precisfont}{\normalfont\Large\itshape\sffamily}
\setlength\prechapterprecisshift{-\afterchapskip}
\addtolength\prechapterprecisshift{1em}
\renewcommand{\prechapterprecis}{%
   \vspace*{\prechapterprecisshift}%
   \begin{adjustwidth}{0em}{0em}\precisfont}
\renewcommand*{\postchapterprecis}{\end{adjustwidth}\vskip\afterchapskip}


\begin{document}
\frontmatter
\tableofcontents
\mainmatter
\mychapter{The doctor}{Dr.\ Jeckyll}
Some text.\newpage Some more text.\newpage Some more text.\newpage

\mychapter{The monster}{Mr.\ Hyde}
Some text.\newpage Some more text.\newpage Some more text.
\end{document}


0
Reply Lars 3/12/2010 12:05:13 AM


On 12-03-2010 0:05, Lars Madsen wrote:

>> Please consider this file:
>>
>> \documentclass{memoir}
>> \newcommand*{\capauthor}{}
>> \newcommand*{\captit}{}
>> \makechapterstyle{up}{%
>> \renewcommand*{\printchaptername}{}
>> \renewcommand*{\chapternamenum}{}
>> \renewcommand*{\chaptitlefont}{\huge\sffamily}
>> \renewcommand*{\printchapternum}{}
>> \renewcommand*{\afterchapternum}{}
>> }
>> \chapterstyle{up}
>> \makepagestyle{up}
>> \makeevenhead{up}{\textsf{\captit}}{}{}
>> \makeoddhead{up}{}{}{\textsf{\capauthor}}
>> \makeevenfoot{up}{\textsf{\thepage}}{}{}
>> \makeoddfoot{up}{}{}{\textsf{\thepage}}
>> \pagestyle{up}
>> \renewcommand*{\cftchapterfont}{\sffamily\large}
>> \renewcommand*{\chapternumberline}[1]{}
>> \renewcommand*{\cftchapterpagefont}{\sffamily\large}
>> \newcommand*{\mychapter}[2]{\renewcommand*{\captit}{#1}%
>> \renewcommand*{\capauthor}{#2}%
>> \chapter[{#1\\[1ex]\textit{#2}}][#1]{#1\\[1em]\Large\textit{#2}}}
>> \begin{document}
>> \frontmatter
>> \tableofcontents
>> \mainmatter
>> \mychapter{The doctor}{Dr.\ Jeckyll}
>> Some text.\newpage Some more text.\newpage Some more text.\newpage
>>
>> \mychapter{The monster}{Mr.\ Hyde}
>> Some text.\newpage Some more text.\newpage Some more text.
>> \end{document}
>>
>> Here's what I wanted to achieve with this (among other things):
>>
>> 1) The chapter numbers do not appear (both at table of contents and at
>> the first page of each chapter).
>>
>> 2) For each chapter, both at the first page of the chapter and at the
>> table of contents, we get both the title and the author (in one line
>> for each).
>>
>> 3) Everything, except the body of the text, is typeset in a sans serif
>> font.
>>
>> Well, I got all this. But I also got two unwanted side effects at the
>> table of contents:
>>
>> 1) There is a space before the the name of the author;
>>
>> 2) The number of the first page of the chapter appears at the same line
>> as the name of the author; it should appear, of course, at the same line
>> as the chapter title.
>>
>> Can anyone tell me how to correct this?
>>
>> Best regards,
>>
>> Jose Carlos Santos
>
> use the tools memoir provides you with
>
> \documentclass{memoir}
> \makechapterstyle{up}{%
> \renewcommand*{\printchaptername}{}
> \renewcommand*{\chapternamenum}{}
> \renewcommand*{\chaptitlefont}{\huge\sffamily}
> \renewcommand*{\printchapternum}{}
> \renewcommand*{\afterchapternum}{}
> }
> \chapterstyle{up}
> \makepagestyle{up}
> \makeevenhead{up}{\textsf{\rightmark}}{}{}
> \makeoddhead{up}{}{}{\textsf{\leftmark}}
> \makeevenfoot{up}{\textsf{\thepage}}{}{}
> \makeoddfoot{up}{}{}{\textsf{\thepage}}
> \pagestyle{up}
> \renewcommand*{\cftchapterfont}{\sffamily\large}
> \renewcommand*{\chapternumberline}[1]{}
> \renewcommand*{\cftchapterpagefont}{\sffamily\large}
> \newcommand*{\mychapter}[2]{%
> \chapter*{#1}%
> \addcontentsline{toc}{chapter}{#1}%
> \chapterprecishere{#2}%
> \chapterprecistoc{#1}%
> \markboth{#1}{#2}%
> }
> \makeatletter
> \DeclareRobustCommand{\precistoctext}[1]{%
> {%
> \nopagebreak\noindent\memRTLleftskip0pt\relax
> \memRTLrightskip \@tocrmarg\relax
> \precistocfont #1\par}}
>
>
>
> \makeatother
> \renewcommand*{\precisfont}{\normalfont\Large\itshape\sffamily}
> \setlength\prechapterprecisshift{-\afterchapskip}
> \addtolength\prechapterprecisshift{1em}
> \renewcommand{\prechapterprecis}{%
> \vspace*{\prechapterprecisshift}%
> \begin{adjustwidth}{0em}{0em}\precisfont}
> \renewcommand*{\postchapterprecis}{\end{adjustwidth}\vskip\afterchapskip}
>
>
> \begin{document}
> \frontmatter
> \tableofcontents
> \mainmatter
> \mychapter{The doctor}{Dr.\ Jeckyll}
> Some text.\newpage Some more text.\newpage Some more text.\newpage
>
> \mychapter{The monster}{Mr.\ Hyde}
> Some text.\newpage Some more text.\newpage Some more text.
> \end{document}

Well, this almost did what I wanted. I replaced

\chapterprecistoc{#1}

by

\chapterprecistoc{#2}

and it was better. However, the font used for the author's name was a
serifed one, in spite of your definition of \precisfont. I had to add

\renewcommand*{\precistocfont}{\normalfont\sffamily\itshape}

Thanks a lot... again! :-)

Best regards,

Jose Carlos Santos
0
Reply ISO 3/12/2010 12:34:23 AM

> 
> Well, this almost did what I wanted. I replaced
> 
> \chapterprecistoc{#1}
> 
> by
> 
> \chapterprecistoc{#2}
> 
> and it was better. However, the font used for the author's name was a
> serifed one, in spite of your definition of \precisfont. I had to add
> 
> \renewcommand*{\precistocfont}{\normalfont\sffamily\itshape}
> 
> Thanks a lot... again! :-)
> 
> Best regards,
> 
> Jose Carlos Santos

I only provide the building blocks, the details is up to you ;-)

that way you learn a bit more.

-- 

/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
0
Reply Lars 3/12/2010 9:16:39 AM

3 Replies
181 Views

(page loaded in 0.121 seconds)

Similiar Articles:













7/23/2012 10:43:54 AM


Reply: