文档中未显示图像

文档中未显示图像

我正在使用在线工具 shareLatex 并尝试编译包含许多图像的文档。图像没有显示。

但是,我创建了另一个测试文件并粘贴了原始文档的相同序言和与图像相关的代码;它可以编译并且图像会出现。

我如何找到问题?编译时没有出现任何错误。感谢您的帮助。

    \documentclass[12pt]{article}

\usepackage[margin=2.6cm]{geometry}
\usepackage{graphicx}
\usepackage{float}
\usepackage{subcaption}
\usepackage{indentfirst}
\usepackage{mathtools}
\usepackage{amsmath}
\usepackage{blindtext}
\usepackage{changepage}
\usepackage[nopostdot,  style=super, nonumberlist]{glossaries}
\usepackage{leading}
\usepackage{longtable}
\usepackage{titlesec}
\usepackage[hidelinks]{hyperref}
\usepackage{pgfgantt} 
\usepackage[doublespacing]{setspace}
\usepackage{xcolor}
\usepackage{color, colortbl}
\usepackage{caption} 
\usetikzlibrary{positioning}
\usepackage{float}
\usepackage{tocstyle}
\usepackage{capt-of}
\usetocstyle{standard}
\usepackage{tocloft}%
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}


%------------------------------------------------------
%Table

    \usepackage{enumitem, etoolbox, tabularx, makecell, booktabs}
    \makeatletter
    \newcommand*{\compress}{\@minipagetrue}
    \makeatother


%------------------------------------------------------



%\newcommand{\autodot}{.}

%----------------------------------------------------
%Add some level of subclasses
\newenvironment{subs}{\adjustwidth{2em}{0pt}}{\endadjustwidth}
\titleclass{\subsubsubsection}{straight}[\subsection]
\newcounter{subsubsubsection}[subsubsection]

\renewcommand\thesubsubsubsection{\thesubsubsection.\arabic{subsubsubsection}}
\renewcommand\theparagraph{\thesubsubsubsection.\arabic{paragraph}}
\renewcommand\thesubparagraph{\theparagraph.\arabic{subparagraph}}

\titleformat{\subsubsubsection}
  {\normalfont\normalsize\bfseries}{\thesubsubsubsection}{1em}{}
\titlespacing*{\subsubsubsection}
{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}

\makeatletter
\renewcommand\paragraph{\@startsection{paragraph}{5}{\z@}%
  {3.25ex \@plus1ex \@minus.2ex}%
  {-1em}%
  {\normalfont\normalsize\bfseries}}
\renewcommand\subparagraph{\@startsection{subparagraph}{6}{\parindent}
  {3.25ex \@plus1ex \@minus .2ex}%
  {-1em}%
  {\normalfont\normalsize\bfseries}}
\def\toclevel@subsubsubsection{4}
\def\toclevel@paragraph{5}
\def\toclevel@paragraph{6}
\def\l@subsubsubsection{\@dottedtocline{4}{7em}{4em}}
\def\l@paragraph{\@dottedtocline{5}{10em}{5em}}
\def\l@subparagraph{\@dottedtocline{6}{14em}{6em}}
\makeatother

\makeatletter
\@addtoreset{subsubsubsection}{section}
\@addtoreset{subsubsubsection}{subsection}
\makeatother

\setcounter{secnumdepth}{6}
\setcounter{tocdepth}{6}



%-----------------------------------------------------
%Space Before and After Sections and Subsections Titles 
\titlespacing*{\section}{0pt}{1\baselineskip}{1\baselineskip}
\titlespacing*{\subsection}{0pt}{1\baselineskip}{1\baselineskip}
\titlespacing*{\subsubsection}{0pt}{1\baselineskip}{1\baselineskip}

%------------------------------------------------------
%Space Between Lines
\linespread{1.15}

%-------------------------------------------------------
%Bibliography
\usepackage[backend=biber ,bibstyle=ieee, citestyle=numeric, dashed=false]{biblatex}
\addbibresource{bibliography.bib}

%-------------------------------------------------------
% Rename the contents title
\renewcommand*\contentsname{Table of Content}

   %Add dot after the section number



\overfullrule=0pt
\hypersetup{final}



%--------------------------------------------------------------------
%--------------------------Begin The Document------------------------
%--------------------------------------------------------------------
\begin{document}

        \begin{figure}[ht]
        \centering
        \includegraphics[width=8cm]{Video_based}
        %\caption [An Example of Video-Based CAPTCHA]{An Example of Video-Based CAPTCHA Presented in \cite{kluever2009balancing}.}
        %\label{fig:Video_based}
    \end{figure}


\end{document}

答案1

为了重现您遇到的问题,我继续将您的代码粘贴到 Sharelatex 中。

看来 tocstyle 包处于 alpha 版本并且导致了这个问题。以下是警告:

/usr/local/texlive/2017/texmf-dist/tex/latex/koma-script/tocstyle.sty

Package tocstyle Warning: THIS IS AN ALPHA VERSION! USAGE OF THIS VERSION IS ON YOUR OWN RISK! EVERYTHING MAY HAPPEN! EVERYTHING MAY CHANGE IN FUTURE! THERE IS NO SUPPORT, IF YOU USE THIS PACKAGE! Maybe it would be better, not to load this package.

解决方案是注释第 24 行和第 26 行:

%\usepackage{tocstyle}
%\usetocstyle{standard}

有趣的是,如果我重新启用这些行,在使用注释行进行初始编译后,该图的编译没有问题。我想发现一个错误值得称赞。

这里是证明找到解决方案。

相关内容