Citation not working with RevTex (MikTex 2.9, TexStudio)

  • LaTeX
  • Thread starter Wrichik Basu
  • Start date
In summary, the conversation discusses the issue of citations not working with RevTex in MikTex 2.9 and TexStudio. The conversation includes a code written in RevTex 4.2, which includes equations, an abstract, and a bibliography with a citation. The conversation mentions attempts to solve the issue by reinstalling TexStudio and using commands such as F8 and F5, but the problem persists. The conversation ends with a request for help in solving the issue.
  • #1
Wrichik Basu
Science Advisor
Insights Author
Gold Member
2,138
2,713
TL;DR Summary
Citations not working with RevTex in MikTex 2.9 and TexStudio.
I am a beginner in LaTeX. I am working in Windows 10, 64 bit. I have MikTex 2.9 and TexStudio installed. I use JabRef for the citations.

I wrote down a code with RevTex 4.2:
main.tex:
\documentclass[aps, prl, reprint, amsfont, amssymb, amsmath]{revtex4-1}
\usepackage{hyperref}

\begin{document}
    \title{Test Test}
    \author{Wrichik Basu}
     \email[Email: ]{xyz@xyz.org}
   
    \begin{abstract}
        This is a test LaTeX document created using TexStudio and MikTex 2.9 on Win 10, 64-bit.
    \end{abstract}

    \maketitle
   
    \section{\label{eqntest}Euqation Test}
    Here we write a test equation in.
   
    \begin{equation}
        \mathfrak{L} = \frac{1}{2} \ (\partial ^\mu \phi) (\partial _\mu \phi)\\ - \ \frac{1}{2}\ m^2 \phi^2
    \end{equation}
   
    \section{\label{citation}Citation Test}

    Here is a paper on qubits \cite{qubits}.

    \bibliography{ref2.bib}
   
   
\end{document}
At first, it gave a lot of problem with the \maketitle command, but when I placed it where it is currently, the file compiled properly.

Here is my file with the bibliography:
ref2.bib:
@article{qubits,
author = {Brus,L. E. },
title = {A simple model for the ionization potential, electron affinity, and aqueous redox potentials of small semiconductor crystallites},
journal = {The Journal of Chemical Physics},
volume = {79},
number = {11},
pages = {5566-5571},
year = {1983},
doi = {10.1063/1.445676},
URL = {https://doi.org/10.1063/1.445676}
}
When I am building the pdf, the citations are not coming. Refer to the attached file. Now I cannot build the pdf. It is saying that the process exited with errors, but is giving only warnings:

Annotation 2019-06-09 001536.png


But this is getting executed properly in Overleaf. That pdf is attached.

I checked the MikTex console, and RevTex is installed properly, In addition, its not compiling at all with RevTex 4.2 as the document class.

Can anyone please help me with this? I already had a hard time installing MikTex in my PC before. Now that I have my new laptop, I still cannot use TexStudio.
 

Attachments

  • Test.pdf
    96.5 KB · Views: 292
Last edited:
Physics news on Phys.org
  • #2
I get the same pdf as yours in TeXstudio 2.12.8.
 
  • #3
same, TeXstudio 2.12.16 on my windows box

compiles fine on my debian box: texstudio 2.11.2
 
Last edited:
  • #4
fresh_42 said:
I get the same pdf as yours in TeXstudio 2.12.8.
Dr Transport said:
same, TeXstudio 2.12.16 on my windows box

compiles fine on my debian box: texstudio 2.11.2

I reinstalled TexStudio, and it could create the pdf now, but the citations are still not working. Refer to the attached file.
 

Attachments

  • main.pdf
    109 KB · Views: 295
  • #5
Here is mine:

ref2.bib created by BibTex or F8 (used both), and the coding as you did.
 

Attachments

  • test.pdf
    95.3 KB · Views: 247
  • Like
Likes Wrichik Basu
  • #6
By the way, I tested this from Command prompt as well, and am getting the same error: (I used pdflatex)

latex.png


A few days back, I sent a mail to a professor, and typed out a document in Latex in Overleaf. That document is not compiling too. It seems there is a problem with MikTex. Any ideas how this can be solved?
 
  • #7
I didn't like MikTex, that's why I use the TexStudio. Have you tried what I said: F8 on ref2.bib and then F5 on test.tex?
 
  • #8
fresh_42 said:
I didn't like MikTex, that's why I use the TexStudio. Have you tried what I said: F8 on ref2.bib and then F5 on test.tex?
Isn't MikTex the compiler?

Yes, I did what you said. No change, same problem.
 
  • #9
Wrichik Basu said:
Summary: Citations not working with RevTex in MikTex 2.9 and TexStudio.

I am a beginner in LaTeX. I am working in Windows 10, 64 bit. I have MikTex 2.9 and TexStudio installed. I use JabRef for the citations.

I wrote down a code with RevTex 4.2:
main.tex:
\documentclass[aps, prl, reprint, amsfont, amssymb, amsmath]{revtex4-1}
\usepackage{hyperref}

\begin{document}
    \title{Test Test}
    \author{Wrichik Basu}
     \email[Email: ]{xyz@xyz.org}
 
    \begin{abstract}
        This is a test LaTeX document created using TexStudio and MikTex 2.9 on Win 10, 64-bit.
    \end{abstract}

    \maketitle
 
    \section{\label{eqntest}Euqation Test}
    Here we write a test equation in.
 
    \begin{equation}
        \mathfrak{L} = \frac{1}{2} \ (\partial ^\mu \phi) (\partial _\mu \phi)\\ - \ \frac{1}{2}\ m^2 \phi^2
    \end{equation}
 
    \section{\label{citation}Citation Test}

    Here is a paper on qubits \cite{qubits}.

    \bibliography{ref2.bib}
 
 
\end{document}
At first, it gave a lot of problem with the \maketitle command, but when I placed it where it is currently, the file compiled properly.

Here is my file with the bibliography:
ref2.bib:
@article{qubits,
author = {Brus,L. E. },
title = {A simple model for the ionization potential, electron affinity, and aqueous redox potentials of small semiconductor crystallites},
journal = {The Journal of Chemical Physics},
volume = {79},
number = {11},
pages = {5566-5571},
year = {1983},
doi = {10.1063/1.445676},
URL = {https://doi.org/10.1063/1.445676}
}
When I am building the pdf, the citations are not coming. Refer to the attached file. Now I cannot build the pdf. It is saying that the process exited with errors, but is giving only warnings:

View attachment 244785

But this is getting executed properly in Overleaf. That pdf is attached.

I checked the MikTex console, and RevTex is installed properly, In addition, its not compiling at all with RevTex 4.2 as the document class.

Can anyone please help me with this? I already had a hard time installing MikTex in my PC before. Now that I have my new laptop, I still cannot use TexStudio.

In general, to get a PDF produced properly you have to do the following after making any change to the source file:

1. Run PDFLaTeX. This will produce undefined citation errors.
2. Run BibTex.
3. Run PDFLaTeX. This will produce "citations may have changed" and "page numbers may have changed" warnings.
4. Run PDFLaTeX.

(Steps 1 and 2 can be omitted if you haven't added or removed any citations from the .tex file or made any changes to your .bib files since the last time you ran it.)

Now when I tried this with your source file, BibTex raised an error at Step 2:

This is BibTeX, Version 0.99d (MiKTeX 2.9.6880 64-bit) The top-level auxiliary file: test.aux I couldn't open database file ref2.bib.bib ---line 20 of file test.aux : \bibdata{testNotes,ref2.bib : } I'm skipping whatever remains of this command

Replacing "\bibliography{ref2.bib}" with "\bibliography{ref2}" fixed this.
 
  • Love
Likes Wrichik Basu
  • #10
pasmith said:
In general, to get a PDF produced properly you have to do the following after making any change to the source file:

1. Run PDFLaTeX. This will produce undefined citation errors.
2. Run BibTex.
3. Run PDFLaTeX. This will produce "citations may have changed" and "page numbers may have changed" warnings.
4. Run PDFLaTeX.

(Steps 1 and 2 can be omitted if you haven't added or removed any citations from the .tex file or made any changes to your .bib files since the last time you ran it.)

Now when I tried this with your source file, BibTex raised an error at Step 2:

Replacing "\bibliography{ref2.bib}" with "\bibliography{ref2}" fixed this.
Thanks, that solved the problem (from TexStudio and command line).
 
  • #11
An update: I uninstalled TexStudio. It was becoming irritating. I would rather work in Notepad, and compile from Command Line.
 
  • #12
I personally use TexMaker with MikTeX 2.9 on Windows 10.
 
  • Like
Likes Wrichik Basu

FAQ: Citation not working with RevTex (MikTex 2.9, TexStudio)

1. Why is my citation not working with RevTex?

There could be several reasons why your citation is not working with RevTex. One common issue is that the citation command is not correctly formatted. Make sure you are using the correct syntax for citation commands, which is usually \cite{reference}. Another possible reason is that the reference you are trying to cite is not included in your bibliography file.

2. How do I fix the citation command in RevTex?

To fix the citation command in RevTex, you can check the syntax and make sure it follows the correct format. You can also try recompiling your document to see if that resolves the issue. If the problem persists, you may need to check your bibliography file to ensure the reference is included.

3. Why are my citations not showing up in the text?

If your citations are not appearing in the text, it is likely that the reference is not included in your bibliography file or the citation command is not correctly formatted. You can also check if you have loaded the necessary packages for citations in your document.

4. How do I add a citation in RevTex?

To add a citation in RevTex, you can use the \cite{reference} command, where "reference" is the key of the reference you want to cite. This key can usually be found in your bibliography file. Make sure to also load the necessary packages for citations in your document.

5. My citations were working before, but now they are not. What could be the problem?

If your citations were working before and suddenly stopped, it is possible that you have made changes to your document or bibliography file that affected the citation command. Make sure to check for any errors in your document and ensure that the reference you are trying to cite is still included in your bibliography file.

Similar threads

Replies
11
Views
6K
Replies
2
Views
2K
Replies
5
Views
4K
Replies
1
Views
3K
Replies
1
Views
4K
Replies
5
Views
3K
Replies
8
Views
11K
Replies
1
Views
2K
Back
Top