4

It seems that when I modify the content of filecontents, it will not update the corresponding files auotmatically by compiling. Here is an simplified example:

\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} 

UPDATE

I use the editor: WinEit 7.0, and the file is saved as utf8. I also get the warning when compile by xelatex:

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

MY LOG file:

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).

And my blg file:

This is BibTeX, Version 0.99dThe top-level auxiliary file:
filecontents_test.aux The style file: amsplain.bst Database file #1:
filecontents_test.bib
  • Did you try this minimal example and changed the bib-contents? – Johannes_B Dec 4 '14 at 15:25
  • 1
    Don't use filecontents for this, but rather a different file. We use filecontents here just for making the examples self contained. – egreg Dec 4 '14 at 15:26
  • does \jobname.bib already exist? Because then it will ever be overwritten – daleif Dec 4 '14 at 15:30
  • @HarishKumar, erh, that one does not overwrite either, the only difference is a missing comment – daleif Dec 4 '14 at 15:32
  • 1
    @user19832: Did you actually called bibtex after changing the bib? – Ulrike Fischer Dec 4 '14 at 15:38
6

Your .log file shows, that package filecontents is not loaded at all. LaTeX's version is more defensive, from your .log file:

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

If package filecontents is loaded before, then you would have seen:

  • Loading of the package, console:

    (/some/where/filecontents.sty)
    

    .log file:

    (/some/where/filecontents.sty
    Package: filecontents 2011/10/08 v1.3 Create an external file from within a LaTeX document
    )
    
  • And a different warning, if the file exists previously:

    LaTeX Warning: Overwriting file `./filecontents_test.bib'.
    
  • If \listfiles was added, a version list is printed in the .log/console at the end of the LaTeX run:

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.