]> git.lyx.org Git - lyx.git/blob - lib/citeengines/natbib.citeengine
New tag MaxCiteNames
[lyx.git] / lib / citeengines / natbib.citeengine
1 # \DeclareLyXCiteEngine[natbib.sty]{Natbib (BibTeX)}
2 # DescriptionBegin
3 #   Natbib supports a range of both author-year and numerical styles mainly
4 #   aimed at the Humanities. It features automatic sorting and merging of
5 #   numerical citations, annotations, capitalization of the `van' part of
6 #   author names, shortened and full author lists, and more.
7 # DescriptionEnd
8 # Excludes: basic | jurabib | biblatex
9
10 # Author: Julien Rioux <jrioux@lyx.org>
11
12 Format 63
13
14 Requires natbib
15
16 # The framework (biblatex|bibtex)
17 CiteFramework bibtex
18
19 # Cite style variants (default|authoryear|natbib)
20 # We provide both authoryear and numerical citations
21 CiteEngineType authoryear|numerical
22
23 # Default style files for either engine type
24 DefaultBiblio  authoryear:plainnat|numerical:plainnat
25
26 # Maximum number of names before "et al." chimes in
27 MaxCiteNames 2
28
29
30 # The syntax of the cite command definitions below is:
31 # LyXName|alias*<!_stardesc!_stardesctooltip>[][]=latexcmd
32
33 # * LyXName:  The LyX name as output in the LyX file. For
34 #             portability reasons, we try to use the same
35 #             name for same-formatted commands in the
36 #             different engines (thus many names stem from
37 #             natbib).
38 # * Alias:    A (comma-separated) list of commands that fall
39 #             back to the given LyX name in the current engine.
40 #             This is a bit like "ObsoletedBy" in the layouts.
41 # * latexcmd: The actual LaTeX command that is output.
42 #
43 # Alias and latexcmd are optional. If no latexcmd is given, the
44 # LyXName will be output to LaTeX.
45 #
46 # Note further:
47 #
48 # * Capitalization indicates that the command also has a capitalized
49 #   form (\Latexcmd vs. \latexcmd). These usually enforce upcasing of
50 #   name prefixes (von Goethe => Von Goethe).
51 # * Brackets [] indicate the number of optional arguments (0, 1, 2).
52 # * The star * indicates there is a starred version of the command
53 #   (\latexcmd* vs. \latexcmd). By default, the starred version means:
54 #   Expand the author list even if the maxnames setting would cause
55 #   BibTeX/Biber to shorten it with "et al.".
56 #   If the star has a different meaning for a command, it can be
57 #   specified in angle brackets: <!_stardesc!_stardesctooltip>.
58 #   Maximal two translatable macro keywords, marked by the prefix '!_',
59 #   can be given. The first points to the string that replaces the
60 #   "Full aut&hor list" checkbox label in the Citation dialog, the
61 #   second one an optional tooltip for this checkbox. Note that these
62 #   two macros have to be defined in the CiteFormat section (see below),
63 #   dropping the '!' from the prefix (see below), e.g.:
64 #   _stardesc Starred command label
65 #   _stardesctooltip Tooltip for the starred command checkbox.
66
67 #
68 # CITE COMMAND DEFINITIONS for either engine type
69 #
70 CiteEngine authoryear
71         Citet*[][]
72         Citep*[][]
73         Citealt*[][]
74         Citealp*[][]
75         Citeauthor*[]
76         citeyear[]
77         citeyearpar[][]
78         nocite
79 End
80
81 CiteEngine numerical
82         Citep*[][]
83         Citealp*[][]
84         Citet*[][]
85         Citealt*[][]
86         Citeauthor*
87         citeyearpar[][]
88         citeyear
89         nocite
90 End
91
92
93 #
94 # CITE FORMAT
95 #
96
97 # The following defines how the commands are represented in the GUI
98 # (inset button and citation dialog) as well as in XHTML, docbook and
99 # plain text output.
100 #
101 # There are common definitions (default) and specific definitions for
102 # either cite engine type (which overwrite existing defaults.
103 #
104 CiteFormat default
105         #
106         # MACROS
107         #
108         # 1. Translatable bits (need to be marked by _ prefix)
109         #
110         _notcited not cited
111         _addtobib Add to bibliography only.
112
113         #
114         # 2. Macros re-used in the style definitions
115         #
116         # A link that lets us jump to the bibliography entry in LyXHTML
117         # %clean:key% will be substituted by the cite key to give a unique id
118         !startlink {!<a href='#LyXCite-%clean:key%'>!}
119         !endlink {!</a>!}
120
121         # "Author et al." or "??"
122         !abbrvauthor {%abbrvauthor%[[%abbrvauthor%]][[??]]}
123         # "prenote "
124         !textbefore {%textbefore%[[%textbefore% ]]}
125         # ", postnote"
126         !textafter {%textafter%[[, %textafter%]]}
127         # Add a year if it exists (else "??") and possibly a modifier (as in 2017a)
128         !year {%year%[[%year%]][[??]]}{%modifier%[[%modifier%]]}
129
130         # "...; Author..."
131         !nextauthor {%next%[[%!sep% %!startlink%%!abbrvauthor%%!endlink%%!nextauthor%]]}
132         # "..., CiteKey..."
133         !nextkey {%next%[[%!sep% %key%%!nextkey%]]}
134         # "..., Year..."
135         !nextyear {%next%[[%!sep% %!startlink%%!year%%!endlink%%!nextyear%]]}
136
137         #
138         # ACTUAL STYLE DEFINITIONS
139         #
140         # (identical in authoryear and numerical)
141         #
142
143         # "(cf. Year; NextYear, p. xx)" [Authoryear] / "(cf. Year, NextYear, p. xx)" [Numerical]
144         citeyearpar %!open%%!textbefore%%!startlink%%!year%%!endlink%%!nextyear%%!textafter%%!close%
145         # "Add to bibliography only." (dialog) / "[ID] (not cited)" (button)
146         nocite {%dialog%[[%_addtobib%]][[%key%%!nextkey% (%_notcited%)]]}
147 End
148
149 CiteFormat authoryear
150         #
151         # MACROS
152         #
153         !open (
154         !sep ;
155         !close )
156
157         # "Author et al. (cf. Year..."
158         !makecitet %!startlink%%!abbrvauthor%%!endlink% %!open%%!textbefore%%!year%%!nextcitet%
159         # "Author et al. cf. Year..." [sic!]
160         !makecitealt %!startlink%%!abbrvauthor% %!textbefore%%!year%%!endlink%%!nextcitealt%
161         # "Author et al., Year..."
162         !makecitealp %!startlink%%!abbrvauthor%, %!year%%!endlink%%!nextcitealp%
163
164         # "...); Nextauthor (Year..."
165         !nextcitet {%next%[[%!close%%!sep% %!startlink%%!abbrvauthor%%!endlink% %!open%%!year%%!nextcitet%]]}
166         # "...; NextAuthor et al. Year..."
167         !nextcitealt {%next%[[%!sep% %!makecitealt%]]}
168         # "...; NextAuthor et al., Year..."
169         !nextcitealp {%next%[[%!sep% %!makecitealp%]]}
170
171         #
172         # ACTUAL STYLE DEFINITIONS
173         #
174         # (additions and modifications to default)
175         #
176
177         # "Author (cf. Year); NextAuthor (Year, p. xx)"
178         citet %!makecitet%%!textafter%%!close%
179         # "(cf. Author et al., Year; NextAuthor et al., Year, p. xx)"
180         citep %!open%%!textbefore%%!makecitealp%%!textafter%%!close%
181         # "cf. Author et al., Year; NextAuthor et al., Year, p. xx"
182         citealp %!textbefore%%!makecitealp%%!textafter%
183         # "Author cf. Year; NextAuthor Year, p. xx" [sic!]
184         citealt %!makecitealt%%!textafter%
185         # "Author; NextAuthor, p. xx"
186         citeauthor %!startlink%%!abbrvauthor%%!endlink%%!nextauthor%%!textafter%
187         # "Year; NextYear, p. xx"
188         citeyear %!startlink%%!year%%!endlink%%!nextyear%%!textafter%
189
190         # Fallback style: "Author (cf. Year); NextAuthor (Year, p. xx)"
191         cite %!makecitet%%!textafter%%!close%
192 End
193
194 CiteFormat numerical
195         #
196         # MACROS
197         #
198         !open [
199         !sep ,
200         !close ]
201
202         # "Author [cf. ID..."
203         !makecitet %!abbrvauthor% %!open%%!textbefore%{%dialog%[[#ID]][[%!startlink%{%numericallabel%[[%numericallabel%]][[#%key%]]}%!endlink%]]}%!nextcitet%
204         # "Author cf. ID..."
205         !makecitealt %!abbrvauthor% %!textbefore%{%dialog%[[#ID]][[%!startlink%{%numericallabel%[[%numericallabel%]][[#%key%]]}%!endlink%]]}%!nextcitealt%
206         # "ID..."
207         !hashkey {%dialog%[[#ID]][[%!startlink%{%numericallabel%[[%numericallabel%]][[#%key%]]}%!endlink%%!nexthashkey%]]}
208
209         # "...], NextAuthor [ID..."
210         !nextcitet {%next%[[%!close%%!sep% %!abbrvauthor% %!open%%!textbefore%{%dialog%[[#ID]][[%!startlink%{%numericallabel%[[%numericallabel%]][[#%key%]]}%!endlink%]]}%!nextcitet%]]}
211         # "..., NextAuthor ID..."
212         !nextcitealt {%next%[[%!sep% %!abbrvauthor% {%dialog%[[#ID]][[%!startlink%{%numericallabel%[[%numericallabel%]][[#%key%]]}%!endlink%]]}%!nextcitealt%]]}
213         # FIXME: What is this?
214         !nexthashid {%next%[[%!sep% #ID%!nexthashid%]]}
215         # "..., NextID..."
216         !nexthashkey {%next%[[%!sep% %!startlink%{%numericallabel%[[%numericallabel%]][[#%key%]]}%!endlink%%!nexthashkey%]]}
217
218         #
219         # ACTUAL STYLE DEFINITIONS
220         #
221         # (additions and modifications to default)
222         #
223
224         # "[cf. ID, NextID, p. xx]"
225         citep %!open%%!textbefore%%!hashkey%%!textafter%%!close%
226         # "Author [cf. ID], Nextauthor [NextID, p. xx]"
227         citet %!makecitet%%!textafter%%!close%
228         # "cf. ID, NextID, p. xx"
229         citealp %!textbefore%%!hashkey%%!textafter%
230         # "Author cf. ID, NextAuthor ID, p. xx"
231         citealt %!makecitealt%%!textafter%
232         # "Author, NextAuthor"
233         citeauthor %!startlink%%!abbrvauthor%%!endlink%%!nextauthor%
234         # "Year, NextYear"
235         citeyear %!startlink%%!year%%!endlink%%!nextyear%
236
237         # Fallback style: "[cf. ID, NextID, p. xx]"
238         cite %!open%%!textbefore%%!hashkey%%!textafter%%!close%
239 End