2

This question already has an answer here:

My problem is as follows:

% File name: Example.tex
\documentclass[journal]{IEEEtran}
\usepackage{cite}    
\begin{document}
\cite{key}
\bibliographystyle{IEEETran}
\bibliography{bibfile}
\end{document}

I want to generate the reference file in a separate PDF output. I can either run the standalone Example.bbl file as input or add the code as suggested below. I want to get the an additional PDF file for example Reference.pdf as an output each time. Example.pdf also contains the reference as a main file.

marked as duplicate by siracusa, dexteritas, Stefan Pinnow, Phelype Oleinik, TeXnician Sep 27 '18 at 16:03

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • You stand better chances of getting an answer that helps you if you can give more details about your current approach. There are many ways to create bibliographies in TeX and a solution will quite heavily depend on the one you use. A convenient way to give that information is an MWE it is a very simplified version of the code you use that others can still compile. – moewe Mar 30 '16 at 7:34
  • @moewe Added MWE with a specific doubt. – Mithun Mar 30 '16 at 12:46
2

Here's a very simplified version for bibtex that writes a file at the end and does automatically compile it at the end. The external file is called \jobnamesepbib.tex, e.g. foosepbib.tex.

It's possible to include the .bbl file in a 'standalone' document. However, special packages etc. needed must be included in the file writing too.

However, the bibtex step must be done outside. Compile as usual three times.

This does not work for biblatex, however.

    \documentclass{article}
    \newwrite\bibstuff

    \AtEndDocument{%
      \immediate\openout\bibstuff=\jobname sepbib.tex
      \immediate\write\bibstuff{%
      \string\documentclass{article}^^J
      \string\begin{document}^^J
        \string\InputIfFileExists{\jobname.bbl}{}{}^^J
        \string\end{document}^^J
      }
      \immediate\closeout\bibstuff
      \immediate\write18{pdflatex \jobname sepbib.tex} % Compilation
    }

    \begin{document}
    \section{Foo}
    \nocite{*}

    \bibliographystyle{alpha}
    \bibliography{references}




    \end{document}

Update

\documentclass{IEEEtran}
\usepackage{cite}

\newwrite\bibstuff

\AtEndDocument{%
\immediate\openout\bibstuff=\jobname sepbib.tex
\immediate\write\bibstuff{%
  \string\documentclass{IEEEtran}^^J
  \string\usepackage{cite}^^J
  \string\begin{document}^^J
    \string\InputIfFileExists{\jobname.bbl}{}{}^^J
    \string\end{document}^^J
}
\immediate\closeout\bibstuff

\immediate\write18{pdflatex \jobname sepbib.tex}
}


\begin{document}
\section{Foo}
\cite{knuth1986texbook}
\bibliographystyle{IEEEtran}

\bibliography{references}


\end{document}

Here's my standard references.bib for TeX.SX`:

@book{knuth1986texbook,
  keywords = {book},
  title={The texbook},
  author={Knuth, D.E. and Bibby, D.},
  volume={1993},
  year={1986},
  publisher={Addison-Wesley}
}
@article{knuth1977fast,
  keywords = {article},
  title={Fast pattern matching in strings},
  author={Knuth, D.E. and Morris Jr, J.H. and Pratt, V.R.},
  journal={SIAM journal on computing},
  volume={6},
  number={2},
  pages={323--350},
  year={1977},
  publisher={SIAM}
}
  • Don't know why I am getting error! I will try to solve it, otherwise I will post the results here. – Mithun Mar 30 '16 at 12:49
  • @Mithun: See the update please – user31729 Mar 30 '16 at 13:14
  • I run the code, however, can't able to find the reference PDF file. May be I did something wrong again. I am not clear \immediate\openout\bibstuff=\jobname sepbib.tex and \jobname.bbl. Do I have to change it according to my Tex file name as Example.tex and Example.bbl? And what will be the output PDF file name? – Mithun Mar 30 '16 at 14:08
  • It will be called Examplesepbib.pdf then and be placed in your working directory. – user31729 Mar 30 '16 at 14:13
  • 1
    I correct pdflatex as pdflatex.exe -synctex=1 -interaction=nonstopmode %.tex in Texstudio. Succeed. :) – Mithun Mar 30 '16 at 14:40

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