korv / Jabref-plugins

MIT License
18 stars 4 forks source link

names with {\v...} #5

Closed davydden closed 10 years ago

davydden commented 10 years ago

When renaming a bibtex entry with first author name like:

the resulting file has an empty [auth] field. Perhaps, the best option would be to remove {} and \v \c, etc from file names. So that the two examples result in the following [auth] field:

p.s. JabRef 2.10, renameFile 1.5.0. p.p.s. I see that in Hystory: 1.5.0 "Remove symbols \,/,<,>,?,{,},$,",:,\n from file names", but this does not seem to work for me, at least here on OS-X.

davydden commented 10 years ago

apparently, the [auth] field is empty for me irrespectively of single/multiple authors, with/without special characters... my "Use name pattern" is (without extra spaces) : [type] / [auth] [year] [title]

korv commented 10 years ago

Could you write the complete bibtex entry and the name pattern that works incorrectly?

korv commented 10 years ago

Please, write also the version of Jabref that you are using.

davydden commented 10 years ago

sure, here is a simple example which does not work for me (JabRef 2.10, renameFile 1.5.0):

% This file was created with JabRef 2.10. % Encoding: ISO8859_1

@Article{Tanaka2014, Title = {Robust numerical calculation of tangent moduli at finite strains based on complex-step derivative approximation and its application to localization analysis}, Author = {Masato Tanaka and Masaki Fujikawa and Daniel Balzani and J{\"o}rg Schr{\"o}der}, Journal = {Comput. Methods Appl. Mech. Engrg.}, Year = {2014}, Pages = {454--470}, Volume = {269},

Doi = {doi:10.1016/j.cma.2013.11.005}, File = {:test.pdf:PDF}, Keywords = {Tangent moduli,Complex-step derivative approximation,Finite deformations,Nonlinear finite element method,Localization analysis}, Publishers = {Elsevier B.V.} }

don't forget to add a .pdf "test.pdf" in the same folder. Screen shot is attached to illustrate the problem. screen shot 2014-07-01 at 16 10 29

korv commented 10 years ago

The problem with [auth] appears only in Jabref 2.10. It seems to disappear after applying the key generator one time. I have to analyze their code in order to find the problem, as my code uses the key generator functionality of Jabref. Apparently Jabref 2.10 is still somewhat raw. For example, the [auth] for Bergman returns "Bergm", as the program considers "an" to be an article. As a temporary solution you can use Jabref 2.9.2

davydden commented 10 years ago

interesting, thanks a lot for investigating what's wrong...

davydden commented 10 years ago

i tried 2.9.2., [auth] shows correct, but renaming does not work, nothing happens :( I think i did not have this problem with 1.4 version of the plugin...

korv commented 10 years ago

Strange, it works under Windows and Linux. Could you enter a non-empty main file directory (under options/preferences/external programs)?

davydden commented 10 years ago

That worked!..

I also noticed that paths which start "Users/...." can not be renamed. Although i can open the .pdf fine. Actually i do not even now how i ended up with such "un-complete" full paths...

But as soon as I do "/Users/..." or re-add them and have relative path to the .bib file (e.g. "Articles/..."), renaming works fine.

korv commented 10 years ago

Version 1.6 of the plugin is compatible with JabRef 2.10. It also fixes some small bugs.

korv commented 10 years ago

Could you please check if there is still any wrong behavior? And if yes, write a bibtex example.

davydden commented 10 years ago

Sure. Thanks for looking at it.

Below are two bibtex examples which would benefit from some extra substitution rules related to "special" characters in names:

@Article{svec:2011vs, Title = {{Model predicting the free surface flow of a suspension of rigid solid particles in a non-Newtonian fluid}}, Author = {{\v s}vec, Oldrich and Sko{\v c}ek, Jan}, }

and

@Article{Askar:1973hj, Title = {{A model for coupled rotation-displacement modes of certain molecular crystals. Illustration for KNO3}}, Author = {A{\c s}kar, A}, }

If there is no open-source code in Java which can do the job, I would propose APPROACH 1: to add another filter to names before any others (i think you already have one which removes thinks like "{","}","/"). And do the following:

APPROACH 2: one could look for accents exactly (and update the list if needed), see examples here: http://tex.stackexchange.com/questions/57743/how-to-write-ä-and-other-umlauts-and-accented-letters-in-bibliography http://tex.stackexchange.com/tags/accents/info

and have rules to substitute them in each case. Perhaps it is more robust approach than creating a general rule (approach 1). And it is easier to handle exceptions (see example below).

I would say for the two examples above, "good" names would be: {\v s}vec -> vec A{\c s}kar -> Askar

There are also cases like:

@Booklet{Csanyi:2006tw, Title = {{Multiscale modeling of defects in semiconductors: A novel molecular-dynamics scheme}}, Author = {Cs{\'a}nyi, G and Moras, G and Kermode, J R and Payne, M C and Mainwood, A and De Vita, A} }

Cs{\'a}nyi -> Csanyi (?)

@Article{Diuzewski:2000fc, Title = {{Anisotropic Hyperelasticity Based Upon General Strain Measures}}, Author = {D{\l}u{.{z}}ewski, Pawe{\l}} }

D{\l}u{.{z}}ewski, Pawe{\l} -> Dluzewski, Pawel

@InCollection{davydov2009modeling, Title = {Modeling of nanoindentation by a visco-elastic porous model with application to cement paste}, Author = {Davydov, Denis and Jir{\'a}sek, Milan} }

Jir{\'a}sek - > Jirasek

@Article{Espanol1995, Title = {{Statistical Mechanics of Dissipative Particle Dynamics}}, Author = {Espa{~n}ol, P and Warren, Patrick B} }

Espa{~n}ol -> Espanol

@Article{FernandezMendez:2004ug, Title = {{Imposing essential boundary conditions in mesh-free methods}}, Author = {Fern{\'a}ndez-M{\'e}ndez, Sonia and Huerta, Antonio} }

Fern{\'a}ndez-M{\'e}ndez -> Fernandez-Mendez

@Article{Mueller-Plathe2002, Title = {{Coarse-Graining in Polymer Simulation: From the Atomistic to the Mesoscopic Scale and Back}}, Author = {M{\"u}ller-Plathe, Florian} }

M{\"u}ller-Plathe -> Muller-Plathe

@Article{Soderhjelm:2009dn, Title = {{How Accurate Can a Force Field Become? A Polarizable Multipole Model Combined with Fragment-wise Quantum-Mechanical Calculations}}, Author = {S{\"o}derhjelm, P{\"a}r and Ryde, Ulf} }

S{\"o}derhjelm, P{\"a}r -> Soderhjelm, Par

EXCEPTIONS:

@Article{OKeeffe:2002fv, Title = {{Bandstructure modulation for carbon nanotubes in a uniform electric field}}, Author = {O{\textquoteright}Keeffe, James and Wei, Chengyu and Cho, Kyeongjae} }

O{\textquoteright}Keeffe -> OKeeffe

korv commented 10 years ago

Please test v1.6.2. It should handle all accents and latex commands.

davydden commented 10 years ago

I went through my library and everything works fine with accents.

The only problem I encountered are with:

@Article{OKeeffe:2002fv, Title = {{Bandstructure modulation for carbon nanotubes in a uniform electric field}}, Author = {O{\textquoteright}Keeffe, James and Wei, Chengyu and Cho, Kyeongjae} }

and

@Article{Sousedik2014, Title = {{Hierarchical Schur complement preconditioner for the stochastic Galerkin finite element methods}}, Author = {Soused{\'\i}k, Bed{\v{r}}ich and Ghanem, Roger G and Phipps, Eric T} }

which could also be written as

@ARTICLE{2012arXiv1205.1864S, author = {{Soused{\'{\i}}k}, B. and {Ghanem}, R.~G. and {Phipps}, E.~T. }, title = "{Hierarchical Schur complement preconditioner for the stochastic Galerkin finite element methods}" }

perhaps another substitution rules could be added for those cases.

korv commented 10 years ago

Try v1.6.3

davydden commented 10 years ago

"{\'\i}" works fine, but "{\textquoteright}" has not been fixed.

korv commented 10 years ago

This is a feature and not a bug. \textquoteright is substituted by ' I think that the file name should be O'Reilly and not OReilly. But you can anyway change this behavior by using the modifier: [author:regex:textquoteright:]

davydden commented 10 years ago

that's not what i mean, it is not substituted at all, what i see in filename is: OtextquoterightKeeffe and that's how it got renamed.

korv commented 10 years ago

Strange, I just downloaded v1.6.3 and it works fine. Could you download it once again and check that it is indeed v1.6.3?

davydden commented 10 years ago

it is 1.6.3, i am sure. JabRef 2.10. See the attached screenshot. Filename is the one after renaming.

screen shot 2014-07-06 at 08 08 04

korv commented 10 years ago

I see, I worked with JabRef 2.9.2. I tested now JabRef 2.10 and the problem is actually in their label creator. It transforms \textquoteright to extquoteright so, this is a bug on their side. As a workaround you can use the modifier :regex:extquoteright: this problem seems to be too specific to code it into the plugin.

davydden commented 10 years ago

sure, i did not notice "extquoteright", good catch!.. thank you!