Search code examples
fontslatextypography

Title font changes when tried to bold titlesec font in Latex


I want to bold the words 'Professional experience' in Latex. Using \textbf changes the font of the words which was previously there. I tried placing \textbf in multiple positions in the same line but didn't work. Here is the code and screenshot of the output. Please help.

\documentclass[10pt]{article}
\usepackage[a4paper,bottom = 0.6in,left = 0.6in,right = 0.6in,top = 1cm]{geometry}
% \usepackage{graphicx}
\usepackage{titlesec}

%for color
\usepackage[usenames, dvipsnames]{color}
\definecolor{myblue}{RGB}{70,70,200}

\newcommand{\xfilll}[2][1ex]{
\dimen0=#2\advance\dimen0 by #1
\leaders\hrule height \dimen0 depth -#1\hfill}
\titleformat{\section}{\large\scshape\raggedright}{}{0em}{}

\begin{document}
\section*{{\LARGE \color{myblue} {Professional Experience}}\xfilll[0pt]{0.5pt}}
\end{document}

enter image description here

After adding \textbf, I see this output with font changed.

enter image description here


Solution

  • You can use \usepackage[T1]{fontenc} to get a font which does contain bold small caps:

    \documentclass[10pt]{article}
    \usepackage[a4paper,bottom = 0.6in,left = 0.6in,right = 0.6in,top = 1cm]{geometry}
    % \usepackage{graphicx}
    \usepackage{titlesec}
    
    \usepackage[T1]{fontenc}
    
    %for color
    \usepackage[usenames, dvipsnames]{color}
    \definecolor{myblue}{RGB}{70,70,200}
    
    \newcommand{\xfilll}[2][1ex]{
    \dimen0=#2\advance\dimen0 by #1
    \leaders\hrule height \dimen0 depth -#1\hfill}
    \titleformat{\section}{\large\scshape\raggedright}{}{0em}{}
    
    \begin{document}
    \section*{{\LARGE \color{myblue} \textbf{Professional Experience}}\xfilll[0pt]{0.5pt}}
    \end{document}
    

    enter image description here