3

For another question here, I am trying to create a minimal BibTeX style that writes something into the output file.

I am following the instructions from the manual (page 35), where a minimal example is indicated as

ENTRY {}{}{}

FUNCTION {test}
{"de la Cierva y Codorn{\’\i}u, Juan"
#1 "{ff - }{vv - }{ll}" format.name$ top$}

READ

EXECUTE{test}

So, as a minimal setup, I created these files:

test.tex

\documentclass{article}

\begin{document}

This is a statement backed with a reference~\cite{Example}.

\bibliographystyle{test}
\bibliography{test}

\end{document}

test.bib

% This file was created with JabRef 2.6.
% Encoding: UTF8

@ARTICLE{Example,
  author = {Sally Sample and Eddie Example},
  title = {An Example Paper For Your Bibliography},
  journal = {International Journal of Exemplary Text Fragments},
  year = {2012},
  volume = {3},
  pages = {42--49},
  owner = {haagfn},
  timestamp = {2014.05.02}
}

test.bst

ENTRY {}{}{}

FUNCTION {output.something}
{
  "test" write$
}

READ

EXECUTE {output.something}

According to the manual, the write$ command

write[s] S in the output .bbl file.

(with S being the item on the stack right below write$)

For compilation, I'm using these commands:

pdflatex test.tex
bibtex test.aux
pdflatex test.tex
bibtex test.aux
pdflatex test.tex

However, my .bbl file remains empty. Oddly, when I replace write$ with top$ (as in the example from the manual), test does get output in the terminal. However, to make my example as true to the real use case as possible (and also because I want to know how it works), I would like to output my example string to the .bbl file.

Why does my .bbl file remain empty and what do I have to change so test gets output there?

  • 1
    Your demo shows test.bbl: I assume you mean the input is in test.bst – Joseph Wright May 2 '14 at 7:09
  • @JosephWright: Whoops, of course. Thanks, corrected. Got confused with the file extensions while writing the question, the actual file is indeed named test.bst. – O. R. Mapper May 2 '14 at 7:10
5

You should write in the .bst file

"test" write$ newline$

not only

"test" write$
  • 2
    Indeed! Welcome to TeX.SX! – egreg Jul 23 '17 at 21:53

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.