Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bibtex - include types defined on biblatex package #3802

Closed
andregpss opened this issue Aug 18, 2023 · 15 comments · Fixed by #3822
Closed

Bibtex - include types defined on biblatex package #3802

andregpss opened this issue Aug 18, 2023 · 15 comments · Fixed by #3822

Comments

@andregpss
Copy link

I suggest CTags starts to support popular Bibtex types defined on BibLatex package.

CTags supports only original Bibtex types, defined in 1988. Nowadays there are several types used in Latex writing that are not supported by CTags. For example, there is no type in the original Bibtex to cite online references. In this case, it is common to use online type, defined on BibLatex.

The types defined on BibLatex not included on original Bibtex are: artwork, audio, bibnote, bookinbook, Booklet, collection, commentary, dataset, image, interference, jurisdiction, legislation, legal, letter, movie, music, mvbook, mvcollection, mvproceedings, mvreference, online, patent, performance, periodical, reference, report, review, set, software, standard, suppbook, suppcollection, suppperiodical, thesis, video, and xdata.

@masatake
Copy link
Member

Thank you for the input.
The available unused yet kind letters of Bibtex can be exhausted.
It may be better to add a BibLatex as a new parser stacked on the Bibtex parser.

@andregpss
Copy link
Author

Thanks for considering my suggestion.
I do not know how to implement a parser for ´CTags´, but I can give some tips about Biblatex.

masatake added a commit to masatake/ctags that referenced this issue Sep 17, 2023
Close universal-ctags#3802.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
masatake added a commit to masatake/ctags that referenced this issue Sep 17, 2023
Close universal-ctags#3802.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
@masatake
Copy link
Member

I introduced BibLaTeX subparesr in #3822.
Could you try the latest code?

@andregpss
Copy link
Author

I introduced BibLaTeX subparesr in #3822.

Thanks!

Could you try the latest code?

Waiting for the pre-release on ctags-win32 that contains merge #3822

I have found another issue. I do not know if you want to comment on it in this thread or open a new one. It is about the label that ctags shows of a reference that contains a . on its key. Ctags only show characters before the first .. For example, on the reference below, ctags show only 10 on ctags view.

@Article{10.1145/605432.605407,
author = {Levis, Philip and Culler, David},
title = {Mat'{e}: A Tiny Virtual Machine for Sensor Networks},
year = {2002} }

@andregpss
Copy link
Author

andregpss commented Sep 20, 2023

CTags continues not showing Biblatex extra references. For example, the online reference below is not shown.
I have updated CTags executable to pre-release 2023-09-20/p6.0.20230917.0-9-gdedfed1
By the way, issue #3823 was solved. Thanks.

@online{WinNT,
author = {MultiMedia LLC},
title = {{MS Windows NT} Kernel Description},
year = 1999,
url = {http://web.archive.org/web/20080207010024/http://www.808multimedia.com/winnt/kernel.htm},
urldate = {2010-09-30}
}

@masatake
Copy link
Member

I wonder why.

I cannot reproduce what you wrote. I'm using ctags for the latest source tree on my Fedora.

[yamato@dev64]~/var/ctags-github% cat /tmp/input.bib         


    @online{WinNT,
    author = {MultiMedia LLC},
    title = {{MS Windows NT} Kernel Description},
    year = 1999,
    url = {http://web.archive.org/web/20080207010024/http://www.808multimedia.com/winnt/kernel.htm},
    urldate = {2010-09-30}
    }


    @online{WinNT2,
    author = {MultiMedia LLC},
    title = {{MS Windows NT} Kernel Description},
    year = 1999,
    url = {http://web.archive.org/web/20080207010024/http://www.808multimedia.com/winnt/kernel.htm},
    urldate = {2010-09-30}
    }

[yamato@dev64]~/var/ctags-github% ./ctags --version          
Universal Ctags 6.0.0(dedfed1a2), Copyright (C) 2015-2022 Universal Ctags Team
Universal Ctags is derived from Exuberant Ctags.
Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
  Compiled: Sep 20 2023, 11:45:59
  URL: https://ctags.io/
  Output version: 0.0
  Optional compiled features: +wildcards, +regex, +iconv, +option-directory, +xpath, +json, +interactive, +sandbox, +yaml, +packcc, +optscript, +pcre2
[yamato@dev64]~/var/ctags-github% ./ctags --options=NONE -o - /tmp/input.bib
ctags: Notice: No options will be read from files or environment
WinNT   /tmp/input.bib  /^    @online{WinNT,$/;"        V
WinNT2  /tmp/input.bib  /^    @online{WinNT2,$/;"       V

@andregpss
Copy link
Author

I have executed the same commands as you on Windows 11.
Ctags recognize @online references but are not shown by Tagbar vim plugin. So, I think the problem is the plugin.
On the other side, the Telescope Ctags_outline plugin shows @online references (see attached pics).
Thanks a lot.

❯ cat .\references.bib
@online{WinNT,
author = {MultiMedia LLC},
title = {{MS Windows NT} Kernel Description},
year = 1999,
url = {http://web.archive.org/web/20080207010024/http://www.808multimedia.com/winnt/kernel.htm},
urldate = {2010-09-30}
}

@Article{autili2012developing,
title={Developing highly complex distributed systems: a software engineering perspective},
author={Autili, Marco and Inverardi, Paola and Pelliccione, Patrizio and Tivoli, Massimo},
journal={Journal of Internet Services and Applications},
volume={3},
number={1},
pages={15--22},
year={2012},
publisher={Springer}
}

@online{Network.Remote.RPC,
author = {Matthew Mirman},
title = {rpc-framework: a remote procedure call framework},
year = {2012},
url = {https://hackage.haskell.org/package/rpc-framework-2.0.0.2},
urldate = {2016-02-29},
note = {Disponível em \url{https://hackage.haskell.org/package/rpc-framework-2.0.0.2}. },
howpublished = {Acesso em 2016-02-29.}
}

❯ ctags --version
Universal Ctags 6.0.0(dedfed1), Copyright (C) 2015-2022 Universal Ctags Team
Universal Ctags is derived from Exuberant Ctags.
Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
Compiled: Sep 20 2023, 01:55:08
URL: https://ctags.io/
Output version: 0.0
Optional compiled features: +win32, +wildcards, +regex, +

❯ ctags --options=NONE -o - .\references.bib
ctags.exe: Notice: No options will be read from files or environment
Network.Remote.RPC ./references.bib /^@online{Network.Remote.RPC,$/;" V
WinNT ./references.bib /^@online{WinNT,$/;" V
autili2012developing ./references.bib /^@Article{autili2012developing,$/;" a

Telescope Ctags
Captura de tela 2023-09-20 105228

Tagbar
Captura de tela 2023-09-20 104817

@masatake
Copy link
Member

I guess many client tools assume ctags uses only one parser for an input file. This assumption was correct for a tags file generated by Exuberant Ctags. However, it is not applicable for tags files generated by Universal Ctags.

Ctags uses multiple parsers for an input file.
--fields=+l (or --fields=+{language}) option adds the name of the parser generating a tag entry to the tags file.

$ cat /tmp/input.bib                     
@INPROCEEDINGS{1959-rocket_exploration,
 author    = "Rocket Scientist",
 title     = "Exploration of the 
              Location-Singleton Split",
 booktitle = "33th international conference of important stuff (ICIS)",
 year      =  1959
}

@online{WinNT,
author = {MultiMedia LLC},
title = {{MS Windows NT} Kernel Description},
year = 1999,
url = {http://web.archive.org/web/20080207010024/http://www.808multimedia.com/winnt/kernel.htm},
urldate = {2010-09-30}
}

$ ./ctags --fields=+l -o - /tmp/input.bib
1959-rocket_exploration /tmp/input.bib  /^@INPROCEEDINGS{1959-rocket_exploration,$/;"   j       language:BibTeX
WinNT   /tmp/input.bib  /^@online{WinNT,$/;"    V       language:BibLaTeX

Please take a look at the language fields of the two tag entries.
The kind letter like j and V is parts of the parsers.
So j of BibTeX and j of BibLaTeX represent different things.

--fields=+K helps a client tool distinguish the kinds:

$ ./ctags --fields=+lK -o - /tmp/input.bib
1959-rocket_exploration /tmp/input.bib  /^@INPROCEEDINGS{1959-rocket_exploration,$/;"   inproceedings   language:BibTeX
WinNT   /tmp/input.bib  /^@online{WinNT,$/;"    online  language:BibLaTeX

@andregpss
Copy link
Author

$ ./ctags --fields=+lK -o - /tmp/input.bib

I have tried the command above, but it did not work. I passed the options to Tagbar, but nothing happened.
I will open an issue on Tagbar page, because they describe on its wiki page:

Native BibTeX support has been added, so no need for a custom configuration anymore. The below is kept as an example or for older setups. This only includes the kinds supported by universal-ctags 6.0.2.

let g:tagbar_type_bib = {
\ 'ctagstype' : 'bib',
\ 'kinds' : [
\ 'a:Articles',
\ 'b:Books',
\ 'L:Booklets',
\ 'c:Conferences',
\ 'B:Inbook',
\ 'C:Incollection',
\ 'P:Inproceedings',
\ 'm:Manuals',
\ 'T:Masterstheses',
\ 'M:Misc',
\ 't:Phdtheses',
\ 'p:Proceedings',
\ 'r:Techreports',
\ 'u:Unpublished',
\ ]
\ }

Thanks a lot.

@masatake
Copy link
Member



    let g:tagbar_type_bib = {
    \ 'ctagstype' : 'bib',
    \ 'kinds' : [
    \ 'a:Articles',
    \ 'b:Books',
    \ 'L:Booklets',
    \ 'c:Conferences',
    \ 'B:Inbook',
    \ 'C:Incollection',
    \ 'P:Inproceedings',
    \ 'm:Manuals',
    \ 'T:Masterstheses',
    \ 'M:Misc',
    \ 't:Phdtheses',
    \ 'p:Proceedings',
    \ 'r:Techreports',
    \ 'u:Unpublished',
    \ ]
    \ }

To support the output of the BibLaTeX parser, this is no enough.
Could you talk to the developers of your client tool?

[jet@living]~/var/ctags-github% ./ctags --list-kinds=BibLaTeX
A  artworks
B  audios
C  bibnotes
D  bookinbooks
E  Booklets
G  collections
H  commentarys
I  datasets
J  images
K  interferences
L  jurisdictions
M  legislations
N  legals
O  letters
P  movies
Q  musics
R  mvbooks
S  mvcollections
T  mvproceedings
U  mvreferences
V  onlines
W  patents
g  performances
h  periodicals
i  references
j  reports
k  reviews
l  sets
m  software
n  standards
o  suppbooks
p  suppcollections
q  suppperiodicals
r  thesis
s  videos
t  xdatas

p is used as Phdtheses in BibTeX and suppcollections in BibLaTeX.
The developers may wonder which one should be used.

@masatake
Copy link
Member

Anyway, I must release a newer version.

@andregpss
Copy link
Author

Tagbar developer told that "the universal-ctags implementation was done by defining a new tag kind of biblatex that is independent and incompatible with bibtex".
In this regard, Tagbar (and maybe other tools) "have to have only a single language definition".
I do not know how to solve this. From the user view, it would be good to have all references listed on TagBar.

@masatake
Copy link
Member

What I can do?

I documented the concept of "Running multiple parsers on an input file".
See https://docs.ctags.io/en/latest/running-multi-parsers.html .

However, it is written for parser developers.
I wrote very few for client-tool developers.
https://docs.ctags.io/en/latest/man/ctags-client-tools.7.html#multiple-languages-for-an-input-file

I will try to document how to support a tag file of "Running multiple parsers on an input file" in a client tool by extending the man page.
Then we can discuss supporting a tag file of "Running multiple parsers on an input file" in TagBar with its developers based on the document.

Even if they reject supporting the concept, the extended document may help someone.

@masatake
Copy link
Member

I read preservim/tagbar#759 (comment).
Quite interesting. This is about what I recognized as how to express "cross-language scope".

@andregpss
Copy link
Author

I will try to document how to support a tag file of "Running multiple parsers on an input file" in a client tool by extending the man page.

Cool. Thanks for your attention.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants