# Undefined control sequence \uline

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}


• Welcome to TeX.SE! Are you sure that the errors are related to the code fragment that you've posted? If not, could you please present a complete minimal example that shows the issue? – user121799 Nov 8 '18 at 15:21
• the error you show is not the format of a tex error message and does not show which command is undefined. It is probably an unhelpful "summary" from your editor. Show the full error message from the log file, in a code section ({} button) so line ends are preserved. – David Carlisle Nov 8 '18 at 15:35
• You should look at the first error message, rather than the last. I can only guess, but you seem to be using xetex rather than xelatex. – egreg Nov 8 '18 at 16:33
• \usepackage{titlesec} \titleformat{\paragraph}[hang]{\normalfont\normalsize\bfseries}{\theparagraph}{1em}{\uline} I used this code to set the paragraph looks like a subsubsubsection as well. it looks like this piece of codes causes errors. How can I modify it? – Eugenia M Nov 9 '18 at 2:56
• The culprit is not \setcounter (as would appear to be implied by the title of your posting) but \uline. The \uline macro is defined by the ulem package. If you don't load this package, LaTeX will justifiably throw an error about an undefined control sequence. (Aside: A macro is a type of control sequence.) – Mico Nov 9 '18 at 9:29

## 2 Answers

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.

• W̲e̲ ̲n̲e̲e̲d̲ ̲m̲o̲r̲e̲ ̲u̲n̲d̲e̲r̲l̲i̲n̲i̲n̲g̲ – David Carlisle Nov 9 '18 at 12:04

I should use \underline instead of \uline. Problem solved.

In addition, is there a way to underline the 1.1.1.1 before the subsubsubsection instead of underlining the subsubsubsection heading?

• "Problem solved". -- Not quite! Just wait until there's a subsubsubsection-level header that's longer than one line... This is why @egreg recommended that you load the ulem package -- so that you can use \uline. – Mico Nov 9 '18 at 9:26