0

I want to do two things in my document

  1. Add borders to my table of contents
  2. Centre/align the title of table to title of the page

In the following image, I am only showing the contents (not the whole page, the rest of it is blank). This is how I want my page to look: Title page

My code is as follows, firstly I have a class file called Vakalatnama.cls which contains the majority of code:

\ProvidesClass{vakalatnama}[2020/09/15 Vakalatnama template for Indian courts]

\LoadClass{article}

\RequirePackage{xparse}
\RequirePackage[driver=xetex,a4paper,noheadfoot,includeheadfoot,nomarginpar,top=1.5in,bottom=1.5in,left=1.75in,right=1.0in]{geometry}
\RequirePackage{xunicode}
% \RequirePackage{xltxtra}

% Make entries in the index table as links
\RequirePackage[linktocpage=true]{hyperref}

% Set font to Times New Roman
\RequirePackage{fontspec}
\setmainfont{Times New Roman}

% line spacing = 1.5
\RequirePackage[onehalfspacing]{setspace}

\RequirePackage[parfill]{parskip}

% Format section title to have numbers in Table of Contents, but not in document
\newcommand\secpagebreak{}
\RequirePackage{titlesec}
\titleformat{\section}{\center \normalfont \bfseries}{}{0pt}{\secpagebreak}
\setcounter{section}{1}

\RequirePackage{fontenc}
\hyphenation{con-sti-tu-tion-al}

% Set title of Table of Contents from Contents -> Particulars. '*' implies that
% the argument must not be in multiple paragraphs i.e. /long
\renewcommand*{\contentsname}{
    \par\noindent\hspace*{\fill} \textbf{\underline{Index}} \hspace*{\fill} \\*
    \hspace*{-10pt}\underline{{\textbf{Si. No.}}} \hfill \underline{\textbf{Particulars}} \hfill \underline{\textbf{Page}}
}

\newcommand{\pnp}{Test Solicitor}
\newcommand{\dhc}{Delhi High Court}
\newcommand{\sci}{Supreme Court of India}
\newcommand{\petitioner}[1]{\newcommand{\@petitioner}{#1}}
\newcommand{\respondent}[1]{\newcommand{\respndt}{#1}}
\newcommand{\court}[1]{\newcommand{\crt}{#1}}
\newcommand{\jurisdiction}[1]{\newcommand{\jurisdctn}{#1}}
\newcommand{\petitiontype}[1]{\newcommand{\ptntype}{#1}}

\NewDocumentCommand {\setname} {O{Shri} m m} { % Title (default=Shri), first, last
    \newcommand {\tfname} {#1 #2 #3} % Full name with title
    \newcommand {\fname} {#2 #3} % first + last name
    \newcommand {\tlname} {#1 #3} % title + last name
}

\newcommand{\advocate}[2][Shri]{
    \newcommand{\adv}{#2}
    \newcommand{\fulladv}{#1 #2}
}


\newcommand{\clientdetails}[1]{\newcommand{\clntdtls}{#1}}

\newcommand{\caseNumbers}[2]{
    \newcommand{\fullcasenumber}{#1 of #2}
    \newcommand{\shortcasenumber}{#1/#2}
}


\newcommand{\casetitle}{
    \begin{center}
        \textsc{In the \crt{}} \newline
        \textsc{\jurisdctn{}} \newline
        \textsc{\ptntype{} \fullcasenumber{}} \newline
    \end{center}
}

\newcommand{\inmatterof}{%
        \begin{tabular}{l c r}
             \multicolumn{3}{l}{\underline{\textsc{In the matter of:}}}  \tabularnewline
             \tabularnewline
             \@petitioner & \ldots & Petitioner \\* %\tabularnewline
             \multicolumn{3}{c}{-- \textsc{versus} --} \tabularnewline
             \respndt & \ldots & Respondent \tabularnewline
        \end{tabular}
}

\newcommand{\parties}{%
    \begin {center}
        \begin{tabular}{l c r}
             \@petitioner & \ldots & Appellant/Petitioner \tabularnewline
             \multicolumn{3}{c}{-- \textsc{Between/And} --} \tabularnewline
             \respndt & \ldots & Defendant/Respondent/Opposite Party \tabularnewline
        \end{tabular}
    \end{center}
}

\newcommand{\tophead}{%Roll the Court Name, petition etc into a single command
    \casetitle{}
    \inmatterof{}
}

\renewcommand \maketitle {
    % Cover page
    \thispagestyle{empty}
    \pagenumbering{gobble}

    \casetitle{}

    \inmatterof{}

    \vspace*{5em}
    \tableofcontents
    \vspace*{5em}

    \textbf{Advocate for the Respondent: \respndt{}}

    \renewcommand\secpagebreak{\clearpage}
}

\ProcessOptions\relax
\endinput

And then main.tex

\begin{document}

\petitioner{Test Petitioner}
\court{Supreme Court Of India}
\respondent{State of Uttar Pradesh and Others}
\jurisdiction{Criminal Appellate Jurisdiction}
\petitiontype{SLP (Civil)}
\caseNumbers{1152}{2000}
\advocate{\pnp}
\clientdetails{Test Petitioner}

\maketitle
\setcounter{page}{1}
\pagenumbering{arabic}

\section{Vakalatnama}
\section{Memo of Appearance}

\end{document}

Thank you in advance for your help :-)

1
  • 1
    For item (2) use \\ not \newline. I would normally typeset these a paragraps and not use any forced line breaks, but your use of enlarged line spacing makes that more difficult
    – daleif
    Oct 2 '20 at 11:28
0

I used etoc package as follows in my class file:

% Format Table of Contents
\RequirePackage{etoc}
\newcommand{\titleoftoc}{\textsc{Index}}
\newcommand{\mktoc}{% Cover page
\begin{center}
    \etocsetstyle{section}
    {}
    {\etociffirst{ \\ \hline}{\\\hline}}
    {\etocnumber & \etocname & \etocnumber }
    {}
    \etocsettocstyle{\hypersetup{hidelinks}
    \begin{tabular}{|c|l|c|}
        \multicolumn{3}{c}{\titleoftoc} \\
        \hline
        \multicolumn{1}{|c|}{\bfseries Si No} &
        {\bfseries Particulars} &
        {\bfseries Page}
    }
    {\\ \hline\end{tabular}}
\etocglobaldefs
\etocsetnexttocdepth{1}
\tableofcontents
\end{center}
}

Afterwards, in main.tex

\begin{document}

    % Set other paramaters

    \mktitle
    \section{AAA}
    \section{BBB}
\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.