3

I'm writing my thesis using \documentclass[report] and have two abstract sections in English and French. I switched languages using \selectlanguage[french]. I also added Acknowledgements using \chapter*{Acknowledgements}. My code is shown below (I have additional packages - not shown here).

\documentclass[12pt, Bold]{report}
\usepackage{tocbibind}
\usepackage[english,french]{babel}
\usepackage{graphicx}
\usepackage{setspace}
\usepackage{chngpage}
\usepackage{titlesec}
\titleformat{\chapter}[display]{\large\centering}{CHAPTER\ \thechapter}{0 pt}{ \Large\centering \vspace{-0.1in}}[\vspace*{-0.3in}]
\titleformat{\section} [hang] {\large\bf} {\large\thesection} {5pt} {\large} [] 
\titleformat{\subsection} [hang] {\bf} {\thesubsection} {5pt} {} []     
\usepackage[hidelinks]{hyperref} 

\begin{document}
\title{ Title commands \thispagestyle{empty}}
\makettile 

\selectlanguage{english}
\begin{abstract}
text here
\end{abstract}
\phantomsection
\clearpage
\addcontentsline{toc}{section}{Abstract}

\selectlanguage{french}
\begin{abstract}
text here
\end{abstract}
\phantomsection
\clearpage
\addcontentsline{toc}{section}{Abr\'{e}g\'{e}}

\selectlanguage{english}
\chapter*{\large\textbf{Acknowledgements}}
text here
\clearpage
\phantomsection
\addcontentsline{toc}{section}{Acknowledgements}

\end{document}
  1. The french abstract reads "Resume", I want this to be "Abrégé". I changed this for the table of contents entry but want the page to show "Abrégé" as well.
  2. The table of contents lists the abstract, french abstract and acknowledgments but has the same page number for all. When clicked, it leads to the correct section but has incorrect page numbers.
  3. The title page has a preceding empty page and a visible page number - 2.

I checked several questions here related to these issues but haven't been able to recreate the fixes suggested for my document. Can these be fixed?

  • \renewcommand{\abstractname}{Abr\'{e}g\'{e}} should work for one issue of your question – user31729 Jul 31 '14 at 0:13
  • There is a small typo \makettile instead of \maketitle – user31729 Jul 31 '14 at 0:15
  • Obviously, \begin{abstract} resets the page number, this is done twice since your document contains two abstracts. Using scrreprt removes this problem, but since you are using titlesec, this could cause problems, since KOMA classes like scrreprt and titlesec do not coexist very well. – user31729 Jul 31 '14 at 0:20
  • I can't reproduce the 3rd. issue about the blank page preceding the titlepage – user31729 Jul 31 '14 at 0:57
3

The report class has a very strange management of the abstract environment, resetting the page counter to one at every usage. The same is for the title page, so I suggest, first of all, to remove this resetting.

Next, it would be quite strange seeing the abstracts formatted differently than the acknowledgments chapter; since your chapter heading style is quite unobtrusive, it's probably better to treat the abstracts at the same level as chapters.

I also changed the specifications for the chapter header femoving the two \vspace instructions that only do damage and setting the “Chapter x” bit in normal size, as the difference between \large and \Large is not really noticeable. Never use \bf or the similar two letter font changing commands, they have been deprecated for more than twenty years.

How to change language? If your main language is English, that option should come last when loading babel. For setting the French abstract, use the otherlanguage environment (with a redefinition for \abstractname in the preamble, with \addto\captionsfrench).

Together with a redefinition for abstract and the definition for acknowledgments, here's the code.

\documentclass[12pt]{report}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[french,english]{babel}

\usepackage[nottoc]{tocbibind} % nottoc, or the contents will go in the contents
\usepackage{graphicx}
\usepackage{setspace}
\usepackage{chngpage}
\usepackage{titlesec}
\usepackage{etoolbox}
\usepackage[hidelinks]{hyperref}

%%% patch titlepage to not reset the page number
\makeatletter
\patchcmd{\titlepage}
 {\setcounter{page}\@ne}
 {}
 {}{}
\patchcmd{\endtitlepage}
 {\setcounter{page}\@ne}
 {}
 {}{}
\makeatother

\titleformat{\chapter}[display]
  {\bfseries\centering}
  {\MakeUppercase{\chaptername}\ \thechapter}
  {0pt}
  {\Large}

\titleformat{\section}[hang]
  {\large\bfseries}
  {\thesection}
  {5pt}
  {}

\titleformat{\subsection}[hang]
  {\bfseries}
  {\thesubsection}
  {5pt}
  {}

\addto\captionsfrench{\renewcommand{\abstractname}{Abr\'eg\'e}}

\renewenvironment{abstract}[1][\abstractname]
 {\clearpage\phantomsection\addcontentsline{toc}{chapter}{#1}%
  \chapter*{#1}}
 {\clearpage}
\newenvironment{acknowledgments}
 {\begin{abstract}[Acknowledgments]}
 {\end{abstract}}

\begin{document}

\title{Title commands}
\author{Some Body}
\maketitle

\tableofcontents

\begin{abstract}
text here
\end{abstract}

\begin{otherlanguage}{french}
\begin{abstract}
text here
\end{abstract}
\end{otherlanguage}

\begin{acknowledgments}
text here
\end{acknowledgments}

\chapter{Here it begins}

text here

\end{document}
  • I used both answers and found egreg's suggestion fit better with what I want. However, I still have a blank page before the title page. This is alright but I want to remove the page number (2) from the title page. I added \pagenumbering{roman} before the two abstracts, acknowledgment and changed it back to \pagenumbering{arabic}. – Gautam Jul 31 '14 at 16:38
5

abstract uses the titlepage environment, which sets the pagenumber explicitly to 1, the easiest way to remove this, is to redefine the titlepage environment.

I also redefined the abstract environment such that it automatically adds a TOC entry on section level with \abstractname content.

The abstract name for french could be changed by a \renewcommand.

Linking leads to the correct pages, as well as the page numbers are continous now.

\documentclass[12pt, Bold]{report}
\usepackage{tocbibind}
\usepackage[english,french]{babel}
\usepackage{graphicx}
\usepackage{setspace}
\usepackage{chngpage}
\usepackage{titlesec}
\usepackage{etoolbox}%
\usepackage{blindtext}%
\usepackage{letltxmacro}%

\titleformat{\chapter}[display]{\large\centering}{CHAPTER\ \thechapter}{0 pt}{ \Large\centering \vspace{-0.1in}}[\vspace*{-0.3in}]
\titleformat{\section} [hang] {\large\bf} {\large\thesection} {5pt} {\large} [] 
\titleformat{\subsection} [hang] {\bf} {\thesubsection} {5pt} {} []     
\usepackage[hidelinks]{hyperref} 

\LetLtxMacro\StandardAbstract\abstract
\let\StandardAbstractEnd\endabstract


\makeatletter
\renewenvironment{titlepage}
    {%
      \if@twocolumn
        \@restonecoltrue\onecolumn
      \else
        \@restonecolfalse\newpage
      \fi
      \thispagestyle{empty}%
%%% Resetting of the page number --> unwanted here
%      \setcounter{page}\@ne 
    }%
    {\if@restonecol\twocolumn \else \newpage \fi
     \if@twoside\else
%%% Resetting of the page number --> unwanted here
%        \setcounter{page}\@ne 
     \fi
   }% End of renewenvironment{titlepage}



\renewenvironment{abstract}{%
\phantomsection%
\StandardAbstract%
\addcontentsline{toc}{section}{\abstractname}%
}
{\StandardAbstractEnd\clearpage}%
\makeatother


\begin{document}
\title{ Title commands \thispagestyle{empty}}
\maketitle 

\tableofcontents
\clearpage


\selectlanguage{english}


\begin{abstract}
\blindtext%
\end{abstract}


\selectlanguage{french}
\renewcommand{\abstractname}{Abr\'{e}g\'{e}}
\begin{abstract}
\blindtext
\end{abstract}

\blindtext

\selectlanguage{english}
\phantomsection
\chapter*{\large\textbf{Acknowledgements}}
\addcontentsline{toc}{chapter}{Acknowledgements}
text here
\clearpage

\end{document}

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.