How BibTeX can be compiled in PHP? I have tried some PHP libraries, but the thing is that Latex works with Bibtex better I guess.

Can I automatically use Latex to parse the Bibtex and then my app to get the results back?

Can/Shall I integrate any Latex component into my app? Is it possible? or should I try something else?

I don't know to what kind of approach I should look at. In my implementation, currently I have the following issues:

  1. Math mode characters are not transformed by the library. When Greek letters are present (eg a title in Greek) the vast majority of the letters are not compiled (they are in math mode). Some though, compile, I don't know why...

  2. Long names, which is authors that have a lot name parts, such as

Ribeiro, Antonio Augusto Coppi Maciel

(this is one author).

Any suggestion/idea???

Thank you!

  • 10
    your question is completely unclear. Do you mean that you want php to run bibtex at the server or do you mean that you want to re-implement the bibtex program natively in php, or do you mean something else? – David Carlisle Aug 26 '17 at 22:00
  • I assume that your use case is David's first scenario, that is, you want to use LaTeX and BibTex as the back end of a web server that creates documents of some sort. That should work in principle; I do that on a website of mine (though with Python rather than PHP). To debug your setup, make sure that your sample document compiles correctly when invoking LaTeX and BibTex on it manually. Next, make sure the user that your server runs as can compile the LaTeX stuff, too. After that, php's exec command or some such should succeed. – Michael Palmer Aug 27 '17 at 0:34
  • Are you really asking about PHP parsing a BibTeX database rather than BibTeX, which is a binary? – cfr Aug 27 '17 at 1:11
  • @DavidCarlisle , the first option is what I was talking about. The second one although it is an option too, I guess it is not recommended as would require a lot of developing work I guess. – user142152 Aug 27 '17 at 18:04
  • @MichaelPalmer , Yes, I want to use LateX and Bibtex as the back end , however, I would like to note that my app does not creates any documents, it is just managing citations. Your suggestions looks that it will do the job for me as well. Before I get into the php code, which command lines I shall use for testing this? I want to provide a bibtex file path to the command and get the final (as final as it can be) text for each tag (title, author etc). Thank you! – user142152 Aug 27 '17 at 18:17

I'm writing an answer because I have no rights to write a comment.

If you are using composer, I would recommend you to evaluate another library for parsing bibtex files in php: renanbr/bibtex-parser https://github.com/renanbr/bibtex-parser

  • The question does not ask for a parser of the BibTeX input, but for something that processes or potentially parses the BibTeX output. – Werner Dec 12 '17 at 1:16
  • Hello all. Yes, I'm the author of that tool.The reply I made should be a comment instead, but unfornetally I have no rigths to do that in this platform. – renanbr Dec 12 '17 at 9:45

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.