]> git.lyx.org Git - lyx.git/blob - lib/layouts/natbib.module
Add modifier to jurabib and natbib (author-year) modules.
[lyx.git] / lib / layouts / natbib.module
1 # \DeclareLyXModule[natbib.sty]{Natbib}
2 # DescriptionBegin
3 #   Loads the LaTeX package natbib, a citation engine. Natbib supports
4 #   both author-year and numerical styles for citations, automatic sorting
5 #   and merging of numerical citations, annotations, capitalization of the
6 #   `van' part of author names, shortened and full author lists, and more.
7 # DescriptionEnd
8 # Excludes: basic | jurabib
9 # Category: Citation engine
10
11 # Author: Julien Rioux <jrioux@lyx.org>
12
13 Format 45
14
15 Requires natbib
16
17 CiteEngineType authoryear|numerical
18 DefaultBiblio  plainnat
19
20 CiteEngine authoryear
21         Citet*[][]
22         Citep*[][]
23         Citealt*[][]
24         Citealp*[][]
25         Citeauthor*[]
26         citeyear[]
27         citeyearpar[][]
28         nocite
29 End
30
31 CiteEngine numerical
32         Citep*[][]
33         Citealp*[][]
34         Citet*[][]
35         Citealt*[][]
36         Citeauthor*
37         citeyearpar[][]
38         citeyear
39         nocite
40 End
41
42 CiteFormat default
43         # translatable bits
44         _notcited not cited
45         _addtobib Add to bibliography only.
46
47         # macros
48         !startlink {!<a href='#LyXCite-%clean:key%'>!}
49         !endlink {!</a>!}
50
51         !nextauthor {%next%[[%!sep% %!startlink%%!abbrvauthor%%!endlink%%!nextauthor%]]}
52         !nextkey {%next%[[%!sep% %key%%!nextkey%]]}
53         !nextyear {%next%[[%!sep% %!startlink%%!year%%!endlink%%!nextyear%]]}
54
55         !abbrvauthor {%abbrvauthor%[[%abbrvauthor%]][[??]]}
56         !textbefore {%textbefore%[[%textbefore% ]]}
57         !textafter {%textafter%[[, %textafter%]]}
58         !year {%year%[[%year%]][[??]]}{%modifier%[[%modifier%]]}
59
60         # cite styles
61         citet %!citet%%!textafter%%!close%
62         citealt %!citealt%%!textafter%
63         citeyearpar %!open%%!textbefore%%!startlink%%!year%%!endlink%%!nextyear%%!textafter%%!close%
64         nocite {%dialog%[[%_addtobib%]][[%key%%!nextkey% (%_notcited%)]]}
65 End
66
67 CiteFormat authoryear
68         !open (
69         !sep ;
70         !close )
71
72         !citet %!startlink%%!abbrvauthor%%!endlink% %!open%%!textbefore%%!year%%!nextcitet%
73         !citealt %!startlink%%!abbrvauthor% %!textbefore%%!year%%!endlink%%!nextcitealt%
74         !citealp %!startlink%%!abbrvauthor%, %!year%%!endlink%%!nextcitealp%
75
76         !nextcitet {%next%[[%!close%%!sep% %!citet%]]}
77         !nextcitealt {%next%[[%!sep% %!citealt%]]}
78         !nextcitealp {%next%[[%!sep% %!citealp%]]}
79
80         cite %!citet%%!textafter%%!close%
81         citep %!open%%!textbefore%%!citealp%%!textafter%%!close%
82         citealp %!textbefore%%!citealp%%!textafter%
83         citeauthor %!startlink%%!abbrvauthor%%!endlink%%!nextauthor%%!textafter%
84         citeyear %!startlink%%!year%%!endlink%%!nextyear%%!textafter%
85 End
86
87 CiteFormat numerical
88         !open [
89         !sep ,
90         !close ]
91
92         !citet %!abbrvauthor% %!open%%!textbefore%{%dialog%[[#ID]][[%!startlink%#%key%%!endlink%]]}%!nextcitet%
93         !citealt %!abbrvauthor% %!textbefore%{%dialog%[[#ID]][[%!startlink%#%key%%!endlink%]]}%!nextcitealt%
94
95         !hashkey {%dialog%[[#ID]][[%!startlink%#%key%%!endlink%%!nexthashkey%]]}
96
97         !nextcitet {%next%[[%!close%%!sep% %!citet%]]}
98         !nextcitealt {%next%[[%!sep% %!citealt%]]}
99         !nexthashid {%next%[[%!sep% #ID%!nexthashid%]]}
100         !nexthashkey {%next%[[%!sep% %!startlink%#%key%%!endlink%%!nexthashkey%]]}
101
102         cite %!open%%!textbefore%%!hashkey%%!textafter%%!close%
103         citep %!open%%!textbefore%%!hashkey%%!textafter%%!close%
104         citealp %!textbefore%%!hashkey%%!textafter%
105         citeauthor %!startlink%%!abbrvauthor%%!endlink%%!nextauthor%
106         citeyear %!startlink%%!year%%!endlink%%!nextyear%
107 End