2

I'm writing an article and I want to show just the chapter titles at the beginning of them. The problem is with the appendix, since now I'd like to show "Appendix A".

My main.tex is

\documentclass[a4paper, 12pt, titlepage]{report}
\usepackage{titlesec}
\titleformat{\chapter}{\normalfont\huge}{\thechapter.}{20pt}{\bfseries\huge}
\usepackage[utf8]{inputenc}
\usepackage[title]{appendix} %appendices

\begin{document}

\maketitle
\tableofcontents
\input{ch1/chapter1}
\bibliography{mybib}
\bibliographystyle{plain}

\begin{appendices}
\input{app1/appendix1}
\end{appendices}

\end{document}

The beginning of chapter1.tex is

\chapter{Introduction}
I have some text in this chapter just like this.
It has survived not only 
five centuries, but also the leap into electronic typesetting, remaining 
essentially unchanged.

Part of file appendix1.tex is:

\chapter{Attached files to the project}
This is a description of the files and images that you will find in the several folders in the DVD.

My chapter title is like:

  1. Introduction

and appendix is:

A. Attached files to the project

but I'd like to see as appendix title:

Appendix A Attached files to the project

I know it is related with the command "\titleformat" but how can I fix it in order to show Appendix A + appendix title?

  • How about getting rid of \chapter title and just add appendix manually to toc? – MaestroGlanz May 22 '16 at 18:06
  • Yes. But I'd like not to show chapter (1,2,3) for every chapter but only the chapter title. How can I do? – Franktrt May 22 '16 at 18:35
  • Providing code with \input is never useful, to start with ;-) – user31729 May 22 '16 at 19:59
  • So you don't want the number for the chapter either? I.e. you want Chapter Title and not 1. Chapter Title? Please make your code compilable. – cfr May 22 '16 at 20:05
  • @cfr I have updated the question. The main request is the part of the appendix title as I want to show "Appendix A - Appendix title. About the chapter title, I'd like to show '1. Chapter title', but it's not so important that number. – Franktrt May 22 '16 at 20:22
2

To make the code compile, we need to remove \maketitle and the bibliography from the example and integrate the code fragments provided in the question.

Having done that, we can redefine the chapter style within the appendices environment to include the \appendixname in the chapter label which precedes the title.

For example:

\documentclass[a4paper, 12pt, titlepage]{report}
\usepackage{titlesec}
\titleformat{\chapter}{\normalfont\huge}{\thechapter.}{20pt}{\bfseries\huge}
\usepackage[utf8]{inputenc}
\usepackage[title]{appendix} %appendices

\begin{document}
\tableofcontents

\chapter{Introduction}
I have some text in this chapter just like this.
It has survived not only
five centuries, but also the leap into electronic typesetting, remaining
essentially unchanged.

\begin{appendices}
  \titleformat{\chapter}{\normalfont\huge}{\appendixname{} \thechapter.}{20pt}{\bfseries\huge}
  \chapter{Attached files to the project}
  This is a description of the files and images that you will find in the several folders in the DVD.
\end{appendices}

\end{document}

chapter and appendix

I gather this is what you want, although I'm not entirely certain.

EDIT

To put the appendix title on a new line, you can add back the default display shape when redefining the format in the appendices environment:

\titleformat{\chapter}[display]{\normalfont\huge}{\appendixname{} \thechapter.}{20pt}{\bfseries\huge}

+display

| improve this answer | |
  • Just one thing. Is it possible to have the title of appendix in a new line? – Franktrt May 22 '16 at 20:56
  • @Franktrt Please see edit above. display mimics the standard classes' default 'shape' for chapters. – cfr May 22 '16 at 21:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.