Formatting the title of appendix

minute's picture

Could anyone help me with formatting the title of the appendix. I would like the format of the appendix title similar to the format of the chapter title.

Attached please find a small example of my document.

Thanks very much for your help

 

AttachmentSize
example.tex9.57 KB
John MacKendrick's picture

Ordinarily, when using

Ordinarily, when using book.cls, just entering a chapter head in the appendix will create a chapter head that is formatted like the other chapter heads in the book.

The sw20utah.sty file has been added to this document, however. This file re-formats the chapter heads and makes no provisions for chapter heads in the appendix. You can override this as follows.

First, revise the appendix TeX field, encapsulate it, and add the following commands

\makeatletter
\def\@makechapterhead#1{      \null
     \begin{center}
       APPENDIX \thechapter\\
       #1
      \end{center}
     \nobreak
}
\makeatother

These are the commands in sw20utah.sty used to format a chapter head except that the word "CHAPTER" has been replaced with the word "APPENDIX".

Next, choose Typeset, Preamble, and add

\makeatletter
\renewcommand\appendix{\par
  \setcounter{chapter}{0}
 \setcounter{section}{0}
\gdef\thechapter{\@Alph\c@chapter}}

\gdef\thesection{\thechapter.\arabic{section}}
\makeatother

This will reset the chapter counter and set it to be A,B,C instead of 1,2,3.

See the attached document as an example.

 

 

 

Hi there. This has helped me

Hi there.
This has helped me in the Linda Gilbert book style in that now my appendices are numbered with an A, B etc. However the Appendix headings are markedly smaller and different to the preceding numbered chapter headings and titles. Is there a small change to the above instructions for the Linda Gilbert style to achieve consistent Chapter and Appendix headings and titles?
Many thanks.

John MacKendrick's picture

Yes, you can revise the

Yes, you can revise the appendix TeX field and add items to it so chapter heads in Appendices more closely resemble the chapter heads elsewhere.

Try changing it to read

\appendix
\makeatletter
\def\@makechapterhead#1{      \null
     \begin{center} 
       \huge\bfseries 
       APPENDIX \thechapter\\
      \par\nobreak
      \vskip 20\p@
       \Huge \bfseries #1
      \end{center}
     \nobreak
     \vskip 40\p@
}
\makeatother

(Much of the code was borrowed from book.cls, which is what the Linda Gilbert shell uses to format the chapter heads.)

Many thanks - most helpful as

Many thanks - most helpful as always.

minute's picture

Hi John, I am struggling with

Hi John,

I am struggling with the sw20utah.sty. Could you please show me the documentation for the package.

Basically, I would like to remove the word "Chapter" in my TOC. In addition, I would like to have identical vertical space from top of the page to the "TABLE of CONTENT", "List of Table", "Abstract", etc and from these headers to the body text.

In addition, the page number on my LOT and LOF are blank, I would like them to show up.

Thanks very much for your help

D

 

 

 

 

The only documentation for

The only documentation for sw20utah.sty is the file itself.

If you need customization, probably it would be better to copy sw20utah.sty, give it a new name, then in your document change the package being used from sw20utah to whatever you name your version (use the Go Native button after selecting Typeset, Options and Packages on the Package Options tab).

The word "Chapter" is added by the \firstchapter macro.  It is defined in sw20utah.sty as:

\def\firstchapter{%
       \pagestyle{myheadings}
       \pagenumbering{arabic}
       \addtocontents{toc}{\protect{\addvspace{12pt}}}    
    \addtocontents{toc}{\protect{\noindent{Chapter}\para}}   
       \def\firstchapter{\relax}}

You would need to remove the \addtocontents lines.  If you have appendices in your document, then a similar change would be needed for the \appendix macro.

When I compile the shell document, the vertical positioning for each of the headings you mention is the same.  Maybe you have something added to your document that is causing a different appearance.  Also, there are page numbers for the lof and lot pages (but not for acknowledgments, as specified in sw20utah.sty).

minute's picture

Hi John, Thanks very much for

Hi John,

Thanks very much for your reply.

I attach here a minimal example so that you can look at the problem in more detail.

I would like all the headings Acknowlegment, Table of Content, List of Table, List of Figure, Abstract, Chapter 1, Appendix A

to have indentical vertical space from top of the page to these headings and from these heading to the body text.

Thanks

D

 

You've added a bunch of

You've added a bunch of commands that seems to change the formatting for the LOF and LOT, so don't you need similar commands for the TOC? 

minute's picture

Yes, I added a bunch of

Yes, I added a bunch of command to th LOT and LOF to modify the vertical space of the headings in LOT and LOF. These command also eliminate space between the last table (figure) of the previous chapter and the first table (figure) of the next chapter. I would like to have the same command for the TOC.

I just struggling with removing the word 'Chapter' in TOC, make page number show up in LOT and LOF, and make all the vertical spaces identical

Thanks

D

 

 

How

How about:

\setlength\cftaftertoctitleskip{10pt}
\setlength\cftbeforetoctitleskip{25pt}

These are available from the tocloft package that you are already using for the other modifications you are making.

You have:

\addtocontents{toc}{\protect\thispagestyle{fancy}}

Add these:

\addtocontents{lot}{\protect\thispagestyle{fancy}}
\addtocontents{lof}{\protect\thispagestyle{fancy}}

 

 

minute's picture

Thanks John! The page number

Thanks John!

The page number now is appearing in the LOT and LOF page.

I am now trying to remove the word 'Chapter" in TOC.

Could you please help me with that?

In addition, how can I use these commands

 

\setlength\cftaftertoctitleskip{10pt}
\setlength\cftbeforetoctitleskip{25pt}

with Chapter and Appendix. Can I replace 'toc' with 'chap', 'appendix', 'section'

Thanks 

D 

 

I already answered the

I already answered the question about removing "Chapter" from the TOC.  To be explicit, if you are not going to create a replacement for sw20utah.sty, then you can add the following to your document preamble (since \firstchapter is used only in the .sty file and not in the body of the document):

\def\firstchapter{%
       \pagestyle{myheadings}
       \pagenumbering{arabic}
       \def\firstchapter{\relax}}

Since \appendix is used in the body of the document, you can place the replacement \def for \appendix in an encapsulated TeX field before where \appendix is used in your document.

See the tocloft package documentation to find the correct substitutions to use for 'toc'.  There would not be one for 'appendix' since these are just chapters that appear after \appendix.

minute's picture

Thanks John, your codes work

Thanks John, your codes work great!

minute's picture

Hi John, I have 2 more

Hi John,

I have 2 more questions:

1. My LOT starts at page vii and ends at page ix. However, in the TOC, the List of Table show the page ix instead of vii (i.e., it gives the last page of LOT rather than the first page). How can I change it to page vii ?

2. I am using manual bibliography, how can I change the vertical space in the reference page ? Also, how can I cahnge the appearance of the word "reference" in the TOC ?

Thanks

D

 

1.  Well, you are getting

1.  Well, you are getting exactly what you are asking for.  In your document you are using:

\listoftables
\addcontentsline{toc}{chapter}{\numberline{}List of Tables}
\addtocontents{lot}{\protect\noaddvspace}%

This does the LOT, and when done adds to the TOC at the current page position.  What you want is:

\clearpage
\addcontentsline{toc}{chapter}{\numberline{}List of Tables}
\addtocontents{lot}{\protect\noaddvspace}
\listoftables
 

The \clearpage (or use \cleardoublepage with a book typesetting specification where chapter divisions start on odd numbered pages) starts the next page, then the \addtocontents line will have the correct page number.

2. Not sure what you would want to change with the vertical spacing for the bibliography page.  For the book typesetting specification, this should look like any other unnumbered chapter heading.  For the book or report typesetting specification, you could use a command like:

\renewcommand\bibname{Bibliography}

However, if you are using sw20utah.sty, then the formatting of the bibliography is controlled by commands in that file where thebibliography is defined.