3

I have created a .jstyle layout file for JabRef (I am using JabRef version 2.11.1) for formatting citations for the journal, Florida Entomologist (FL_Ent). Although the current (25 March 2015) Manuscript Formatting Guidelines for FL_Ent fail to stipulate anything about how editions of a book should be formatted in their References Cited list, an earlier version of the formatting guidelines (28 July 2013) stated that the edition should be written as an ordinal followed by "edn." Therefore, the second edition of a book should be formatted, 'book title, 2nd edn.' I would like to know how to convert numerals into their ordinal analogues in the context of JabRef .jstyle files. For example, I need to take the numeral "2" and convert it into "2nd". It seems that the Replace formatter could be useful in this, because it allows regex patterns to be searched for. However, I believe its actual replacement functionality is too restrictive to be applied in a general manner, in that it only replaces matched text with a static string, so that, 2nd, 3rd, 4th, etc. would all have to be handled individually. Is there a way to use Replace, or some other JabRef formatter, so that one command would handle all ordinal replacements?

Here is an example of the use of the Replace formatter in a .jstyle layout file: "\format[Replace(\s,_)]{\author} : will output the "author" field after replacing all whitespace by underscores."

The class description for the Replace formatter reads: "Formatter that does regexp replacement. To use this formatter, a two-part argument must be given. The parts are separated by a comma. To indicate the comma character, use an escape sequence: \, ... The first part is the regular expression to search for. ... The second part is the text to replace all matches with." (http://api123.io/api/JabRef/head/net/sf/jabref/exporter/layout/format/Replace.html)

  • 1
    I am unsure whether this is doable. If you don't get help here the next days, please file an issue at JabRef's issue tracker. – koppor Feb 18 '16 at 21:30
  • BTW: The real user's help is at help.jabref.org/en/CustomExports. – koppor Feb 18 '16 at 21:30
  • Thanks! Sorry I missed this for a couple of days. I wasn't being notified of activity via email but thought that I was. – marisano Feb 23 '16 at 23:21
2

Once merged, there will be a formatter named Ordinal in the JabRef master branch... Then it should be just to write:

\format[Ordinal]
| improve this answer | |
  • Would be better if you added more details such as what is being merged... – Andrew Feb 19 '16 at 10:26
  • OK, I made a pull request to JabRef, github.com/JabRef/jabref/pull/830 that once merged in the master branch will provide the new requested formatter. – Oscar Feb 19 '16 at 10:43
  • Has this already been merged? help.jabref.org/en/CustomExports already shows the Ordinal formatter. Will I need to upgrade to JabRef 3.x to be able to use it? – marisano Feb 23 '16 at 23:16
  • I upgraded to JabRef 3.2. Previously the connection between JabRef and LibreOffice had been broken in JabRef 3, but it's now operational again: github.com/JabRef/jabref/issues/526 (I also needed to upgrade to Java 8.). I found the new Ordinal formatter was not available, however, so I downloaded JabRef-3.3dev and enjoyed the new functionality. Thanks! – marisano Feb 24 '16 at 15:19
0

I don't know whether there is such a functionality in general, but why not just repeat a couple of replacement functions? It's just a bit more (hidden) code:

\begin{edition} 
\format[Replace(1,1st),Replace(2,2nd),Replace(3,3rd)...]
{\edition}, \end{edition} 

-> this should do it for you in almost every case.

| improve this answer | |
  • Welcome to TeX - LaTeX! The poster specifically asked for something was not case-by-case. – Andrew Swann Feb 19 '16 at 8:27
  • While that's true, the solution proposed delivers a bibliography with correct references - without any case-by-case modifications needed. – Felix Feb 19 '16 at 8:39
  • Indeed. Note however, it will fail on each addition after the tenth. You need a more specific regular expressions, cf. codegolf.stackexchange.com/q/4707 – Andrew Swann Feb 19 '16 at 12:07

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.