当图像缺失或不可用时编译文件

当图像缺失或不可用时编译文件

我无法访问我的图像文件,因此我只想编译文本。我认为使用draft模式可以解决这个问题,但我仍然收到“无法找到图像文件”错误。

我怎样才能编译而不必复制一些随机图片有。

这是我的标题

\newcommand{\rootFolder}{/home/pa06r/pa06r-thesis}

\documentclass{\rootFolder/latex_templates/tex/latex/ecsdocs/ecsthesis}      

\graphicspath{{\rootFolder/images/}}  % Location of your graphics files

\usepackage[demo]{graphicx}     %Use for graphics

\usepackage{subfigure}      %Use for side-by-side figures

\usepackage{float}      % Use for floating figuress

\usepackage[round]{natbib}      % Use Natbib style for the refs.

\usepackage{multirow}       %Use for multirow tables

\usepackage{rotating}       %Use for rotating tables

\usepackage{colortbl}       %Use for coloring table backgrounds

\usepackage{algorithmic}    %Use for algorithms

\usepackage{algorithm}      %Use for algorithm labels

\usepackage{ulem}       %Use for strikethroughs

\usepackage{listings}       %Use for Pseudocode

\usepackage{color}      %package listings needs this

\usepackage{textcomp}       %Used for tilde character

\hypersetup{colorlinks=true}    %Set to false for black/white printing

\usepackage{lscape}     %For rotating pages with long images

根据 Joseph Wrights 的要求,这是最简单的示例。我创建了一个.tex文件,其中包含以下内容

\RequirePackage[demo]{graphicx}
\documentclass{article}
\begin{document}
\includegraphics{'img.jpg'}
\end{document}

这是日志文件

This is pdfeTeX, Version 3.141592-1.21a-2.2 (Web2C 7.5.4) (format=pdflatex 2010.5.13)  5 OCT 2011 22:08
entering extended mode
**test.tex
(./test.tex
LaTeX2e <2003/12/01>
Babel <v3.8d> and hyphenation patterns for american, french, german, ngerman, b
ahasa, basque, bulgarian, catalan, croatian, czech, danish, dutch, esperanto, e
stonian, finnish, greek, icelandic, irish, italian, latin, magyar, norsk, polis
h, portuges, romanian, russian, serbian, slovak, slovene, spanish, swedish, tur
kish, ukrainian, nohyphenation, loaded.
(/usr/share/texmf/tex/latex/graphics/graphicx.sty
Package: graphicx 1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)

(/usr/share/texmf/tex/latex/graphics/keyval.sty
Package: keyval 1999/03/16 v1.13 key=value parser (DPC)
\KV@toks@=\toks14
)
(/usr/share/texmf/tex/latex/graphics/graphics.sty
Package: graphics 2001/07/07 v1.0n Standard LaTeX Graphics (DPC,SPQR)

(/usr/share/texmf/tex/latex/graphics/trig.sty
Package: trig 1999/03/16 v1.09 sin cos tan (DPC)
)
(/usr/share/texmf/tex/latex/graphics/graphics.cfg
File: graphics.cfg 2005/02/03 v1.3 graphics configuration of teTeX/TeXLive
)

! LaTeX Error: Unknown option `demo' for package `graphics'.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.72 \if
        !\Gin@driver!
? 
Package graphics Info: Driver file: pdftex.def on input line 80.
(/usr/share/texmf/tex/latex/graphics/pdftex.def
File: pdftex.def 2002/06/19 v0.03k graphics/color for pdftex
\Gread@gobject=\count79
))
\Gin@req@height=\dimen102
\Gin@req@width=\dimen103
)
(/usr/share/texmf/tex/latex/base/article.cls
Document Class: article 2004/02/16 v1.4f Standard LaTeX document class
(/usr/share/texmf/tex/latex/base/size10.clo
File: size10.clo 2004/02/16 v1.4f Standard LaTeX file (size option)
)
\c@part=\count80
\c@section=\count81
\c@subsection=\count82
\c@subsubsection=\count83
\c@paragraph=\count84
\c@subparagraph=\count85
\c@figure=\count86
\c@table=\count87
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen104
)
No file test.aux.
\openout1 = `test.aux'.

LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
(/usr/share/texmf/tex/context/base/supp-pdf.tex
(/usr/share/texmf/tex/context/base/supp-mis.tex
loading : Context Support Macros / Miscellaneous (2004.10.26)
\protectiondepth=\count88
\scratchcounter=\count89
\scratchtoks=\toks15
\scratchdimen=\dimen105
\scratchskip=\skip43
\scratchmuskip=\muskip10
\scratchbox=\box26
\scratchread=\read1
\scratchwrite=\write3
\zeropoint=\dimen106
\onepoint=\dimen107
\onebasepoint=\dimen108
\minusone=\count90
\thousandpoint=\dimen109
\onerealpoint=\dimen110
\emptytoks=\toks16
\nextbox=\box27
\nextdepth=\dimen111
\everyline=\toks17
\!!counta=\count91
\!!countb=\count92
\recursecounter=\count93
)
loading : Context Support Macros / PDF (2004.03.26)
\nofMPsegments=\count94
\nofMParguments=\count95
\MPscratchCnt=\count96
\MPscratchDim=\dimen112
\MPnumerator=\count97
\everyMPtoPDFconversion=\toks18
)

LaTeX Warning: File `'img.jpg'' not found on input line 4.


! LaTeX Error: Unknown graphics extension: .jpg'.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.4 \includegraphics{'img.jpg'}

? 
(./test.aux) ) 
Here is how much of TeX's memory you used:
 868 strings out of 94500
 10335 string characters out of 1176766
 56775 words of memory out of 1000000
 4098 multiletter control sequences out of 10000+50000
 3640 words of font info for 14 fonts, out of 500000 for 2000
 580 hyphenation exceptions out of 1000
 25i,1n,19p,220b,36s stack positions out of 1500i,500n,5000p,200000b,5000s
PDF statistics:
 0 PDF objects out of 300000
 0 named destinations out of 131072
 1 words of extra memory for PDF output out of 65536

No pages of output.

答案1

demo套餐选择是graphicx你的朋友

\usepackage[demo]{graphicx}

将在真实图像的位置插入一个方形黑色“斑点”,并且不会搜索它们。(该draft选项不包括图像,但会找出它们的大小,这仍然需要文件。)

demo选项完全忽略文件。因此,所有“blob”的大小都相同,除非有明确的高度或宽度作为参数给出\includegraphics


在加载类(然后可能会加载graphic(s|x))之前如何执行此操作的简短演示:

\RequirePackage[demo]{graphicx}
\documentclass{article}
\begin{document}
\includegraphics{whatever}
\end{document}

相关内容