\documentclass{report}
\usepackage{hyperref}
% WARNING: THIS SHOULD BE MODIFIED DEPENDING ON THE LETTER/A4 SIZE
\oddsidemargin 0cm
\evensidemargin 0cm
\marginparsep 0cm
\marginparwidth 0cm
\parindent 0cm
\setlength{\textwidth}{\paperwidth}
\addtolength{\textwidth}{-2in}


% Conditional define to determine if pdf output is used
\newif\ifpdf
\ifx\pdfoutput\undefined
\pdffalse
\else
\pdfoutput=1
\pdftrue
\fi

\ifpdf
  \usepackage[pdftex]{graphicx}
\else
  \usepackage[dvips]{graphicx}
\fi

% Write Document information for pdflatex/pdftex
\ifpdf
\pdfinfo{
 /Author     (Pasdoc)
 /Title      ()
}
\fi


% definitons for warning and note tag
\usepackage[most]{tcolorbox}
\newtcolorbox{tcbwarning}{
 breakable,
 enhanced jigsaw,
 top=0pt,
 bottom=0pt,
 titlerule=0pt,
 bottomtitle=0pt,
 rightrule=0pt,
 toprule=0pt,
 bottomrule=0pt,
 colback=white,
 arc=0pt,
 outer arc=0pt,
 title style={white},
 fonttitle=\color{black}\bfseries,
 left=8pt,
 colframe=red,
 title={Warning:},
}
\newtcolorbox{tcbnote}{
 breakable,
 enhanced jigsaw,
 top=0pt,
 bottom=0pt,
 titlerule=0pt,
 bottomtitle=0pt,
 rightrule=0pt,
 toprule=0pt,
 bottomrule=0pt,
 colback=white,
 arc=0pt,
 outer arc=0pt,
 title style={white},
 fonttitle=\color{black}\bfseries,
 left=8pt,
 colframe=yellow,
 title={Note:},
}

\begin{document}
\label{toc}\tableofcontents
\newpage
% special variable used for calculating some widths.
\newlength{\tmplength}
\chapter{Unit WeirdRecord}
\label{WeirdRecord}
\index{WeirdRecord}
\section{Overview}
\begin{description}
\item[\texttt{\begin{ttfamily}TWeirdRecord\end{ttfamily} Record}]
\end{description}
\section{Classes, Interfaces, Objects and Records}
\ifpdf
\subsection*{\large{\textbf{TWeirdRecord Record}}\normalsize\hspace{1ex}\hrulefill}
\else
\subsection*{TWeirdRecord Record}
\fi
\label{WeirdRecord.TWeirdRecord}
\index{TWeirdRecord}
%%%%Description
\subsubsection*{\large{\textbf{Fields}}\normalsize\hspace{1ex}\hfill}
\begin{list}{}{
\settowidth{\tmplength}{\textbf{pbVal}}
\setlength{\itemindent}{0cm}
\setlength{\listparindent}{0cm}
\setlength{\leftmargin}{\evensidemargin}
\addtolength{\leftmargin}{\tmplength}
\settowidth{\labelsep}{X}
\addtolength{\leftmargin}{\labelsep}
\setlength{\labelwidth}{\tmplength}
}
\label{WeirdRecord.TWeirdRecord-bVal}
\index{bVal}
\item[\textbf{bVal}\hfill]
\ifpdf
\begin{flushleft}
\fi
\begin{ttfamily}
public bVal: Byte\end{ttfamily}

\ifpdf
\end{flushleft}
\fi


\par  \label{WeirdRecord.TWeirdRecord-iVal}
\index{iVal}
\item[\textbf{iVal}\hfill]
\ifpdf
\begin{flushleft}
\fi
\begin{ttfamily}
public iVal: Smallint\end{ttfamily}

\ifpdf
\end{flushleft}
\fi


\par  \label{WeirdRecord.TWeirdRecord-lVal}
\index{lVal}
\item[\textbf{lVal}\hfill]
\ifpdf
\begin{flushleft}
\fi
\begin{ttfamily}
public lVal: Longint\end{ttfamily}

\ifpdf
\end{flushleft}
\fi


\par  \label{WeirdRecord.TWeirdRecord-pbVal}
\index{pbVal}
\item[\textbf{pbVal}\hfill]
\ifpdf
\begin{flushleft}
\fi
\begin{ttfamily}
public pbVal: {\^{}}Byte\end{ttfamily}

\ifpdf
\end{flushleft}
\fi


\par  \label{WeirdRecord.TWeirdRecord-piVal}
\index{piVal}
\item[\textbf{piVal}\hfill]
\ifpdf
\begin{flushleft}
\fi
\begin{ttfamily}
public piVal: {\^{}}Smallint\end{ttfamily}

\ifpdf
\end{flushleft}
\fi


\par  \label{WeirdRecord.TWeirdRecord-plVal}
\index{plVal}
\item[\textbf{plVal}\hfill]
\ifpdf
\begin{flushleft}
\fi
\begin{ttfamily}
public plVal: {\^{}}Longint\end{ttfamily}

\ifpdf
\end{flushleft}
\fi


\par  \end{list}
\section{Constants}
\ifpdf
\subsection*{\large{\textbf{val1}}\normalsize\hspace{1ex}\hrulefill}
\else
\subsection*{val1}
\fi
\label{WeirdRecord-val1}
\index{val1}
\begin{list}{}{
\settowidth{\tmplength}{\textbf{Description}}
\setlength{\itemindent}{0cm}
\setlength{\listparindent}{0cm}
\setlength{\leftmargin}{\evensidemargin}
\addtolength{\leftmargin}{\tmplength}
\settowidth{\labelsep}{X}
\addtolength{\leftmargin}{\labelsep}
\setlength{\labelwidth}{\tmplength}
}
\item[\textbf{Declaration}\hfill]
\ifpdf
\begin{flushleft}
\fi
\begin{ttfamily}
val1 = 1;\end{ttfamily}

\ifpdf
\end{flushleft}
\fi

\end{list}
\ifpdf
\subsection*{\large{\textbf{val2}}\normalsize\hspace{1ex}\hrulefill}
\else
\subsection*{val2}
\fi
\label{WeirdRecord-val2}
\index{val2}
\begin{list}{}{
\settowidth{\tmplength}{\textbf{Description}}
\setlength{\itemindent}{0cm}
\setlength{\listparindent}{0cm}
\setlength{\leftmargin}{\evensidemargin}
\addtolength{\leftmargin}{\tmplength}
\settowidth{\labelsep}{X}
\addtolength{\leftmargin}{\labelsep}
\setlength{\labelwidth}{\tmplength}
}
\item[\textbf{Declaration}\hfill]
\ifpdf
\begin{flushleft}
\fi
\begin{ttfamily}
val2 = 2;\end{ttfamily}

\ifpdf
\end{flushleft}
\fi

\end{list}
\ifpdf
\subsection*{\large{\textbf{val4}}\normalsize\hspace{1ex}\hrulefill}
\else
\subsection*{val4}
\fi
\label{WeirdRecord-val4}
\index{val4}
\begin{list}{}{
\settowidth{\tmplength}{\textbf{Description}}
\setlength{\itemindent}{0cm}
\setlength{\listparindent}{0cm}
\setlength{\leftmargin}{\evensidemargin}
\addtolength{\leftmargin}{\tmplength}
\settowidth{\labelsep}{X}
\addtolength{\leftmargin}{\labelsep}
\setlength{\labelwidth}{\tmplength}
}
\item[\textbf{Declaration}\hfill]
\ifpdf
\begin{flushleft}
\fi
\begin{ttfamily}
val4 = 4;\end{ttfamily}

\ifpdf
\end{flushleft}
\fi

\end{list}
\ifpdf
\subsection*{\large{\textbf{byRef}}\normalsize\hspace{1ex}\hrulefill}
\else
\subsection*{byRef}
\fi
\label{WeirdRecord-byRef}
\index{byRef}
\begin{list}{}{
\settowidth{\tmplength}{\textbf{Description}}
\setlength{\itemindent}{0cm}
\setlength{\listparindent}{0cm}
\setlength{\leftmargin}{\evensidemargin}
\addtolength{\leftmargin}{\tmplength}
\settowidth{\labelsep}{X}
\addtolength{\leftmargin}{\labelsep}
\setlength{\labelwidth}{\tmplength}
}
\item[\textbf{Declaration}\hfill]
\ifpdf
\begin{flushleft}
\fi
\begin{ttfamily}
byRef = 8;\end{ttfamily}

\ifpdf
\end{flushleft}
\fi

\end{list}
\end{document}
