我的 includegraphics 不起作用。为什么?

我的 includegraphics 不起作用。为什么?

我不明白为什么我的 includegraphics 不适用于此文档。这是我的 MWE:

\documentclass[hidelinks,12pt,twoside,openright,a4paper]{book}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{float}
\usepackage{lipsum}
\setlength{\headheight}{14.49998pt}
\addtolength{\topmargin}{-2.49998pt}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\usepackage{setspace}
 \linespread{1.1}
%%%%%%%%%%%%%%%%pas de bold%%%%%%%%%%
\let\bfseries\mdseries
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[french]{babel}
\usepackage{fontspec}
\usepackage[left=5.5cm,right=5.5cm,top=6.5cm,bottom=6.5cm]{geometry}
\setmainfont{Arial}
\frenchspacing
%\usepackage[T1]{fontenc}
%\usepackage[utf8]{inputenc}
\usepackage{titlesec}
\usepackage{titling}
\titleformat*{\section}{\normalsize\itshape}
\titleformat*{\subsection}{\normalsize\itshape}
\titleformat*{\subsubsection}{\normalsize\itshape}
%%%%%%%points pour chapitres dans toc%%%%%%%%%%
\usepackage{tocloft}
\setlength{\cftbeforechapskip}{3pt}%espace entre chapitres
\renewcommand{\cftchapleader}{\cftdotfill{\cftdotsep}} % for chapters
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{hyperref}
%\usepackage[numberedbib,nosectionbib]{apacite}
\usepackage[makeindex]{imakeidx}
\makeindex[name=pers, title=Index des personnes]
\makeindex[name=mat, title=Index des matières]

\usepackage{fancyhdr}

\pagestyle{fancy}
% We don’t want chapter and section numbers
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\headrulewidth}{0pt}
\fancyhf{} % sets both header and footer to nothing
\fancyfoot{}
\fancyhead[LE,RO]{\thepage}
\fancyhead[CE]{\textit{Un titre}} % even pages: chapter title
\fancyhead[CO]{\textit\leftmark} % odd pages: book title


%%%%%%%%%%%%Pas de N° de chapitres%%%%%%%%%%%%%%%%%%%%
\usepackage{titlesec}
\titleformat{\chapter}[display]%
    {\centering\Large\bfseries}% format of chapter
    {\large\normalfont\MakeUppercase{\chaptertitlename}\enskip\thechapter}% format of the label
    {.5\baselineskip}{} % space between the two
\titlespacing*{\chapter}{0pt}{25pt}{35pt} % spaces around \chapter{}, {left}{before}{after}
 
%\titleformat{\chapter}[display]
  %{\normalfont\bfseries}{}{0pt}{\Huge}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%épigraphe%%%%%%%%%%%%
\makeatletter
\renewcommand{\@chapapp}{}% Not necessary...
\newenvironment{chapquote}[2][2em]
  {\setlength{\@tempdima}{#1}%
   \def\chapquote@author{#2}%
   \parshape 1 \@tempdima \dimexpr\textwidth-2\@tempdima\relax%
   \itshape}
  {\par\normalfont\hfill---\ 
 \chapquote@author\hspace{\@tempdima}\par\bigskip\par\bigskip}
\makeatother

%%%%%%%%%%%%%Numérotation en chiffres arabes%%%%%%%%%%%%%%%%%%%
\makeatletter
\renewcommand\frontmatter{%
  \cleardoublepage
  \@mainmatterfalse
  %\pagenumbering{roman}% Don’t reset
}
\renewcommand\mainmatter{%
  \cleardoublepage
  \@mainmattertrue
  %\pagenumbering{arabic}% Don’t reset
}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}

\chapter{A chapter}

\lipsum



\begin{figure}[H] 
    \centering
\includegraphics{chalet.jpg}
\caption{Un chalet à la montagne}
\label{Chalet}
\end{figure}
\end{document}

答案1

我无法重现该问题。您的示例编译成功lualatex并且\includegraphics运行良好:

在此处输入图片描述

相关内容