filecontents 无法更新我的参考书目数据库

filecontents 无法更新我的参考书目数据库

似乎当我修改 filecontents 的内容时,它不会通过编译自动更新相应的文件。这是一个简化的例子:

\documentclass{amsart}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{test,
 title={abc},
 author={def},
 year={1999},
 publisher={NW}
}
\end{filecontents}
\begin{document}
\nocite{*}
\bibliographystyle{amsplain}
\bibliography{\jobname}
\end{document} 

更新

我使用的编辑器是:WinEit 7.0,文件保存为utf8,用xelatex编译时也出现警告:

LaTeX Warning: File `filecontents_test.bib' already exists on the system.
           Not generating it from this source.

我的日志文件:

This is XeTeX, Version 3.1415926-2.5-0.9999.3 (MiKTeX 2.9) (preloaded
format=xelatex 2014.10.30)  5 DEC 2014 00:02 entering extended mode
**filecontents_test.tex (F:\SkyDrive\Doc\vimuser\tex_doc\test\filecontents_test.tex LaTeX2e
<2014/05/01> Babel <3.9k> and hyphenation patterns for 0 languages
loaded. (F:\CTEX\UserData\tex\latex\amscls\amsart.cls Document Class:
amsart 2009/07/02 v2.20.1 \linespacing=\dimen102
\normalparindent=\dimen103 \normaltopskip=\skip41
(F:\CTEX\UserData\tex\latex\amsmath\amsmath.sty Package: amsmath
2013/01/14 v2.14 AMS math features \@mathmargin=\skip42

For additional information on amsmath, use the `?' option.
(F:\CTEX\UserData\tex\latex\amsmath\amstext.sty Package: amstext
2000/06/29 v2.01

(F:\CTEX\UserData\tex\latex\amsmath\amsgen.sty File: amsgen.sty
1999/11/30 v2.0 \@emptytoks=\toks14 \ex@=\dimen104 ))
(F:\CTEX\UserData\tex\latex\amsmath\amsbsy.sty Package: amsbsy
1999/11/29 v1.2d \pmbraise@=\dimen105 )
(F:\CTEX\UserData\tex\latex\amsmath\amsopn.sty Package: amsopn
1999/12/14 v2.01 operator names ) \inf@bad=\count80 LaTeX Info:
Redefining \frac on input line 210. \uproot@=\count81
\leftroot@=\count82 LaTeX Info: Redefining \overline on input line
306. \classnum@=\count83 \DOTSCASE@=\count84 LaTeX Info: Redefining \ldots on input line 378. LaTeX Info: Redefining \dots on input line
381. LaTeX Info: Redefining \cdots on input line 466. \Mathstrutbox@=\box26 \strutbox@=\box27 \big@size=\dimen106 LaTeX Font
Info:    Redeclaring font encoding OML on input line 566. LaTeX Font
Info:    Redeclaring font encoding OMS on input line 567.
\macc@depth=\count85 \c@MaxMatrixCols=\count86 \dotsspace@=\muskip10
\c@parentequation=\count87 \dspbrk@lvl=\count88 \tag@help=\toks15
\row@=\count89 \column@=\count90 \maxfields@=\count91
\andhelp@=\toks16 \eqnshift@=\dimen107 \alignsep@=\dimen108
\tagshift@=\dimen109 \tagwidth@=\dimen110 \totwidth@=\dimen111
\lineht@=\dimen112 \@envbody=\toks17 \multlinegap=\skip43
\multlinetaggap=\skip44 \mathdisplay@stack=\toks18 LaTeX Info:
Redefining \[ on input line 2665. LaTeX Info: Redefining \] on input
line 2666. ) LaTeX Font Info:    Try loading font information for
U+msa on input line 388.

(F:\CTEX\MiKTeX\tex\latex\amsfonts\umsa.fd File: umsa.fd 2013/01/14
v3.01 AMS symbols A ) (F:\CTEX\MiKTeX\tex\latex\amsfonts\amsfonts.sty
Package: amsfonts 2013/01/14 v3.01 Basic AMSFonts support
\symAMSa=\mathgroup4 \symAMSb=\mathgroup5 LaTeX Font Info:   
Overwriting math alphabet `\mathfrak' in version `bold' (Font)        
U/euf/m/n --> U/euf/b/n on input line 106. ) \copyins=\insert233
\abstractbox=\box28 \listisep=\skip45 \c@part=\count92
\c@section=\count93 \c@subsection=\count94 \c@subsubsection=\count95
\c@paragraph=\count96 \c@subparagraph=\count97 \c@figure=\count98
\c@table=\count99 \abovecaptionskip=\skip46 \belowcaptionskip=\skip47
\captionindent=\dimen113 \thm@style=\toks19 \thm@bodyfont=\toks20
\thm@headfont=\toks21 \thm@notefont=\toks22 \thm@headpunct=\toks23
\thm@preskip=\skip48 \thm@postskip=\skip49 \thm@headsep=\skip50
\dth@everypar=\toks24 )

LaTeX Warning: File `filecontents_test.bib' already exists on the
system.
               Not generating it from this source.

(F:\SkyDrive\Doc\vimuser\tex_doc\test\filecontents_test.aux) LaTeX
Font Info:    Checking defaults for OML/cmm/m/it on input line 11.
LaTeX Font Info:    ... okay on input line 11. LaTeX Font Info:   
Checking defaults for T1/cmr/m/n on input line 11. LaTeX Font Info:   
... okay on input line 11. LaTeX Font Info:    Checking defaults for
OT1/cmr/m/n on input line 11. LaTeX Font Info:    ... okay on input
line 11. LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on
input line 11. LaTeX Font Info:    ... okay on input line 11. LaTeX
Font Info:    Checking defaults for OMX/cmex/m/n on input line 11.
LaTeX Font Info:    ... okay on input line 11. LaTeX Font Info:   
Checking defaults for U/cmr/m/n on input line 11. LaTeX Font Info:   
... okay on input line 11. Requested font "cmr8" at 8.0pt Requested
font "cmr6" at 6.0pt Requested font "cmmi8" at 8.0pt Requested font
"cmmi6" at 6.0pt Requested font "cmsy8" at 8.0pt Requested font
"cmsy6" at 6.0pt Requested font "cmex8" at 8.0pt Requested font
"cmex7" at 6.0pt Requested font "cmex7" at 5.0pt LaTeX Font Info:   
Try loading font information for U+msa on input line 11.

(F:\CTEX\MiKTeX\tex\latex\amsfonts\umsa.fd File: umsa.fd 2013/01/14
v3.01 AMS symbols A ) Requested font "msam10" at 8.0pt Requested font
"msam7" at 6.0pt Requested font "msam5" at 5.0pt LaTeX Font Info:   
Try loading font information for U+msb on input line 11.

(F:\CTEX\MiKTeX\tex\latex\amsfonts\umsb.fd File: umsb.fd 2013/01/14
v3.01 AMS symbols B ) Requested font "msbm10" at 8.0pt Requested font
"msbm7" at 6.0pt Requested font "msbm5" at 5.0pt

(F:\SkyDrive\Doc\vimuser\tex_doc\test\filecontents_test.bbl Requested
font "cmcsc10" at 10.0pt Requested font "cmti8" at 8.0pt ) [1]
(F:\SkyDrive\Doc\vimuser\tex_doc\test\filecontents_test.aux)

LaTeX Warning: Label(s) may have changed. Rerun to get
cross-references right.

 )  Here is how much of TeX's memory you used:  1370 strings out of
430415  14570 string characters out of 3190647  62745 words of memory
out of 3000000  4438 multiletter control sequences out of 15000+200000
8038 words of font info for 31 fonts, out of 3000000 for 9000  175
hyphenation exceptions out of 8191  34i,4n,32p,254b,185s stack
positions out of 5000i,500n,10000p,200000b,50000s

Output written on filecontents_test.pdf (1 page).

我的 blg 文件如下:

This is BibTeX, Version 0.99dThe top-level auxiliary file:
filecontents_test.aux The style file: amsplain.bst Database file #1:
filecontents_test.bib

答案1

您的.log文件显示,该包filecontents不是完全加载。LaTeX 的版本更具防御性,从您的.log文件来看:

LaTeX Warning: File `filecontents_test.bib' already exists on the system. Not generating it from this source.

如果filecontents之前已经加载过包,那么你会看到:

  • 正在加载包,控制台:

    (/some/where/filecontents.sty)
    

    .log文件:

    (/some/where/filecontents.sty
    Package: filecontents 2011/10/08 v1.3 Create an external file from within a LaTeX document
    )
    
  • 如果该文件先前存在,则会出现不同的警告:

    LaTeX Warning: Overwriting file `./filecontents_test.bib'.
    
  • 如果添加了,则在 LaTeX 运行结束时\listfiles在 /console 中打印版本列表:.log

     *File List*
       ...
    filecontents.sty    2011/10/08 v1.3 Create an external file from within a LaTeX document
      ...
     ***********
    

相关内容