Jabref: "you must select a valid style file" problem

Created on 17 Apr 2020  路  14Comments  路  Source: JabRef/jabref

Hi! Jabref is a very promising tool. Thank you for the developing!

My environment is Windows 10 x64.

My software is JabRef-5.0-portable_windows.zip (jabref portable version for Windows ). I've also tested the JabRef-5.1-portable_windows.zip (14-04-2020) with the same result.

When i try to load any style file i always get the message "you must select a valid style file".

I have tried the _American_Mineralogist.jstyle_ and _BJAST.jstyle_ files. i have downloaded this .jstyle files from https://github.com/JabRef/jstyles.jabref.org

I have test the UTF-8 encoding with notepad++

Any idea?

Thanks in advance!!

DJuego

jabref_style

openofficlibreoffice waiting-for-customer-feedback

Most helpful comment

Hello,
I developed the "Export-Filter-Editor" some time ago. While not actively maintaining it, I could try to make some adjustments to make it work with JabRef 5.x .

I tried to understand the pattern for "valid style file" to be raised.

This is what I did find out:

The following style file (created with Export Filter Editor) works:

`NAME
Documentation of jstyle (describing additional options):
http://jabref.sourceforge.net/OOPlugin-jabref.php

PROPERTIES
Title="Literatur"
IsSortByPosition=false
IsNumberEntries=false
ReferenceParagraphFormat="bibliografie"
ReferenceHeaderParagraphFormat="Standard"

CITATION
MaxAuthors=3
MaxAuthorsFirst=3
AuthorSeparator="/"
AuthorLastSeparator="/"
EtAlString=" u.a."
CitationSeparator="; "
MultiCiteChronological=true
BracketBefore=
BracketAfter=
BracketBeforeInList="["
BracketAfterInList="]"
MinimumGroupingCount=3
CitationCharacterFormat="Standard"
FormatCitations=true
GroupedNumbersSeparator="-"
UniquefierSeparator=","
InTextYearSeparator=" "
YearSeparator=" "

LAYOUT

default=\begin{author}\format[Authors(LastFirst,Fullname,sep=/,LastSep=/,EtAl= u.a.,3,3),]{\author} \end{author}\begin{year}(\year\uniq), \end{year}\begin{title}\format[RemoveLatexCommands]{\title}, \end{title}\begin{booktitle}\format[RemoveLatexCommands]{\booktitle}, \end{booktitle}\begin{institution}\format[RemoveLatexCommands]{\institution}, \end{institution}\begin{journal}\format[RemoveLatexCommands]{\journal} \end{journal}\begin{volume}(\format[RemoveLatexCommands]{\volume}).\end{volume}\begin{address} \format[RemoveLatexCommands]{\address}.\end{address}

`
While the following style has only one difference (definition for article instead of default type) and does not work.

`NAME
Documentation of jstyle (describing additional options):
http://jabref.sourceforge.net/OOPlugin-jabref.php

PROPERTIES
Title="Literatur"
IsSortByPosition=false
IsNumberEntries=false
ReferenceParagraphFormat="bibliografie"
ReferenceHeaderParagraphFormat="Standard"

CITATION
MaxAuthors=3
MaxAuthorsFirst=3
AuthorSeparator="/"
AuthorLastSeparator="/"
EtAlString=" u.a."
CitationSeparator="; "
MultiCiteChronological=true
BracketBefore=
BracketAfter=
BracketBeforeInList="["
BracketAfterInList="]"
MinimumGroupingCount=3
CitationCharacterFormat="Standard"
FormatCitations=true
GroupedNumbersSeparator="-"
UniquefierSeparator=","
InTextYearSeparator=" "
YearSeparator=" "

LAYOUT

article=\begin{author}\format[Authors(LastFirst,Fullname,sep=/,LastSep=/,EtAl= u.a.,3,3),]{\author} \end{author}\begin{year}(\year\uniq), \end{year}\begin{title}\format[RemoveLatexCommands]{\title}, \end{title}\begin{booktitle}\format[RemoveLatexCommands]{\booktitle}, \end{booktitle}\begin{institution}\format[RemoveLatexCommands]{\institution}, \end{institution}\begin{journal}\format[RemoveLatexCommands]{\journal} \end{journal}\begin{volume}(\format[RemoveLatexCommands]{\volume}).\end{volume}\begin{address} \format[RemoveLatexCommands]{\address}.\end{address}

`
In my Test case, the same definitions can be used to setup a proper html export filter. So I suppose its not about depreceated fields that are being used.

Could there be a problem in the test routine when a style file is checked?

All 14 comments

Hi,

I think the jstyles are a bit outdated. I looked into it, and I think the problem is that they use Author formatters which are no longer existing: For example the BJAST.jstyle file ues
AuthorAndsCommaReplacer. The new one would be the AuthorsSep.
See the help for an updated list:
https://docs.jabref.org/import-export/export/customexports#built-in-export-formatters

Thank you for so quickly suggesting an explanation , @Siedlerchr I will look into it.

On the same page with the "updates list" there is a link to the style repository I mentioned , and also it is linked the "Export-Filter Editor for Jabref". Apparently the generated .jstyle files are no longer compatible. :-(

https://docs.jabref.org/import-export/export/customexports#creating-the-export-filter

IMHO it is a serious drawback for jabref the impossibility to easily edit style files.

DJuego

@DJuego These styles have all been created by external users, we do not maintain them. And the style editor plugin is also an external tool from @simonharrer I think?

@Siedlerchr . Very understandable. Hopefully the new version 5.0 will bring a cascade of collateral updates. :-)

DJuego

Hello,
I developed the "Export-Filter-Editor" some time ago. While not actively maintaining it, I could try to make some adjustments to make it work with JabRef 5.x .

I tried to understand the pattern for "valid style file" to be raised.

This is what I did find out:

The following style file (created with Export Filter Editor) works:

`NAME
Documentation of jstyle (describing additional options):
http://jabref.sourceforge.net/OOPlugin-jabref.php

PROPERTIES
Title="Literatur"
IsSortByPosition=false
IsNumberEntries=false
ReferenceParagraphFormat="bibliografie"
ReferenceHeaderParagraphFormat="Standard"

CITATION
MaxAuthors=3
MaxAuthorsFirst=3
AuthorSeparator="/"
AuthorLastSeparator="/"
EtAlString=" u.a."
CitationSeparator="; "
MultiCiteChronological=true
BracketBefore=
BracketAfter=
BracketBeforeInList="["
BracketAfterInList="]"
MinimumGroupingCount=3
CitationCharacterFormat="Standard"
FormatCitations=true
GroupedNumbersSeparator="-"
UniquefierSeparator=","
InTextYearSeparator=" "
YearSeparator=" "

LAYOUT

default=\begin{author}\format[Authors(LastFirst,Fullname,sep=/,LastSep=/,EtAl= u.a.,3,3),]{\author} \end{author}\begin{year}(\year\uniq), \end{year}\begin{title}\format[RemoveLatexCommands]{\title}, \end{title}\begin{booktitle}\format[RemoveLatexCommands]{\booktitle}, \end{booktitle}\begin{institution}\format[RemoveLatexCommands]{\institution}, \end{institution}\begin{journal}\format[RemoveLatexCommands]{\journal} \end{journal}\begin{volume}(\format[RemoveLatexCommands]{\volume}).\end{volume}\begin{address} \format[RemoveLatexCommands]{\address}.\end{address}

`
While the following style has only one difference (definition for article instead of default type) and does not work.

`NAME
Documentation of jstyle (describing additional options):
http://jabref.sourceforge.net/OOPlugin-jabref.php

PROPERTIES
Title="Literatur"
IsSortByPosition=false
IsNumberEntries=false
ReferenceParagraphFormat="bibliografie"
ReferenceHeaderParagraphFormat="Standard"

CITATION
MaxAuthors=3
MaxAuthorsFirst=3
AuthorSeparator="/"
AuthorLastSeparator="/"
EtAlString=" u.a."
CitationSeparator="; "
MultiCiteChronological=true
BracketBefore=
BracketAfter=
BracketBeforeInList="["
BracketAfterInList="]"
MinimumGroupingCount=3
CitationCharacterFormat="Standard"
FormatCitations=true
GroupedNumbersSeparator="-"
UniquefierSeparator=","
InTextYearSeparator=" "
YearSeparator=" "

LAYOUT

article=\begin{author}\format[Authors(LastFirst,Fullname,sep=/,LastSep=/,EtAl= u.a.,3,3),]{\author} \end{author}\begin{year}(\year\uniq), \end{year}\begin{title}\format[RemoveLatexCommands]{\title}, \end{title}\begin{booktitle}\format[RemoveLatexCommands]{\booktitle}, \end{booktitle}\begin{institution}\format[RemoveLatexCommands]{\institution}, \end{institution}\begin{journal}\format[RemoveLatexCommands]{\journal} \end{journal}\begin{volume}(\format[RemoveLatexCommands]{\volume}).\end{volume}\begin{address} \format[RemoveLatexCommands]{\address}.\end{address}

`
In my Test case, the same definitions can be used to setup a proper html export filter. So I suppose its not about depreceated fields that are being used.

Could there be a problem in the test routine when a style file is checked?

Thanks for the feedback, default is required since a while (since 5.0-beta)
Edit::// At least one line has to be of type default
Refs PR #5471

The dialog should ideally show the reason why the style is invalid

@Siedlerchr your comment did help to dig a bit deeper. I think, I was able to identify the problem:
"Export-Filter-Editor" does put default always at the beginning. JabRef, however, seems to assume default has to be the last type!

The following jstyle works:

`NAME
Documentation of jstyle (describing additional options):
http://jabref.sourceforge.net/OOPlugin-jabref.php

PROPERTIES
Title="Literatur"
IsSortByPosition=false
IsNumberEntries=false
ReferenceParagraphFormat="bibliografie"
ReferenceHeaderParagraphFormat="Standard"

CITATION
MaxAuthors=3
MaxAuthorsFirst=3
AuthorSeparator="/"
AuthorLastSeparator="/"
EtAlString=" u.a."
CitationSeparator="; "
MultiCiteChronological=true
BracketBefore=
BracketAfter=
BracketBeforeInList="["
BracketAfterInList="]"
MinimumGroupingCount=3
CitationCharacterFormat="Standard"
FormatCitations=true
GroupedNumbersSeparator="-"
UniquefierSeparator=","
InTextYearSeparator=" "
YearSeparator=" "

LAYOUT

article=\begin{author}\format[Authors(LastFirst,Fullname,sep=/,LastSep=/,EtAl= u.a.,3,3),]{\author} \end{author}\begin{year}(\year\uniq), \end{year}\begin{title}\format[RemoveLatexCommands]{\title}, \end{title}\begin{booktitle}\format[RemoveLatexCommands]{\booktitle}, \end{booktitle}\begin{institution}\format[RemoveLatexCommands]{\institution}, \end{institution}\begin{journal}\format[RemoveLatexCommands]{\journal} \end{journal}\begin{volume}(\format[RemoveLatexCommands]{\volume}).\end{volume}\begin{address} \format[RemoveLatexCommands]{\address}.\end{address}

default=\begin{author}\format[Authors(LastFirst,Fullname,sep=/,LastSep=/,EtAl= u.a.,3,3),]{\author} \end{author}\begin{year}(\year\uniq), \end{year}\begin{title}\format[RemoveLatexCommands]{\title}, \end{title}\begin{booktitle}\format[RemoveLatexCommands]{\booktitle}, \end{booktitle}\begin{institution}\format[RemoveLatexCommands]{\institution}, \end{institution}\begin{journal}\format[RemoveLatexCommands]{\journal} \end{journal}\begin{volume}(\format[RemoveLatexCommands]{\volume}).\end{volume}\begin{address} \format[RemoveLatexCommands]{\address}.\end{address}

`

The following jstyle file does not work. The only difference type=default & type=article are changed by order:

`NAME
Documentation of jstyle (describing additional options):
http://jabref.sourceforge.net/OOPlugin-jabref.php

PROPERTIES
Title="Literatur"
IsSortByPosition=false
IsNumberEntries=false
ReferenceParagraphFormat="bibliografie"
ReferenceHeaderParagraphFormat="Standard"

CITATION
MaxAuthors=3
MaxAuthorsFirst=3
AuthorSeparator="/"
AuthorLastSeparator="/"
EtAlString=" u.a."
CitationSeparator="; "
MultiCiteChronological=true
BracketBefore=
BracketAfter=
BracketBeforeInList="["
BracketAfterInList="]"
MinimumGroupingCount=3
CitationCharacterFormat="Standard"
FormatCitations=true
GroupedNumbersSeparator="-"
UniquefierSeparator=","
InTextYearSeparator=" "
YearSeparator=" "

LAYOUT

default=\begin{author}\format[Authors(LastFirst,Fullname,sep=/,LastSep=/,EtAl= u.a.,3,3),]{\author} \end{author}\begin{year}(\year\uniq), \end{year}\begin{title}\format[RemoveLatexCommands]{\title}, \end{title}\begin{booktitle}\format[RemoveLatexCommands]{\booktitle}, \end{booktitle}\begin{institution}\format[RemoveLatexCommands]{\institution}, \end{institution}\begin{journal}\format[RemoveLatexCommands]{\journal} \end{journal}\begin{volume}(\format[RemoveLatexCommands]{\volume}).\end{volume}\begin{address} \format[RemoveLatexCommands]{\address}.\end{address}

article=\begin{author}\format[Authors(LastFirst,Fullname,sep=/,LastSep=/,EtAl= u.a.,3,3),]{\author} \end{author}\begin{year}(\year\uniq), \end{year}\begin{title}\format[RemoveLatexCommands]{\title}, \end{title}\begin{booktitle}\format[RemoveLatexCommands]{\booktitle}, \end{booktitle}\begin{institution}\format[RemoveLatexCommands]{\institution}, \end{institution}\begin{journal}\format[RemoveLatexCommands]{\journal} \end{journal}\begin{volume}(\format[RemoveLatexCommands]{\volume}).\end{volume}\begin{address} \format[RemoveLatexCommands]{\address}.\end{address}

`

I think the best way to solve the problem is to improve the validity checker.

@DJuego: Could you open your jstyle with an text editor and put your "default" definition at the last position and try if it works (of course not with outdated files like BJAST)?

Hm, I took a quick look at the code, it should not matter where the default entry type is.
I checked using the default ones. Even at the first line it works.
The only other requirement is that stlye files must be in utf8 nowadays
https://github.com/JabRef/jabref/blob/master/src/main/resources/resource/openoffice/default_authoryear.jstyle

First; I am using the "Export-Filter_Editor_Windows_V04b.exe" in Windows 10 x64

Indeed. I can confirm that with the suggested modification of @teertinker the file seems to load correctly in Jabref. I simply opened the file with the notepad and moved the default line in the LAYOUT section.

However I am unable to apply the style over the references. But it probably has to do with my lack of knowledge about jabref, citations and styles. :-( F9 changes the style between the default jabref style and the IEEE style. It never changes to the Sensors style I have loaded. :-?

DJuego

Don麓t work
https://paste.ofcode.org/7rkvn6KmxdaFSzrmD6KhcL

Work!
https://paste.ofcode.org/35xVapJXTPmEr6btUhvDeZY

The jstyle we are talking about here, are for the usage in Open/Libre Office.

However, and that's a bit confusing, the layout part cansalso used for the Preview style in jabref (you can modify that in the preferences).
And for complete confusion the layout part can also be used to define custom export formats. It's the same functionality under the hood. Just three different functions

@DJuego:
Your second style file works on my JabRef 5.0 without any problems. A jstyle, however, does not affect your preview in JABREF as @Siedlerchr noted. But you can use the code within the LAYOUT section to modify your preview window.

@Siedlerchr:
The second layout file of @DJuego works immediatly. The first one gets refused. In both cases I saved the files with UTF-8. However, after registering the second layout file in JabRef I can modify the jstlye with an editor by pasting the code of the first layout file. The References are still parsed correctly in LibreOffice afterwards.
There must be a problem with the integrity checker - most probably it has something to do with the order of Bibtex types.

Today I did double check an example style file with a minimal setup (only title and year used). I did check for all global Properties to be included in the current documentation. The file is saved as UTF-8 on my pc. The same pattern persists:
1 If I put the \default definition at the last position the the jstyle file can be added

  1. If i put the \default position at the beginning the jstyl file gets refused.

See:

Working: https://pastebin.com/73kiGpk0
vs.
Not Working: https://pastebin.com/SA4kMSQJ

From my perspective this is a bug within JabRef, therefore it makes not much sense to update Export-Filter-Editor at the moment.

@teertinker You are right, I debugged it and the problem is a boolean variable "isDefaultLayoutPresent" which gets overwritten every time a new line is read. That explains why it only works at the end. Will create a fix

Yuppie! Great to hear.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tobiasdiez picture tobiasdiez  路  4Comments

lenhard picture lenhard  路  4Comments

thorstenwagner picture thorstenwagner  路  4Comments

Braunch picture Braunch  路  3Comments

AEgit picture AEgit  路  4Comments