1

I am trying to get my paragraph headings to be in color, so I try:

\documentclass{article}
\usepackage{lipsum}
\usepackage{gentium,color,titlesec}
\definecolor{tuftsblue}{rgb}{0.08, 0.37, 0.61}

\titleformat{\section}{\normalfont\Large\bfseries\color{tuftsblue}} \titleformat{\subsection}{\normalfont\large\bfseries\color{tuftsblue}} \titleformat{\subsubsection}{\normalfont\normalsize\bfseries\color{tuftsblue}}{\thesubsubsection}{1em}{} \renewcommand\theparagraph{\color{{tuftsblue}{paragraph}}}

\begin{document}

\subsubsection*{Minimum Working Example} \paragraph{Lipsum 1} \lipsum[1] \paragraph{Lipsum 2} \lipsum[1] \end{document}

However, I do not get them in color? I also tried:

\titleformat{\paragraph}{\normalfont\normalsize\bfseries\color{tuftsblue}}{\theparagraph}{0em}{}

but then I get a linebreak after the paragraph title.

Many thanks for any suggestions!

frabjous
  • 41,473

1 Answers1

2

You should use the optional "shape" option to \titleformat, as explained its the titlesec documentation, page 3. You most likely want to specify the "runin" shape, which is default for \paragraph to avoid the linebreak.

\titleformat{\paragraph}[runin]{\normalfont\normalsize\bfseries\color{tuftsblue}}{}{0em}{}

colored paragraph headings

Redefining the command \theparagraph would only format paragraph numbers if you were using a counter for them, but numbers are not used by default for paragraphs.

frabjous
  • 41,473
  • Thank you for your detailed explanation! Btw, how do I underline the paragraph heading? – user3236841 Apr 16 '22 at 00:44
  • You could put \underline in the last argument to \titleformat (change {} to {\underline}, or better yet, load the soul package and use {\ul}, which would allow you more fine grained control as described here; I think the default is too low to look good. – frabjous Apr 16 '22 at 01:11
  • Thanks for this and also the link! Sorry, one more question, can I have a uniform symbol after the underline then? For instance, a colon at the end of the paragraph heading, but the underline does not include the colon. – user3236841 Apr 16 '22 at 01:25
  • You could use the final optional argument [:] at the very end of the \titleformat command (after {\ul}). You should consider reading the package documentation for yourself, so you're familiar with all the options. – frabjous Apr 16 '22 at 01:53