[Tex/LaTex] Undefined control sequence \uline

sublime-textxetex

I am using the codes below to set the paragraph be a subsubsubsection in LaTeX. It works before, but today suddenly Sublime Text fails to compile using XeLaTeX. And it says 'undefined control sequence'. Anyone has an idea on how to solve this problem?

Thanks in advance.

\documentclass[12pt, a4paper]{article} 

% set the margin to be 1 inch, i.e. normal margin
\usepackage[margin=1in]{geometry}


%set to all if you want both sections and subsections linked
\usepackage{hyperref}
\hypersetup{linktoc=all}

% let the \paragraph have numbered = subsubsubsection
\setcounter{secnumdepth}{4}
\setcounter{tocdepth}{4}
\usepackage{titlesec}
\titleformat{\paragraph}[hang]{\normalfont\normalsize\bfseries}{\theparagraph}{1em}{\uline}


\begin{document}
\tableofcontents
\section{level 1}
\subsection{level 2}
\subsubsection{level 3}
\paragraph{level 4}
heyheyhey

\end{document}

error

Best Answer

If you really want to underline the paragraph titles,1 you have to load

\usepackage{ulem}

in order to use \uline.

Consider also soul that provides also fancier features.


1 Underlining running text is generally not considered as good typographical practice. Underlining boldface is double heresy.