需要幫助!我的程式碼有什麼問題嗎?

需要幫助!我的程式碼有什麼問題嗎?

錯誤訊息:

LaTeX Warning: Command \markboth  has changed.
               Check if current package is valid.


LaTeX Warning: Command \markright  has changed.
               Check if current package is valid.

) (./hello.aux)
*geometry* driver: auto-detecting
*geometry* detected driver: xetex
ABD: EveryShipout initializing macros
Chapter 1.

Underfull \hbox (badness 10000) in paragraph at lines 39--47


Underfull \hbox (badness 10000) in paragraph at lines 39--47


Underfull \hbox (badness 10000) in paragraph at lines 39--47

[1]
! Missing { inserted.
<to be read again> 
                   }
l.48     \section[Section One]{Section First}

我的整個程式碼:

\documentclass[a4paper,12pt]{book}

\usepackage[a4paper, inner=1cm, outer=2cm, top=3cm, bottom=3cm, bindingoffset=2cm]{geometry}

\usepackage[english]{babel}
\usepackage{blindtext, graphicx, wrapfig, enumitem, fancyhdr, extramarks, amsmath, tikz, fontawesome, lipsum}

\usepackage{fontspec}
    \setmainfont{Ubuntu}
    \setmonofont{Ubuntu Mono}
    \newfontfamily{\FAS}{Font Awesome 5 Free Solid}
    \newfontfamily{\FAR}{Font Awesome 5 Free Regular}
    \newfontfamily{\FAB}{Font Awesome 5 Brands Regular}

\usepackage{xcolor}
    \makeatletter
        \newcommand{\globalcolor}[1]{%
            \color{#1}\global\let\default@color\current@color
        }
    \makeatother
    \AtBeginDocument{\globalcolor{white}}

\usepackage[pages=all]{background}
    \backgroundsetup{
        scale=1,color=black,opacity=0.10,angle=0,contents={
            \includegraphics[height=15cm]{logo.png}
        }
    }

\usepackage{index}
    \makeindex

\begin{document}

    \BgThispage
    \pagecolor{darkgray}

    \chapter[Chapter OnE]{Chapter FiRsT}
    This is some text in the regular font.\\\\
    {\texttt{This is Typed in Ubuntu Mono.}}\\\\
    {\FAS{\symbol{"F0E0}}}\\
    {\FAS{\symbol{"F3C5}}}\\
    {\FAS{\symbol{"F095}}}\\
    {\FAS{\symbol{"F57D}}}\\\\
    \blindmathtrue
    \Blindtext[5]

    \section[Section One]{Section First}
    \Blindtext[6]

    \section[Section TwO]{Section SeCoNd}
    \Blindtext[6]

    \chapter[Chapter TwO]{Chapter SeCoNd}
    \Blindtext[5]

\end{document}

答案1

該軟體包index與 不相容extramarks,因為後者需要的命令與前者想要執行的命令相衝突。

有更好的方法來支援多個索引,我不推薦index,它已經有十五年沒有維護了,並且仍然宣傳是4.2beta 版本,並對重要命令進行了多次重新定義,使其與其他軟體包不相容。

請注意,這\\不是結束段落的方法,而是透過留空行來完成。

\newfontface應該選擇\newfontfamily沒有變體的字體:

\newfontface{\fasfont}{Font Awesome 5 Free Solid}
\NewDocumentCommand{\FAS}{m}{{\normalfont\fasfont\symbol{#1}}}

並且\FAS{"F0E0}會更加健壯簡單。

相關內容