I would like to (globally) set all section (subsection, subsubsection, and paragraph) headers to be \medbold
as defined by
\newcommand{\medbold}[1]{%
\pdfliteral direct {2 Tr 0.3 w}
\pdfliteral direct {0 Tr 0 w}%
}
(Full credit for above code goes to user Nils L with their answer to this StackExchange question.)
For example, I would like the section header to look like
\medbold{[SectionNumber]} [Default Spacing] \medbold{SectionTitle}
How do I do this? Thank you very much in advance. Minimum working example is found below
Minimum Working Example
% Made on Overleaf with the pdfLaTeX compiler
\documentclass{article}
\usepackage{lipsum} % for dummy text
\usepackage{hyperref} % to give proper credit for the \medbold code
\usepackage{mathtools} %for \mathclap
%Definition of "\medbold"
%Full credit to this code goes to StackExchange Nils L (see href below for more details)
\newcommand{\medbold}[1]{%
\pdfliteral direct {2 Tr 0.3 w} %the second factor is the boldness
#1%
\pdfliteral direct {0 Tr 0 w}%
}
\usepackage[default,
semibold]{sourceserifpro} %I like this font :)
\title{Medbold Section StackExchange MWE}
\author{cluelessmathematician}
\date{February 2023}
\begin{document}
\maketitle
\section{My Question}
I would like to (globally) set all section (subsection, subsubsection, and paragraph) headers be $\setminus$\texttt{medbold} as defined by
\begin{verbatim}
\newcommand{\medbold}[1]{%
\pdfliteral direct {2 Tr 0.3 w}
\pdfliteral direct {0 Tr 0 w}%
}
\end{verbatim}
(Full credit for above code goes to user \href{https://tex.stackexchange.com/users/7993/nils-l}{Nils L} with their \href{https://tex.stackexchange.com/a/102706/268642}{answer} to this \href{https://tex.stackexchange.com/q/102578/268642}{StackExchange question}.)\\
\noindent For example, I would like the above section header to look like
\begin{center}
\medbold{1} \ \ \medbold{My Question}
\end{center}
\noindent How do I do this? Thank you very much in advance.
\subsection{Dummy Subsection}
\lipsum[1]
\subsubsection{Dummy Subsubsection}
\lipsum[2]
\paragraph{Dummy Paragraph}
\lipsum[3]
\end{document}