Before I was generating ToC, LoF, and LoT using the following:
\newpage
\tableofcontents
\newpage
\listoffigures
\phantomsection
\addcontentsline{toc}{section}{\listfigurename}
\newpage
\listoftables
\phantomsection
\addcontentsline{toc}{section}{\listtablename}
Now I am trying to writing a class file, I want to make them "automatically" begin with a new page as well as adding LoF and LoT to ToC when:
\tableofcontents
\listoffigures
\listoftables
are called.
I am trying to "redefining" above 3 commands using the original commands but without fortune it doesn't work (there's no new page, and LoF and LoT will not be added to ToC):
\let\oldtableofcontents\tableofcontents
\def\tableofcontents{
\newpage
\oldtableofcontents
}
\let\oldlistoffigures\listoffigures
\def\listoffigures{
\newpage
\oldlistoffigures
\phantomsection
\addcontentsline{toc}{section}{\listfigurename}
}
\let\oldlistoftables\listoftables
\def\listoftables{
\newpage
\oldlistoftables
\phantomsection
\addcontentsline{toc}{section}{\listtablename}
}
I will be appreciated if someone can tell me if there is anything wrong on my approach (I did some same stuff to \appendix and it works properly)
Thanks,
Golson