I am not able to find a function to write this. Please help!
Asked
Active
Viewed 106 times
2
2 Answers
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}
Enevevet
- 772
2
From my other answer here -- https://tex.stackexchange.com/a/572492/197451
\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



\renewcommand\thesection{§\arabic{section}}. – Zarko Aug 15 '21 at 08:06