I am using a custom documentclass (based on JHEP), where there are no dots in table of contents automatically for subsections. I am adding section names manually to TOC. Is it possible to add somehow \dotfill to TOC like
\addcontentsline{toc}{subsection}{Section name\dotfill}
This does not work, dots do not reach page number. They go until the half of the line or so...
Also, tocloft package gives errors, cannot use it.
MWE:
\documentclass{JHEP}
\author{A.U. Thor}
\title{Dotty}
\abstract{Not enough dots}
\usepackage{hyperref}
\begin{document}
\tableofcontents
\addcontentsline{toc}{subsection}{Section name\dotfill}
\end{document}


titletocpackage? – Bernard Apr 30 '14 at 22:10\l@section,\l@subsection, ... macros. Without seeing those or the actual (custom) document class, it would be difficult to assess what's going on. – Werner Apr 30 '14 at 23:20\documentclass{article} \begin{document} \tableofcontents \addcontentsline{toc}{section}{Section name\dotfill} \end{document}just work – Fran May 01 '14 at 08:09\documentclass{JHEP} \author{a} \abstract{b} \title{c} \usepackage{hyperref} \begin{document} \tableofcontents \addcontentsline{toc}{section}{Section name\dotfill} \end{document}withJHEP.clsfrom http://www.ctan.org/pkg/jhep Edit: If you have some other version of the class, please add a link to it, and create a minimal (non-)working example – Torbjørn T. May 05 '14 at 19:09