1 # \DeclareLyXCiteEngine[natbib.sty]{Natbib (BibTeX)}
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.
8 # Excludes: basic | jurabib | biblatex | biblatex-natbib
10 # Author: Julien Rioux <jrioux@lyx.org>
16 # The framework (biblatex|bibtex)
19 # Cite style variants (default|authoryear|natbib)
20 # We provide both authoryear and numerical citations
21 CiteEngineType authoryear|numerical
23 # Default style files for either engine type
24 DefaultBiblio authoryear:plainnat|numerical:plainnat
26 # Maximum number of names before "et al." chimes in
30 # The syntax of the cite command definitions below is:
31 # LyXName|alias*<!_stardesc!_stardesctooltip>[][]=latexcmd
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
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.
43 # Alias and latexcmd are optional. If no latexcmd is given, the
44 # LyXName will be output to LaTeX.
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.
68 # CITE COMMAND DEFINITIONS for either engine type
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
101 # There are common definitions (default) and specific definitions for
102 # either cite engine type (which overwrite existing defaults.
108 # 1. Translatable bits (need to be marked by _ prefix)
109 # Note that preceding and trailing spaces matter.
112 _addtobib Add to bibliography only.
113 # The following are handled by BiblioInfo
115 _namesep , [[separate author names in citation, except for last name]]
116 _lastnamesep , and [[separate name of last author in citation]]
117 _pairnamesep and [[separate two authors in citation]]
120 # 2. Macros re-used in the style definitions
122 # A link that lets us jump to the bibliography entry in LyXHTML
123 # %clean:key% will be substituted by the cite key to give a unique id
124 !startlink {!<a href='#LyXCite-%clean:key%'>!}
127 # "Author et al." or "??"
128 !abbrvauthor {%abbrvauthor%[[%abbrvauthor%]][[??]]}
129 # "Author, ..." or "??"
130 !fullauthor {%fullauthor%[[%fullauthor%]][[??]]}
131 # Handle starred command: abbr. or full author list
132 !makeauthor {%ifstar%[[%!fullauthor%]][[%!abbrvauthor%]]}
134 !textbefore {%textbefore%[[%textbefore% ]]}
136 !textafter {%textafter%[[, %textafter%]]}
137 # Add a year if it exists (else "??") and possibly a modifier (as in 2017a)
138 !year {%year%[[%year%]][[??]]}{%modifier%[[%modifier%]]}
141 !nextauthor {%next%[[%!sep% %!startlink%%!abbrvauthor%%!endlink%%!nextauthor%]]}
142 # Handle starred command: abbr. or full author list
143 !makenextauthor {%next%[[%!sep% %!startlink%%!makeauthor%%!endlink%%!makenextauthor%]]}
145 !nextkey {%next%[[%!sep% %key%%!nextkey%]]}
147 !nextyear {%next%[[%!sep% %!startlink%%!year%%!endlink%%!nextyear%]]}
150 # ACTUAL STYLE DEFINITIONS
152 # (identical in authoryear and numerical)
155 # "(cf. Year; NextYear, p. xx)" [Authoryear] / "(cf. Year, NextYear, p. xx)" [Numerical]
156 citeyearpar %!open%%!textbefore%%!startlink%%!year%%!endlink%%!nextyear%%!textafter%%!close%
157 # "Add to bibliography only." (dialog) / "[ID] (not cited)" (button)
158 nocite {%dialog%[[%_addtobib%]][[%key%%!nextkey% (%_notcited%)]]}
161 CiteFormat authoryear
169 # "Author et al. (cf. Year..."
170 !makecitet %!startlink%%!makeauthor%%!endlink% %!open%%!textbefore%%!year%%!nextcitet%
171 # "Author et al. cf. Year..." [sic!]
172 !makecitealt %!startlink%%!makeauthor% %!textbefore%%!year%%!endlink%%!nextcitealt%
173 # "Author et al., Year..."
174 !makecitealp %!startlink%%!makeauthor%, %!year%%!endlink%%!nextcitealp%
176 # "...); Nextauthor (Year..."
177 !nextcitet {%next%[[%!close%%!sep% %!startlink%%!makeauthor%%!endlink% %!open%%!year%%!nextcitet%]]}
178 # "...; NextAuthor et al. Year..."
179 !nextcitealt {%next%[[%!sep% %!makecitealt%]]}
180 # "...; NextAuthor et al., Year..."
181 !nextcitealp {%next%[[%!sep% %!makecitealp%]]}
184 # ACTUAL STYLE DEFINITIONS
186 # (additions and modifications to default)
189 # "Author (cf. Year); NextAuthor (Year, p. xx)"
190 citet %!makecitet%%!textafter%%!close%
191 # "(cf. Author et al., Year; NextAuthor et al., Year, p. xx)"
192 citep %!open%%!textbefore%%!makecitealp%%!textafter%%!close%
193 # "cf. Author et al., Year; NextAuthor et al., Year, p. xx"
194 citealp %!textbefore%%!makecitealp%%!textafter%
195 # "Author cf. Year; NextAuthor Year, p. xx" [sic!]
196 citealt %!makecitealt%%!textafter%
197 # "Author; NextAuthor, p. xx"
198 citeauthor %!startlink%%!makeauthor%%!endlink%%!makenextauthor%%!textafter%
199 # "Year; NextYear, p. xx"
200 citeyear %!startlink%%!year%%!endlink%%!nextyear%%!textafter%
202 # Fallback style: "Author (cf. Year); NextAuthor (Year, p. xx)"
203 cite %!makecitet%%!textafter%%!close%
214 # "Author [cf. ID..."
215 !makecitet %!makeauthor% %!open%%!textbefore%{%dialog%[[#ID]][[%!startlink%{%numericallabel%[[%numericallabel%]][[#%key%]]}%!endlink%]]}%!nextcitet%
217 !makecitealt %!makeauthor% %!textbefore%{%dialog%[[#ID]][[%!startlink%{%numericallabel%[[%numericallabel%]][[#%key%]]}%!endlink%]]}%!nextcitealt%
219 !hashkey {%dialog%[[#ID]][[%!startlink%{%numericallabel%[[%numericallabel%]][[#%key%]]}%!endlink%%!nexthashkey%]]}
221 # "...], NextAuthor [ID..."
222 !nextcitet {%next%[[%!close%%!sep% %!makeauthor% %!open%%!textbefore%{%dialog%[[#ID]][[%!startlink%{%numericallabel%[[%numericallabel%]][[#%key%]]}%!endlink%]]}%!nextcitet%]]}
223 # "..., NextAuthor ID..."
224 !nextcitealt {%next%[[%!sep% %!makeauthor% {%dialog%[[#ID]][[%!startlink%{%numericallabel%[[%numericallabel%]][[#%key%]]}%!endlink%]]}%!nextcitealt%]]}
225 # FIXME: What is this?
226 !nexthashid {%next%[[%!sep% #ID%!nexthashid%]]}
228 !nexthashkey {%next%[[%!sep% %!startlink%{%numericallabel%[[%numericallabel%]][[#%key%]]}%!endlink%%!nexthashkey%]]}
231 # ACTUAL STYLE DEFINITIONS
233 # (additions and modifications to default)
236 # "[cf. ID, NextID, p. xx]"
237 citep %!open%%!textbefore%%!hashkey%%!textafter%%!close%
238 # "Author [cf. ID], Nextauthor [NextID, p. xx]"
239 citet %!makecitet%%!textafter%%!close%
240 # "cf. ID, NextID, p. xx"
241 citealp %!textbefore%%!hashkey%%!textafter%
242 # "Author cf. ID, NextAuthor ID, p. xx"
243 citealt %!makecitealt%%!textafter%
244 # "Author, NextAuthor"
245 citeauthor %!startlink%%!makeauthor%%!endlink%%!makenextauthor%
247 citeyear %!startlink%%!year%%!endlink%%!nextyear%
249 # Fallback style: "[cf. ID, NextID, p. xx]"
250 cite %!open%%!textbefore%%!hashkey%%!textafter%%!close%