BibtexRef-Talk

Summary: Talk page for BibtexRef.
Maintainer:
Users: (View / Edit)

This space is for User-contributed commentary and notes. Please include your name and a date along with your comment.

Comments

(newest first)


2023-11-25 Working version of bibtexref

A few days ago I did an update on my web server and the script stop working completely. As this package is not being maintained for a long time, I went into the code and corrected a number of things until it started to work again. As soon as I have a bit more time, I plan to perform a more extensive revision of the code, but for now please feel free to use this fork of pmwiki-bibtexref. Here is my publications page, which uses this version of the script


2015-02-05

Hi,

I´ve followed the instructions for installation of bibtexref3.php but when I access my wiki PMwiki is including the source code of bibtexref3.php in the top of my Wiki. You can see this here http://wwww.acso.uneb.br/brt2/

I´ve added the following lines to config.php:

include_once("cookbook/bibtexref/bibtexref3.php"); $BibtexBibDir = 'uploads/BibFiles/';

I´ve also tried "include 'cookbook/bibtexref/bibtexref3.php';" instead of include_once but it didn´t solve the problem.

Please can anyone help me to solve this ?

Best, Marco Simões


2011-04-06 Not happy with the citation format, I propose a nice one, in order to make it integrated in a possible future release ?

#in cookbok/bibtexref/bibtexref2.php
/** this variant gives a nice (author & al., YYYY) scientific citation, instead of simple ref
*/
  function cite()
  {

	$authors = $this->get("AUTHOR"); # get authors
	$year = $this->get("YEAR"); # get year
	$tauthors = split(",",$authors); # split them in an array with "," separator
	if (count($tauthors) <= 1) $tauthors = split(" and ",$authors); # split them in an array with "and" separator if no ","
	$out = "";
	#print_r($tauthors);
	if (count($tauthors) > 2) { # if more than 2 authors
		$out = $tauthors[0]." & al.";
	}else{
		$out = $authors ;
	}	  
	$ret = "([[" . $this->getCompleteEntryUrl() . " | " . $out.", ".$year . "]])";
	return $ret;
  }

lokinou, happy to contribute


2011-04-01 here is my page code {[bib.bib,939829]}

this is the citation in the bib.bib file

 @ARTICLE{939829,
author={Pfurtscheller, G. and Neuper, C.},
journal={Proceedings of the IEEE}, title={Motor imagery and direct brain-computer communication},
year={2001},

It displays only closed empty parenthesis '()'

what did I do wrong ? (no april's fools) Lokinou

Auto solved : $ScriptUrl in config.php must be absolute url and not "." If you still want to use "." you can trick by using this format : ([[{[bib.bib,939829]}


2010-12-09

How to link to pdf file? With Attach:PDF Δ? Or do we add a field that specifies the pdf file to the bibtex entry?

Thx. Oguz.


2010-07-06

For people having problems with && for anding conditions in the select rule of bibtexquery, a fix is to add:

  $toeval = str_replace("&amp;", "&", $toeval);

at line 58 in function evalCond.

Frédéric Boulanger <frederic.boulanger@supelec.fr>


2010-1-16

For people having problems with the error messages:

Warning: reset() [function.reset]: Passed variable is not an array or object in somedir/bibtexref/bibtexref3.php on line 841
Warning: Variable passed to each() is not an array or object in somedir/bibtexref/bibtexref3.php on line 843

(or slightly different line numbers)

Make sure that the directory in your config.php has a trailing slash. IE

$BibtexBibDir = 'somepath/references/'

NOT

$BibtexBibDir = 'somepath/references'

This solved my problems (this problem around bibtexref3.php, line 987 - simple concatenation without checking for trailing slash). To make it not error so badly if the file isn't specified correctly: Around line 837, change

  if ($bibtable == false)
  {
    ParseBibFile($bib);
    $bibtable = $BibEntries[$bib];
  }

to

  if ($bibtable == false)
  {
    if(!ParseBibFile($bib))
        return false;
    $bibtable = $BibEntries[$bib];
  }

Hope this helps! ~Ben

2009-05-11

How do I make a field silent? ie I don't want to display the pdf references in the complete bibtex reference?

2008-11-27

I have the same error message as reported by the previous message (2008-05-03) with problems on lines 843 and 845. Changing $HTTP_GET_VARS to $_GET does not solve the problem. Any idea?

2008-05-03

I'm missing something here, I tried setting it up but I keep getting this error message:

Warning: reset() [function.reset]: Passed variable is not an array or object in XXX/bibtexref/bibtexref3.php on line 843
Warning: Variable passed to each() is not an array or object in XXXX/bibtexref/bibtexref3.php on line 845

and also "Invalid BibTex Entry!". First I thought there was something wrong with my references so I went to the example site and grabbed a reference there but I get the same error. I've applied the patch below. Does anyone have a suggestion of what the error could be or how I can get more info from the script about what fails?

2008-06-23

$HTTP_GET_VARS appears to be no longer supported in newer versions of PHP. Change these calls to $_GET


9 January 2008

A minor hack is needed for someone whose name includes the characters "and" (e.g., Sandeep becomes S, eep).

line 72 of bibtexref3.php:

 $aut = explode("and", $aut);
 >>>
 $aut = explode(" and ", $aut);

line 72 of bibtexref3.php:

 $edi = explode("and", $edi);
 >>>
 $edi = explode(" and ", $edi);

Also, am currently unable to do "&&" query concatenation, though "||" is possible. Anding gives the previously mentioned

 "Parse error: parse error, unexpected ';' in cookbook/bibtexref/bibtexref3.php(57) : eval()'d code on line 1"

Great otherwise, though I do wish the standard jan,feb,mar,apr... months were supported, I can change this in the (other, custom) tool I use to generate my .bib file.

Thanks, Jonathan Sprinkle, http://www.ece.arizona.edu/~sprinkjm/Publications/

(28/01/2008) I have the same Problem. The error occurs in the function evalCond (line 53). Appending a second condition directly in the evalCond function works without problems. So I think there seems to be something wrong with handing over the &-symbol. (I have not a real idea of php)
A (dirty?) workaround: adding $toeval = str_replace("A_N_D", " && ", $toeval); before the eval() function and using A_N_D instead of &&.
Matthias

(28-Oct-2007) This is a great tool. Just a question: What should I use if I want to select a specific year and author's name? If I try to mix the two commands each between bracket,

 bibtexquery:[bibfile.bib][$this->get('YEAR') == '2004'][strpos($this->get('AUTHOR'),'John Doe')!==FALSE][!$this->get('PUBDATE')][5]

I get an error message. It is probably trivial, but I am not familiar with PHP.

Thanks in advance. Normand

---

Normand, you should just concatenate the two queries within the same bracket. Basically the queries are PHP code that is executed (urk, isn't that bad - you should control who can edit your pages then) to allow any possible combination. For instance, the following query

 bibtexquery:[bibfile.bib][$this->get('YEAR') == '2004' && strpos($this->get('AUTHOR'),'John Doe')!==FALSE][!$this->get('PUBDATE')][5]

should work for you.


Thank you for your answer but this solution does not work. I get an error message about the PHP.

"Parse error: parse error, unexpected ';' in cookbook/bibtexref/bibtexref3.php(57) : eval()'d code on line 1"

If I try each condition separately, it works, but not together. I use the latest version of BibtexRef.

Normand

---

(18-Jun-2007) Thank you everyone for the beautiful work. I've had some problems making it work, but thanks to the suggestion by everyone, I've done it. I've only one question: there is a way to include at the end of a page a complete bibliography, able to collect the citations done in the text? (in complete latex style). I knew a wiki, Uniwakka, able to do that, but for work reason now I'm using PmWiki (that I consider better for a lot of reason), but having this kind of feature can be great.

Thanks

Maurizio

ps: unfortunately I don't know php very well, but if someone can give me direction, I can try to write this feature if it's absent now. Certainly a little bit more of documentation can be useful, and because I'm going to write suggestions for my colleagues, maybe I can assemble them and post them (or there is documentation I didn't find?).

(6-Jun-2007) Thank you to all the contributors who have worked on this recipe. Note to those who would like to use it with Asian language references: neither the file version nor the wiki-page version (bibtexref3.zip) are able to display Japanese titles saved as UTF-8. The titles get truncated in unpredictable places. It could be a problem with my setup (BibDesk on a Mac) but the .bib file looks fine in a UTF-8 text editor.

---

I had the problem, that when opening a bib-entry, I got a page with " Invalid BibTex Entry: [,]! ". The solution below solved that for me. Matthias

I have a problem with Pierre's version. In HandleBibEntry, but by replacing

  $bibfile = $HTTP_GET_VARS['bibfile'];
  $bibref = $HTTP_GET_VARS['bibref'];

with

 $bibfile = $_GET["bibfile"];
 $bibref = $_GET["bibref"];

it seems to work for me.

-- F.

I did a lot of changes. The most notable ones are:

  • You can now store your bib entries in a PmWiki page. Just paste your .bib file in a page and reference it instead of a file as in:
bibtexquery:[Group.PageWithBibFile][$this->get('YEAR') == '2004'][!$this->get('PUBDATE')][5]
  • Keys are no more mandatory. The script works even if some keys are missing.
  • I changed the rendering a lot.

See my example at http://www.cef-cfr.ca/index.php?n=Membres.DamaseKhasa

My version includes Rob's change below.

--Pierre Racine


I had a problem with a couple of escaped characters appearing in the eval statement, so I've added a couple of lines to replace these before they are eval'ed and removed the case sensitivity in the get() and getFormat() functions. Also, the inProceedings class had a bug (it declared getPages *inside* another function). These are all fixed here:

Also added $UploadExts['bib'] = 'text/plain'; to the end of the file to allow bibs to be uploaded without modification of config.php

One final note - on my system it seems that when i refer to the bibtex file i have to add a forward slash, so [sample.bib] becomes [/sample.bib]

--Rob

The original version uses fgets without an (now optional) second parameter. With older PHP this leads to a flood of error messages --- with a decently big BIB file a deadly flood to the browser. Rob's version fixes this too.

--Vaclav

Is there an easy way to present all bib entries in the same page?

If possible i'd like to present then divided by years and sorted by title. Unfortunately $this->get('YEAR') <= '2000' doesn't work. And Integer.parseInt($this->get('YEAR')) < 2000 doesn't seem to work either.--Bernd

You have to add $toeval = str_replace("<", "<", $toeval); to the function evalCond (line 41) to be able to use the '<' symbol. Once you do that, '< 2000' works. I've done so in my version of the script: bibtexref2c.phpΔ --Anthony.

---

Great Program, thank you. Is there a way to display german charactes as ß äöü correct?

One way is to make sure that those characters are encoded as HTML symbols in your bib file. So '&uuml;' for ü. The other way is to make sure that both the bibfile and the webpages that are generated use UTF-8 as it's character set.
You'll need to add
$HTTPHeaders[] = 'Content-type: text/html; charset=utf-8;';
include_once('scripts/xlpage-utf-8.php');
to the config.php to get complete utf-8 support. --Anthony.

---

I met a problem with bibtexref2. If i use {[bilblio.bib,ref]} i have a message that uploads/Groupbiblio.bib is not found. To solve it, i changed the source with:

 Markup("bibtexcite","inline","/\\{\\[(.*?),(.*?)\\]\\}/e","BibCite('$1', '$2')")

by

 Markup("bibtexcite","inline","/\\{\\[(.*?),(.*?)\\]\\}/e","BibCite('/$1', '$2')")

my configuration is pmwiki-2.1.5, wikipublisher-2.0.5, netstream

--François

I also encountered the same problem of François and Rob, that you need an extra '/' in front of the bibfile. That also seems to be the case when specifying the PDF file. The latter, I couldn't fix the way François did, so I did the following in stead: To solve the PDF linking, I added the "/" to line 192:

 if (!$BibtexPdfUrl) $BibtexPdfUrl = FmtPageName('$UploadUrlFmt$UploadPrefixFmt', $pagename) . "/";

Then it seemed logical to do the same for the bibfile, adding "/" to line 748:

 if (!$BibtexBibDir) $BibtexBibDir = FmtPageName('$UploadDir$UploadPrefixFmt', $pagename) . "/";

That seems to have solved it. Hope it doesn't break anything... (I've included this changes in bibtexref2c.phpΔ )

Now I just wonder how the original Authors did it? If I look at bibtex entries on the example page, then they don't seem to have a problem with the PDF's... So is this a server specific issue? And if so, is there a general solution?

BTW... Great plugin!

--Anthony

question: In the example usage some of the listed authors have a link to their pages. How do you do that?

Answer (by Michaël Hauspie): In the wiki we are using, there are several Markup() call for each author, so the replacement is done by pmwiki example:

 Markup("mickey", "inline", "/Michaël Hauspie/", Keep("<a href='http://www.lifl.fr/~hauspie'>Michaël Hauspie</a>"));

--Anthony

12.8.2006: Thanks for this module, I will need it ;) Just to add a small hint: I wanted the bibcite links in the text to have [..] brackets, but obviously this interfers with wiki markup. To get around this one can use &#x05b; and &#x05d; instead of the round brackets in cite(). ThomasP


8-Sept-2006: This module is great and continues the desirable trend to blending LaTeX and the web. However, a few small issues arose:

  • It doesn't handle predefined strings or catenated strings:
 
@string{me="John Q Public"}
@string{you="Adam Bede"}
...
@article{ourwork2006,
author = me # " and " # you, ...
}

I can make a 1-time edit of my bib file for this.

  • In LaTeX we are encouraged to write URLs in the citations as \url, but this isn't recognized.

This is trickier since two versions of the bib file would be necessary - for LaTeX and for pmwiki.

  • The usual academic citation format is author first, not title first.
    • I just changed the order in line 139, the function getPreString(), such that the authors are first (my first time editing PHP)

I looked at the source, but don't know enough php to do this, tho it sounds easier. Could you give a pointer on how to do this?

Thanks.

/WRF (http://wrfranklin.org)


Talk page for the BibtexRef recipe (users).