2

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.

Mithun
  • 491
  • 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 07:34
  • @moewe Added MWE with a specific doubt. – Mithun Mar 30 '16 at 12:46

1 Answers1

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 –  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. –  Mar 30 '16 at 14:13
  • One step ahead. I got the Examplesepbib.tex file that contains \documentclass{IEEEtran} \usepackage{cite} \begin{document} \InputIfFileExists{Example.bbl}{}{} \end{document}. I understand that we create another file. Good. However, still I am not getting PDF file directly. I have to run Examplesepbib.tex file for PDF. Is there any problem with my pdflatex while running \immediate\write18{pdflatex \jobname sepbib.tex? Anyway, it serves my purpose. – Mithun Mar 30 '16 at 14:32
  • @Mithun: Apparently, your shell-enabled is not activated. –  Mar 30 '16 at 14:34
  • 1
    I correct pdflatex as pdflatex.exe -synctex=1 -interaction=nonstopmode %.tex in Texstudio. Succeed. :) – Mithun Mar 30 '16 at 14:40