解决方案一:选自:https://tex.stackexchange.com/questions/16336/add-an-asterisk-in-front-of-section-label-in-toc
\documentclass{book}
\usepackage{tocloft}
\usepackage{lipsum} % for dummy text
\newenvironment{hard}
{\renewcommand{\thesection}{*\thechapter.\arabic{section}}}
{}
% set section numbers in TOC flush right (from the tocloft documentation)
\newlength{\extralen}
\setlength{\extralen}{0.5em} % need some extra space at end of number
\renewcommand{\cftsecpresnum}{\hfill} % note the double ‘l’
\renewcommand{\cftsecaftersnum}{\hspace*{\extralen}}
\addtolength{\cftsecnumwidth}{\extralen}
\begin{document}
\tableofcontents
\chapter{A chapter}
\section{A regular section}\label{easylabel}
In Section~\ref{easylabel} we see\ldots
\lipsum
\begin{hard}
\section{A hard section}\label{hardlabel}
\lipsum
\end{hard}
In Section~\ref{hardlabel} we see\ldots
\end{document}
效果图:
解决方案二:莲枝提供:
\usepackage[titles]{tocloft}
\usepackage{etoolbox}
\section{Foo}
\addtocontents{toc}{\protecting{\renewcommand{\cftsubsecpresnum}{\makebox[0pt][r]{$\star$\space}}}}
\subsection{Something something}
\addtocontents{toc}{\protecting{\renewcommand{\cftsubsecpresnum}{}}}
效果图: