Ttitlesec package and underlining subsubsections
You shouldn't use underline. This dates back to the times of typewriters, when it was the only simple way to emphasize text.
However, if you insist, here's a way to obtain what you want: use the advanced interface of titlesec
and the soulutf8
package (I suppose you use utf8
input encoding). The code differs slightly, depending on whether you want to underline only subsubsection title or title + label. For the latter uncomment the two commented lines, and comment the two previous lines. You can choose the underline depth, thickness and color. It allows hyphenation, in case of multilined titles.
Just a final comment: don't load both titlesec
and sectsty
,, they interfere.
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{soulutf8}
\usepackage[x11names]{xcolor}
\setulcolor{IndianRed3}\setul{1ex}{1.2pt}
\usepackage{titlesec}
\titleformat{\subsubsection}{\normalfont}{\color{IndianRed3}\bfseries\thesubsubsection}{0.5em}{\ul}
%\usepackage[explicit]{titlesec}
%\titleformat*{\subsubsection}{\normalfont}{}{0em}{\ul{\thesubsubsection\enspace#1}}
\begin{document}
\subsubsection{Subsubsection example}
\end{document}
Related videos on Youtube
BigFoot
Just an IT student willing to learn :) Preferred languages : C, C++
Updated on May 08, 2020Comments
-
BigFoot over 3 years
I am desperately trying to underline the headings of the
subsubsection
title.Here is my problem. If I use this piece of code:
\documentclass{article} \usepackage{sectsty} \usepackage{titlesec} \subsubsectionfont{\underline} \titleformat*{\subsubsection}{\normalfont} \begin{document} \subsubsection{subsubsection example} \end{document}
I get this result(no underline):
If I use this piece of code:
\documentclass{article} \usepackage{sectsty} %\usepackage{titlesec} \subsubsectionfont{\underline} %\titleformat*{\subsubsection}{\normalfont} \begin{document} \subsubsection{subsubsection example} \end{document}
I get this (underlined but no
titlesec
package):And if I use this piece of code:
\documentclass{article} \usepackage{sectsty} \usepackage{titlesec} %\subsubsectionfont{\underline} \titleformat*{\subsubsection}{\normalfont\underline} \begin{document} \subsubsection{subsubsection example} \end{document}
I get this error:
Package titlesec Error: Entered in horizontal mode
.So my problem is that I can't use
titlesec
and underline asubsubsection
at the same time.Is there any way that I can fix that ?
Thank you in advance for any response
-
Christian over 7 yearsWould
\titleformat{\subsubsection}{\normalfont\normalsize\bfseries}{\thesubsubsection}{1em}{\underline}
solve the problem?
-