TransWikia.com

Custom fonts causing LaTeX (XeLaTeX compiler) to weird out

TeX - LaTeX Asked on April 15, 2021

I am making a document with a bunch of custom formatting and functions. I am having a problem where if I use the callouts package, my font will become bold from then onwards. I managed to pinpoint the issue to how I am formatting the section/subsections. If I add an image immediately after declaring a section/subsection, the font type changes to bold. If I add text however before adding my image, the formatting stays normal. Specifically the command bfseries if removed, fixes the problem. I want to know if this issue can be resolved without changing the formatting. Code below (Need to have Arial font on PC):

% Default Template and Font Size
documentclass[11pt]{extarticle}

 % Set Margins of the Document
usepackage[a4paper,bindingoffset=0in,left=2.54cm,right=2.54cm,top=3.8cm,bottom=2.5cm,footskip=.25in]{geometry}

% Color package
usepackage[table]{xcolor}
definecolor{myBlue}{HTML}{005B82}
definecolor{myLightBlue}{HTML}{4F81BD}
definecolor{myCaptionBlue}{HTML}{1F497D}

% Use Custom Fonts
usepackage{fontspec}

% Set document to have upto X.X.X.X for sections (section, subsection, subsubsection, paragraph)
usepackage{titlesec}
setcounter{secnumdepth}{4}

% Set main fonts

% Bold Heading
newfontfamilyFuturaBold[AutoFakeBold=5]{Arial}

% Italic Heading
newfontfamilyFuturaItalic{Arial}

% Bold Italic Heading
newfontfamilyFuturaItalicBold[AutoFakeBold=5]{Arial}

% Main Font Settings
setmainfont{Arial}[ItalicFont=Arial,BoldFont=Arial]

% Section Heading Format
titleformat*{section}{color{myBlue}FuturaBoldbfseriesfontsize{14}{10}selectfont}

% Subsection Heading Format
titleformat*{subsection}{color{myBlue}FuturaBoldbfseriesfontsize{13}{10}selectfont}

% Subsubsection Heading Format
titleformat*{subsubsection}{color{myLightBlue}FuturaBoldbfseriesfontsize{11}{10}selectfont}

% Subsubsubsection Heading Format (Custom Section Format)
makeatletter
renewcommandparagraph{@startsection{paragraph}{4}{z@}
    {-3.25ex @plus-1ex @minus-.2ex}
    {0.5ex @plus .1ex}
    {color{myLightBlue}FuturaItalicBolditshapebfseriesfontsize{11}{10}selectfont}
    }
makeatother
letsubsubsubsectionparagraph

% Caption Format
usepackage[font=footnotesize]{caption}
captionsetup{labelfont={color=myCaptionBlue,it},textfont={color=myCaptionBlue,it}}

% Annotations
usepackage{callouts}

usepackage{graphicx}

begin{document}

section{Test}
subsection{Test}
%Test   %If uncommented, fixes the issue. So basically if no text added before adding image after declaring a new section/subsection, everything goes bad.
begin{figure}[h]
  centering
    begin{annotate}{includegraphics[width=textwidth]{example-image}}{1}
        %helpgrid[black]
        callout{-6.5,5}{Label}{-7.6,4.35}
        callout{-3,5}{Label}{-3.4,3.75}
    end{annotate}
    caption{Test}
    label{test_page}
end{figure}

end{document}

Bold issue when text not added:

enter image description here

Bold issue gone when text added after subsection:

enter image description here

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP