I am trying to create a new class for my thesis. I defined a \NewDocumentEnvironment
for the Abstract page.
The usage is as follows (#1 m, #2 o, #3 O):
\abstract{Your abstract}[number of blank pages][comment~on~the~last~page]
.
For example, \abstract{content}[3]
gives a 4 page document, first page is with conent, rest two pages blank, fourth page shows the default This~page~is~intentionally~left~empty!
message.
Now, let's say, I want to have my Acknowledgement page to be of the same style. One option is to copy everything and rename it. But what is a better option? Can I create one \NewDocumentEnvironment
which will be used in both abstract
and acknowledgement
?
Class (testtwo.cls
)
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{testtwo} [2017/05/11 v0.1 A class to write PhD thesis]
\LoadClass{book}
\usepackage{xparse} % http://ctan.org/pkg/xparse
%% Abstract
{}
\ExplSyntaxOn
\NewDocumentEnvironment{abstract}{m o O{This~page~is~intentionally~left~empty!}} % https://tex.stackexchange.com/a/30992/38244
{
\pagestyle{empty}
\null\vfil
\begin{center}
\setlength{\parskip}{0pt}
{\huge{\textit{Abstract}} \par}
\bigskip
\end{center}
{\normalsize #1 \par}
\vspace*{\fill}
\newcount\tmp
\IfNoValueTF{#2}
{ %#2 is nothing
\pagebreak
}
{ % #2 is something
{
\tmp=0 % https://tex.stackexchange.com/a/89015/38244
\loop
\advance\tmp by 1
\null\newpage
\ifnum\tmp<#2
\repeat
\IfNoValueTF{#3}
{ %#3 is nothing!
\pagebreak
}
{ %#3 is something!
\pagebreak
\topskip0pt % https://tex.stackexchange.com/a/2327/38244
\vspace*{\fill}
\hspace*{\fill}
\textit{#3} % Not sure why spaces aren't coming!
\hspace*{\fill}
\vspace*{\fill}
}
%#3 ends here
}
}
}
{}
\ExplSyntaxOff
MWE (testtwo.tex
)
\documentclass{testtwo}
\begin{document}
\abstract{something}[3]%[]
\end{document}
\begin{zzz}..\end{zzz}
not\zzz{...}
either declare it as a command or an enviornment, but use it in whichever way you declare