Bug 268047

Summary: Please add biblatex backend support
Product: [Applications] kile Reporter: kaouete <kaouete>
Component: generalAssignee: Michel Ludwig <michel.ludwig>
Status: RESOLVED FIXED    
Severity: wishlist CC: cmertes, eugene.shalygin+bugzilla.kde, thomas.braun
Priority: NOR    
Version: trunk-kde4   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Naive biblatex support for Kile
Latex can output "rerun" or "Rerun" so look for it with case insensitive search
Add possibility to define bib resource commands by user
Move bib resource commands to configuration
Create Biber tool
Create Biber tool
Select bibtex tool basing on latex output
Show problem when recompiling tex with biber

Description kaouete 2011-03-09 12:40:16 UTC
Version:           trunk-kde4 (using KDE 4.6.1) 
OS:                Linux

Hi,

It would be nice that if the biblatex package is used with a backend like biber, that biber is called as needed.
The same way that bibtex is called when needed.

Thank you

Reproducible: Always
Comment 1 cmertes 2012-08-05 16:31:30 UTC
I agree. I guess the only thing that's needed is to make the lines that look if bibtex has to be run a bit smarter. The line that appears with biblatex and biber is "Package biblatex Warning: Please (re)run Biber on the file" so as I guess that's the kind of line kile is looking for, it doesn't find anything about rerunning bibtex and does nothing. It should just run biber instead. All else is equal.

Alternatively, it should be made configurable what to look for. Currently there doesn't seem any way to configure kile to use biber, no matter what settings one uses.
Comment 2 cmertes 2012-08-05 16:32:04 UTC
*** This bug has been confirmed by popular vote. ***
Comment 3 cmertes 2012-08-05 21:59:00 UTC
I got wiser; it's "\addbibresource" that kile does not understand. So as long as you create a BibTeX profile that uses biber and use the deprecated "\bibliography", everything should be fine.
Comment 4 Eugene Shalygin 2012-08-21 20:14:51 UTC
Created attachment 73370 [details]
Naive biblatex support for Kile

Please take a look at my naive attempt to support biblatex in Kile.
Three things have to be done for that:
1. Detect biblatex backend and run appropriate tool
2. Fix LaTeX rerun 
3. Detect bibliography resources in new commands

Proposed patch solves items 2 and 3.

For item 2 one needs just to look for "rerun" instead of "Rerun" in the latex output. Solved by adding option Qt::CaseInsensitive in src/kilestdtools.cpp.

For item 3 the follwing soltion is proposed. Add a section "Bibliographies" to latex commands configuration where 4 default commands are provied: \bibliography, \addbibresource, \addglobalbib, and \addsectionbib. These commands are taken for parsing and \bibliography item is removed from static list items in  src/documentinfo.cpp. 

For item 1 I just add "Biber" configuration to the "Bibtex" tool (I hope I add all the requred .rc and .upd files correctly). Perhaps this can be done more accurate by checking biblatex output and selecting adequate tool.

P.S. I've encountered strange behaviour of Kile when it does not run Biblatex automatically when debug output is enabled via kdebugdialog application. Do not know the reason yet.
Comment 5 Eugene Shalygin 2012-08-22 14:31:32 UTC
Created attachment 73389 [details]
Latex can output "rerun" or "Rerun" so look for it with case insensitive search
Comment 6 Eugene Shalygin 2012-08-22 14:32:58 UTC
Created attachment 73390 [details]
Add possibility to define bib resource commands by user
Comment 7 Eugene Shalygin 2012-08-22 14:34:47 UTC
Created attachment 73391 [details]
Move bib resource commands to configuration
Comment 8 Eugene Shalygin 2012-08-22 14:35:26 UTC
Created attachment 73392 [details]
Create Biber tool
Comment 9 Eugene Shalygin 2012-08-22 14:36:25 UTC
Created attachment 73393 [details]
Create Biber tool
Comment 10 Eugene Shalygin 2012-08-22 14:37:18 UTC
Created attachment 73394 [details]
Select bibtex tool basing on latex output
Comment 11 Eugene Shalygin 2012-08-22 14:44:22 UTC
Updated set of patches seems to be enought for comfortable work with Biblatex in Kile. Bibtex backend selection is far from perfect. Sorry, but I do not know the policy for tool names in Kile and thus is it possible to rely on them. But with these patches Kile runs appropriate Bibtex tool, detects bibliography attachaed via \addbibresource and reruns latex and bib tool automatically.
Comment 12 Michel Ludwig 2012-08-25 13:27:10 UTC
Thanks for the patches!

Could you do me a favour and submit all of them in one big patch (against the master branch) on http://git.reviewboard.kde.org/? This should make the reviewing easier.
Comment 13 Eugene Shalygin 2012-08-26 10:14:22 UTC
Published at https://git.reviewboard.kde.org/r/106213/
Comment 14 Michel Ludwig 2012-08-28 18:53:09 UTC
Git commit f2ffa3d15d156d1a175fbd6e6469860d4bef1b5b by Michel Ludwig.
Committed on 28/08/2012 at 20:45.
Pushed by mludwig into branch 'master'.

Add support for Biblatex

Patch by Eugene Shalygin.

M  +1    -2    CMakeLists.txt
M  +10   -0    src/data/kilestdtools-win.rc
M  +10   -0    src/data/kilestdtools.rc
M  +37   -32   src/dialogs/latexcommanddialog.cpp
M  +1    -1    src/dialogs/latexcommanddialog.h
M  +6    -1    src/documentinfo.cpp
M  +44   -6    src/kilestdtools.cpp
M  +2    -0    src/kilestdtools.h
M  +61   -52   src/latexcmd.cpp
M  +18   -17   src/latexcmd.h

http://commits.kde.org/kile/f2ffa3d15d156d1a175fbd6e6469860d4bef1b5b
Comment 15 Michel Ludwig 2012-08-29 11:29:33 UTC
*** Bug 179849 has been marked as a duplicate of this bug. ***
Comment 16 kaouete 2012-09-06 14:39:26 UTC
Hi, I think the support of biblatex is still a bit buggy.

I have a document using biblatex with biber.

After a clear, if I compile the tex, the following happen:
First time I compile (pdflatex), it runs biber as needed, then rerun pdflatex
Second time I compile (after I modify it, but not the citations, for example), it runs as normal
Third time I compile, for a reason I don't get, it tries to run bibtex, which fails because there is no data for bibtex
Fourth time I compile, it has to rerun everything including biber.
Comment 17 kaouete 2012-09-06 14:40:52 UTC
Well, actually the fourth time, it doesn't run biber as it should!
Comment 18 Michel Ludwig 2012-09-06 14:43:26 UTC
(In reply to comment #17)
> Well, actually the fourth time, it doesn't run biber as it should!

Can you attach an example document which demonstrates the problem? Thanks.
Comment 19 kaouete 2012-09-06 14:56:16 UTC
Created attachment 73706 [details]
Show problem when recompiling tex with biber

I checked that it is not my kile install (I deleted configuration files in .kde4/share/{config,apps}.

The precise scenario is:
compile with pdflatex, it works
change something in the text, and compile, bibtex is run (if you don't touch the file, it works actually)
recompile, biber is not run
clean, recompile, it works
Comment 20 Eugene Shalygin 2012-09-06 16:51:09 UTC
(In reply to comment #18)
And, since furher actions after running latex are deduced from the latex output, the last one might help also
Comment 21 Eugene Shalygin 2012-09-06 17:09:51 UTC
Or, no. Output is not needed. Sorry
Comment 22 Eugene Shalygin 2012-09-06 21:02:13 UTC
I've post kind of solution at
https://git.reviewboard.kde.org/r/106363/
Comment 23 Michel Ludwig 2012-09-22 16:03:30 UTC
Git commit 96ebea364d09e0b9a7c37d2e6b7eb76b29c52bab by Michel Ludwig.
Committed on 22/09/2012 at 18:01.
Pushed by mludwig into branch 'master'.

Store results of Biblatex backend detection and use it in consequent runs

Also allow for the user to override the auto-detection. Patch by Eugene Shalygin,
slightly modified/extended.

M  +1    -0    src/CMakeLists.txt
M  +3    -3    src/data/kilestdtools-win.rc
M  +3    -3    src/data/kilestdtools.rc
M  +1    -1    src/kile.cpp
M  +14   -0    src/kiledocmanager.cpp
M  +12   -4    src/kileinfo.cpp
M  +6    -5    src/kileinfo.h
M  +4    -0    src/kileproject.cpp
M  +83   -42   src/kilestdtools.cpp
M  +22   -3    src/kilestdtools.h
M  +118  -5    src/kiletoolmanager.cpp
M  +30   -9    src/kiletoolmanager.h
M  +4    -1    src/kileui.rc
M  +2    -3    src/livepreview.cpp
M  +44   -0    src/outputinfo.cpp
M  +19   -3    src/outputinfo.h
A  +92   -0    src/tool_utils.cpp     [License: GPL (v2+)]
A  +61   -0    src/tool_utils.h     [License: GPL (v2+)]
M  +1    -1    src/widgets/toolconfigwidget.cpp

http://commits.kde.org/kile/96ebea364d09e0b9a7c37d2e6b7eb76b29c52bab