lyx_mirror/lib/layouts/natbib.module
Julien Rioux 1e947e3a18 Move the citation engine machinery to layouts.
Add a new layout syntax CiteEngine to define the citation commands
available for a given citation engine.

Also extend the CiteFormat syntax to allow more customization. This
mechanism, previously used to produce bibliography entries in the
citation GUI based on the BibTeX entrytype, is now also used to
produce the textual labels for citation insets in the buffer view.

Thus citation styles are almost completely customizable by modules.
Modules for the basic, jurabib and natbib engines are implemented.

Layout format incremented to 37.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40820 a592a061-630c-0410-9148-cb99ea01b6c8
2012-03-01 00:41:30 +00:00

101 lines
2.7 KiB
Plaintext

# \DeclareLyXModule[natbib.sty]{Natbib}
# DescriptionBegin
# Loads the LaTeX package natbib, a citation engine. Natbib supports
# both author-year and numerical styles for citations, automatic sorting
# and merging of numerical citations, annotations, capitalization of the
# `van' part of author names, shortened and full author lists, and more.
# DescriptionEnd
# Excludes: basic | jurabib
# Category: Citation engine
# Author: Julien Rioux <jrioux@lyx.org>
Format 37
Requires natbib
CiteEngineType authoryear|numerical
DefaultBiblio plainnat
CiteEngine authoryear
Citet*[][]
Citep*[][]
Citealt*[][]
Citealp*[][]
Citeauthor*[]
citeyear[]
citeyearpar[][]
nocite
End
CiteEngine numerical
Citep*[][]
Citealp*[][]
Citet*[][]
Citealt*[][]
Citeauthor*
citeyearpar[][]
citeyear
nocite
End
CiteFormat default
# translatable bits
_notcited not cited
_addtobib Add to bibliography only.
# macros
!open [
!sep ,
!close ]
!nextauthor {%next%[[%!sep% %!abbrvauthor%%!nextauthor%]]}
!nextkey {%next%[[%!sep% %key%%!nextkey%]]}
!nextyear {%next%[[%!sep% %!year%%!nextyear%]]}
!abbrvauthor {%abbrvauthor%[[%abbrvauthor%]][[??]]}
!textbefore {%textbefore%[[%textbefore% ]]}
!textafter {%textafter%[[, %textafter%]]}
!year {%year%[[%year%]][[??]]}
# cite styles
citet %!citet%%!textafter%%!close%
citealt %!citealt%%!textafter%
citeyearpar %!open%%!textbefore%%!year%%!nextyear%%!textafter%%!close%
nocite {%dialog%[[%_addtobib%]][[%key%%!nextkey% (%_notcited%)]]}
End
CiteFormat authoryear
!citet %!abbrvauthor% %!open%%!textbefore%%!year%%!nextcitet%
!citealt %!abbrvauthor% %!textbefore%%!year%%!nextcitealt%
!citealp %!abbrvauthor%, %!year%%!nextcitealp%
!nextcitet {%next%[[%!close%%!sep% %!citet%]]}
!nextcitealt {%next%[[%!sep% %!citealt%]]}
!nextcitealp {%next%[[%!sep% %!citealp%]]}
cite %!citet%%!textafter%%!close%
citep %!open%%!textbefore%%!citealp%%!textafter%%!close%
citealp %!textbefore%%!citealp%%!textafter%
citeauthor %!abbrvauthor%%!nextauthor%%!textafter%
citeyear %!year%%!nextyear%%!textafter%
End
CiteFormat numerical
!citet %!abbrvauthor% %!open%%!textbefore%{%dialog%[[#ID]][[#%key%]]}%!nextcitet%
!citealt %!abbrvauthor% %!textbefore%{%dialog%[[#ID]][[#%key%]]}%!nextcitealt%
!hashkey {%dialog%[[#ID]][[#%key%%!nexthashkey%]]}
!nextcitet {%next%[[%!close%%!sep% %!citet%]]}
!nextcitealt {%next%[[%!sep% %!citealt%]]}
!nexthashid {%next%[[%!sep% #ID%!nexthashid%]]}
!nexthashkey {%next%[[%!sep% #%key%%!nexthashkey%]]}
cite %!open%%!textbefore%%!hashkey%%!textafter%%!close%
citep %!open%%!textbefore%%!hashkey%%!textafter%%!close%
citealp %!textbefore%%!hashkey%%!textafter%
citeauthor %!abbrvauthor%%!nextauthor%
citeyear %!year%%!nextyear%
End