2

enter image description here

I am not able to find a function to write this. Please help!

Zarko
  • 296,517
Unknown
  • 29
  • 1
    Welcome to TeX.SE! Does section numbers had to be in red? If not, see if the following solution is what you looking for: \renewcommand\thesection{§\arabic{section}}. – Zarko Aug 15 '21 at 08:06

2 Answers2

5

I would use xcolor package to define the color you want for the red then titlesec package to adjust the section font and the spacing between the section number and the section title.

Here's my final code:

\documentclass{article}
\usepackage[T1]{fontenc}

\usepackage{xcolor} \definecolor{myred}{RGB}{191,3,66}

\usepackage{titlesec} \titleformat{\section}{\sffamily\bfseries}{\color{myred}{§\arabic{section}}}{0.15cm}{}{}

\begin{document} \section{Back To Basics!} \end{document}

And here's how it looks: LaTeX output

Enevevet
  • 772
2

From my other answer here -- https://tex.stackexchange.com/a/572492/197451

enter image description here

\documentclass{article}
\usepackage[compact]{titlesec}
\usepackage{xcolor, lipsum}

\definecolor{carmine}{rgb}{0.68, 0.0, 0.09}

\titleformat{\section} {\normalfont\Huge\bfseries}{\color{carmine}\S$,$\thesection}{1em}{}[] \titlespacing*{\section} {0em} %left {0em} %before {1em} %after/below \begin{document}

\section{Introduction}
This is some regular text.

\end{document}

js bibra
  • 21,280
  • With your setup, LaTeX inserts less whitespace above a section-level header than below. How might one fix that? – Mico Aug 16 '21 at 00:48