需要帮助!我的代码有什么问题?

需要帮助!我的代码有什么问题?

错误信息:

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}将更加健壮和简单。

相关内容