[Tex/LaTex] use Times new roman font in TOC when using \usepackage{tocstyle} \usetocstyle{allwithdot}

formattingtable of contentstocstyle

I need my TOC all in Times New Roman but my section titles are changed when using
\usepackage{tocstyle} and \usetocstyle{allwithdot}

I had to try to use tocstyle because my section titles are long and they mess up the alignment in the TOC (they are centered causing many problems).

Any suggestions?

\documentclass[12pt,times]{article}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{multirow}
\usepackage{stdclsdv}
\usepackage{tocloft}
\usepackage{verbatim}
\usepackage{color}
\usepackage{rotating}

\usepackage{tocstyle}
\usetocstyle{allwithdot}

Below is how I add to the contents, the requirement is that the section title in the TOC be exactly the same as the title in the body. How can I make the font Times New Roman,

\begin{center}
\section*{Statistical Estimation of Pharmacokinetic Models with Non-identifiable Parameters}
\end{center}
\addcontentsline{toc}{section}{Statistical Estimation of Pharmacokinetic Models with Non-identifiable Parameters}

Best Answer

You have many paths to follow to solve your problem. Here's one with tocstyle:

\documentclass[12pt]{article}
\usepackage{mathptmx}
% \usepackage{tgtermes} %% alternative

% all section titles are centered
\usepackage{sectsty}
\allsectionsfont{\centering}

% all toc entries have leaders
\usepackage{tocstyle}
\newtocstyle[standard][leaders]{mytocstyle}{\settocfeature[1]{entryhook}{\normalfont}}
\usetocstyle{mytocstyle}

% No section is numbered
\setcounter{secnumdepth}{0}

\begin{document}
\tableofcontents

\section{Statistical Estimation of Pharmacokinetic Models with Non-identifiable Parameters}

\end{document}

Note that setting secnumdepth to 0 there's no need to repeat the section title in an \addcontentsline command.

I've left only the required packages for this solution, add others at will, but not tocloft along with tocstyle.

In order to get Times New Roman as the document font, the mathptmx package should be loaded, or tgtermes (which provides a clone of Times). The first one is however necessary if you need to set math.

Related Question