2

When I compile/typset test.bib file, this appears:

This is pdfTeX, Version 3.1415926-2.4-1.40.13 (MiKTeX 2.9)
**entering extended mode**

Then the program hangs. What to do? Thank you in advance

edit: right now the reference does appear in main document when compiled. However, when I change bibliography style in the line\bibliographystyle{unsrtnat}, the reference still appears in the same style as before. I tried IEEEtran, plain and unsrtnat. Shouldn't they give different style in the document? Mainly, I don't want the url to appear in main doc.

Main document Latex code:

\documentclass[11pt]{article}
\begin{document}
\section{A}

Yesyesyes \cite{muiva}

\bibliographystyle{unsrtnat}

\bibliography{test}

\end{document}

test.bib code:

@article{muiva,
    title = {Effect of doping concentration on the properties of aluminium doped zinc oxide thin films prepared by spray pyrolysis for transparent electrode applications},
    volume = {37},
    issn = {0272-8842},
    url = {http://www.sciencedirect.com/science/article/pii/S0272884210003986},
    doi = {10.1016/j.ceramint.2010.09.042},
    pages = {555--560},
    number = {2},
    journaltitle = {Ceramics International},
    author = {Muiva, C. M. and Sathiaraj, T. S. and Maabong, K.},
    urldate = {2014-10-18},
    date = {2011-03},
    keywords = {A: Thin films, D: {ZnO}, Spray pyrolysis},
}
Wait
  • 21
  • 4
    You can not compile bib files. – Sigur Oct 22 '14 at 23:02
  • But you have to run it somehow right? Like click on the green button with small triangle inside – Wait Oct 22 '14 at 23:04
  • 3
    You have to run bibtex using some menu or button on your editor. After that, compile the tex file again. – Sigur Oct 22 '14 at 23:06
  • Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. – Martin Schröder Oct 22 '14 at 23:11
  • 2
    If you change the bibliography style you have to rerun bibtex. – Guido Oct 22 '14 at 23:27
  • The trouble with saying %The usual preamble is that there is no such thing. – cfr Oct 23 '14 at 00:10
  • Sorry, just edited the code to be more accurate – Wait Oct 23 '14 at 08:18
  • For a posting that discusses how to suppress the contents of the URL field, see IEEEtran BibTeX Style - how to deactivate URLs? The answer given there applies to the IEEEtran bibliography style,. However, it should be obvious how to adapt it to other bibliography styles that feature a function called format.url. – Mico Oct 23 '14 at 09:25

1 Answers1

1

Do not run BibTeX on the .bib file. Instead, assuming your main tex file is called mytexfile.tex, you should run the following sequence of commands:

pdflatex mytexfile
bibtex mytexfile
pdflatex mytexfile
pdflatex mytexfile

Observe that no file name extensions are prodived. Of course, if you use either xelatex or lualatex rather than pdflatex, you should adjust the command name given on lines 1, 3, and 4 above accordingly. Depending on the front-end editing program you may be using, there may be a button to click on that will automatically issue this sequence of commands.

With some suitable modifications (such as loading the packages natbib and url, and changing the date field type to year), your MWE produces the following output if latex, bibtex, latex, and latex are run:

enter image description here

\documentclass[11pt]{article}
\usepackage{filecontents}
\begin{filecontents*}{test.bib}
@article{muiva,
    title = {Effect of doping concentration on the properties of aluminium doped zinc oxide thin films prepared by spray pyrolysis for transparent electrode applications},
    volume = {37},
    issn = {0272-8842},
    url = {http://www.sciencedirect.com/science/article/pii/S0272884210003986},
    doi = {10.1016/j.ceramint.2010.09.042},
    pages = {555--560},
    number = {2},
    journaltitle = {Ceramics International},
    author = {Muiva, C. M. and Sathiaraj, T. S. and Maabong, K.},
    urldate = {2014-10-18},
    year = 2011,
    keywords = {A: Thin films, D: {ZnO}, Spray pyrolysis},
}
\end{filecontents*}

\usepackage[round]{natbib}
\bibliographystyle{unsrtnat}
\usepackage[obeyspaces,hyphens]{url}

\begin{document}
\section{A}
Yesyesyes \cite{muiva}

\bibliography{test}
\end{document} 
Mico
  • 506,678
  • probably a very noob question but...

    I'm using latex on windows. I always just click on the green button with triangle inside it. So where/how to type and run these commands you've mentioned above?

    pdflatex mytexfile bibtex mytexfile pdflatex mytexfile pdflatex mytexfile

    – Wait Oct 23 '14 at 20:12
  • @Wait - which front-end program do you use? There are quite a few programs that feature a "green button with triangle inside"... – Mico Oct 23 '14 at 20:21
  • oops it's Texworks. >.< – Wait Oct 23 '14 at 20:43
  • @Wait - Next to the green circular button with the triangle inside, there's a bar that (probably) says "pdfLaTeX". Click on that bar and you'll get other programs to choose from. Select "BibTeX", and then click on the green circular button to, you guessed it, run BibTeX. The select "pdfLaTeX" again and run that program twice more. Please, please, make an effort to learn the features of the front-end program. – Mico Oct 23 '14 at 20:59