自定义字体导致 LaTeX(XeLaTeX 编译器)出现异常

自定义字体导致 LaTeX(XeLaTeX 编译器)出现异常

我正在制作一个包含大量自定义格式和功能的文档。我遇到了一个问题,如果我使用 callouts 包,我的字体从那时起就会变成粗体。我设法将问题归咎于我如何格式化节/小节。如果我在声明节/小节后立即添加图像,字体类型将变为粗体。但是,如果我在添加图像之前添加文本,格式将保持正常。具体来说,如果删除命令 \bfseries,则可以解决问题。我想知道是否可以在不更改格式的情况下解决此问题。以下代码(需要在 PC 上有 Arial 字体):

% 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
\newfontfamily\FuturaBold[AutoFakeBold=5]{Arial}

% Italic Heading
\newfontfamily\FuturaItalic{Arial}

% Bold Italic Heading
\newfontfamily\FuturaItalicBold[AutoFakeBold=5]{Arial}

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

% Section Heading Format
\titleformat*{\section}{\color{myBlue}\FuturaBold\bfseries\fontsize{14}{10}\selectfont}

% Subsection Heading Format
\titleformat*{\subsection}{\color{myBlue}\FuturaBold\bfseries\fontsize{13}{10}\selectfont}

% Subsubsection Heading Format
\titleformat*{\subsubsection}{\color{myLightBlue}\FuturaBold\bfseries\fontsize{11}{10}\selectfont}

% Subsubsubsection Heading Format (Custom Section Format)
\makeatletter
\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}
    {-3.25ex \@plus-1ex \@minus-.2ex}
    {0.5ex \@plus .1ex}
    {\color{myLightBlue}\FuturaItalicBold\itshape\bfseries\fontsize{11}{10}\selectfont}
    }
\makeatother
\let\subsubsubsection\paragraph

% 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}

未添加文本时的粗体问题:

在此处输入图片描述

在小节后添加文本后,粗体问题消失:

在此处输入图片描述

相关内容