Search code examples
latexabstract-classnaming

Two abstracts with different names in LateX


I am using a LateX template for my PhD thesis which is available via this link: https://github.com/kks32/phd-thesis-template/blob/master/Classes/PhDThesisPSnPDF.cls I wish to include two abstracts for the request of the University. One with the name "Abstract" and one with the name "Lay Summary". But I am having trouble changing the title in the second abstract. The abstract is a tex file starting with the following lines:

\begin{abstract}
....
\end{abstract} 

The documentclass is a custom defined environment:

\documentclass[a4paper,12pt,times,numbered,print,index]{Classes/PhDThesisPSnPDF}

I tried this code in the second abstract before the \begin{abstract} line with an error message: "! LaTeX Error: \abstractname undefined".

\renewcommand{\abstractname}{Lay Summary}

And even if it would change the title I do not need it to be changed globally just for the second time. I need to have the second abstract before the numbered content, ideally after the first abstract. Is there any suggestion what to try?


Solution

  • I have got, say quite easily, a tested solution.

    In my folder, I saved your custom documentclass file as docclass.cls.

    In the same folder, I saved and compiled my MWE/main .tex file:

    \documentclass[a4paper,12pt,times,numbered,print,index]{docclass}
    
    \newenvironment{laysummary} {
      \cleardoublepage
      \setsinglecolumn
      \chapter*{\centering \Large Lay Summary}
      \thispagestyle{empty}
    }
    
    \begin{document}
    
    \begin{abstract}
    First.
    \end{abstract}
    
    \begin{laysummary}
    Second.
    \end{laysummary}
    
    \chapter{Chapter}
    Some Text.
    
    \end{document}
    

    This produces the output you wanted to achieve with Abstract and Lay Summary:

    Abstract followed by Lay Summary

    Notice that the key thing is in the lines:

    \newenvironment{laysummary} {
      \cleardoublepage
      \setsinglecolumn
      \chapter*{\centering \Large Lay Summary}
      \thispagestyle{empty}
    }
    

    that I took from lines 1105-1121 of your custom documentclass:

    \newenvironment{abstract} {
    \ifPHD@abstract
    % Separate abstract as per Student Registry guidelines
      \thispagestyle{empty}
      \setsinglecolumn
      \begin{center}
        { \Large {\bfseries {\@title}} \par}
        {{\large \vspace*{1em} \@author} \par}
      \end{center}
    \else
    % Normal abstract in the thesis
      \cleardoublepage
      \setsinglecolumn
      \chapter*{\centering \Large Abstract}
      \thispagestyle{empty}
    \fi
    }
    

    I did not remove or even modify these latter inside the documentclass file, I edited a copy of it that I then pasted in the main tex file. If you want to keep your main tex file cleaner, my six lines defining laysummary environmemt may be pasted at the end of the documentclass cls file instead.