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.
9 # Author: Julien Rioux <jrioux@lyx.org>
15 # The framework (biblatex|bibtex)
18 # Cite style variants (default|authoryear|natbib)
19 # We provide both authoryear and numerical citations
20 CiteEngineType authoryear|numerical
22 # Default style files for either engine type
23 DefaultBiblio authoryear:plainnat|numerical:plainnat
25 # Maximum number of names before "et al." chimes in
29 # The syntax of the cite command definitions below is:
30 # LyXName|alias*<!_stardesc!_stardesctooltip>[][]=latexcmd
32 # * LyXName: The LyX name as output in the LyX file. For
33 # portability reasons, we try to use the same
34 # name for same-formatted commands in the
35 # different engines (thus many names stem from
37 # * Alias: A (comma-separated) list of commands that fall
38 # back to the given LyX name in the current engine.
39 # This is a bit like "ObsoletedBy" in the layouts.
40 # * latexcmd: The actual LaTeX command that is output.
42 # Alias and latexcmd are optional. If no latexcmd is given, the
43 # LyXName will be output to LaTeX.
47 # * The LyXName "keyonly" has a special meaning: only the citation key,
48 # without any latex command, is output.
49 # * Capitalization indicates that the command also has a capitalized
50 # form (\Latexcmd vs. \latexcmd). These usually enforce upcasing of
51 # name prefixes (von Goethe => Von Goethe).
52 # * Brackets [] indicate the number of optional arguments (0, 1, 2).
53 # * The star * indicates there is a starred version of the command
54 # (\latexcmd* vs. \latexcmd). By default, the starred version means:
55 # Expand the author list even if the maxnames setting would cause
56 # BibTeX/Biber to shorten it with "et al.".
57 # If the star has a different meaning for a command, it can be
58 # specified in angle brackets: <!_stardesc!_stardesctooltip>.
59 # Maximal two translatable macro keywords, marked by the prefix '!_',
60 # can be given. The first points to the string that replaces the
61 # "Full aut&hor list" checkbox label in the Citation dialog, the
62 # second one an optional tooltip for this checkbox. Note that these
63 # two macros have to be defined in the CiteFormat section (see below),
64 # dropping the '!' from the prefix (see below), e.g.:
65 # _stardesc Starred command label
66 # _stardesctooltip Tooltip for the starred command checkbox.
69 # CITE COMMAND DEFINITIONS for either engine type
100 # The following defines how the commands are represented in the GUI
101 # (inset button and citation dialog) as well as in XHTML, docbook and
104 # There are common definitions (default) and specific definitions for
105 # either cite engine type (which overwrite existing defaults.
108 # Input standard format definitions for the bibliography
109 Input stdciteformats.inc
115 # 1. Translatable bits (need to be marked by _ prefix)
116 # Note that preceding and trailing spaces matter.
119 _addtobib Add to bibliography only.
122 # The following are handled by BiblioInfo
124 _namesep , [[separate author names in citation, except for last name]]
125 _lastnamesep , and [[separate name of last author in citation]]
126 _pairnamesep and [[separate two authors in citation]]
129 # 2. Macros re-used in the style definitions
131 # A link that lets us jump to the bibliography entry in LyXHTML
132 # %clean:key% will be substituted by the cite key to give a unique id
133 !startlink {!<a href='#LyXCite-%clean:key%'>!}
136 # "Author et al." or "??"
137 !abbrvciteauthor {%abbrvciteauthor%[[%abbrvciteauthor%]][[??]]}
138 # "Author, ..." or "??"
139 !fullciteauthor {%fullciteauthor%[[%fullciteauthor%]][[??]]}
140 # Handle starred command: abbr. or full author list
141 !makeauthor {%ifstar%[[%!fullciteauthor%]][[%!abbrvciteauthor%]]}
143 !textbefore {%textbefore%[[%textbefore% ]]}
145 !textafter {%textafter%[[, %textafter%]]}
146 # Add a year if it exists (else "??") and possibly a modifier (as in 2017a)
147 !year {%year%[[%year%]][[??]]}{%modifier%[[%modifier%]]}
150 !nextauthor {%next%[[%!sep% %!startlink%%!abbrvauthor%%!endlink%%!nextauthor%]]}
151 # Handle starred command: abbr. or full author list
152 !makenextauthor {%next%[[%!sep% %!startlink%%!makeauthor%%!endlink%%!makenextauthor%]]}
154 !nextkey {%next%[[%!sep% %key%%!nextkey%]]}
156 !nextyear {%next%[[%!sep% %!startlink%%!year%%!endlink%%!nextyear%]]}
159 # ACTUAL STYLE DEFINITIONS
161 # (identical in authoryear and numerical)
164 # "(cf. Year; NextYear, p. xx)" [Authoryear] / "(cf. Year, NextYear, p. xx)" [Numerical]
165 citeyearpar %!open%%!textbefore%%!startlink%%!year%%!endlink%%!nextyear%%!textafter%%!close%
166 # "Add to bibliography only." (dialog) / "[ID] (not cited)" (button)
167 nocite {%dialog%[[%_addtobib%]][[%key%%!nextkey% (%_notcited%)]]}
168 # Output only the key
169 keyonly {%dialog%[[%_keyonly%]][[%_key%: %key%%!nextkey%]]}
172 CiteFormat authoryear
180 # "Author et al. (cf. Year..."
181 !makecitet %!startlink%%!makeauthor%%!endlink% %!open%%!textbefore%%!year%%!nextcitet%
182 # "Author et al. cf. Year..." [sic!]
183 !makecitealt %!startlink%%!makeauthor% %!textbefore%%!year%%!endlink%%!nextcitealt%
184 # "Author et al., Year..."
185 !makecitealp %!startlink%%!makeauthor%, %!year%%!endlink%%!nextcitealp%
187 # "...); Nextauthor (Year..."
188 !nextcitet {%next%[[%!close%%!sep% %!startlink%%!makeauthor%%!endlink% %!open%%!year%%!nextcitet%]]}
189 # "...; NextAuthor et al. Year..."
190 !nextcitealt {%next%[[%!sep% %!makecitealt%]]}
191 # "...; NextAuthor et al., Year..."
192 !nextcitealp {%next%[[%!sep% %!makecitealp%]]}
195 # ACTUAL STYLE DEFINITIONS
197 # (additions and modifications to default)
200 # "Author (cf. Year); NextAuthor (Year, p. xx)"
201 citet %!makecitet%%!textafter%%!close%
202 # "(cf. Author et al., Year; NextAuthor et al., Year, p. xx)"
203 citep %!open%%!textbefore%%!makecitealp%%!textafter%%!close%
204 # "cf. Author et al., Year; NextAuthor et al., Year, p. xx"
205 citealp %!textbefore%%!makecitealp%%!textafter%
206 # "Author cf. Year; NextAuthor Year, p. xx" [sic!]
207 citealt %!makecitealt%%!textafter%
208 # "Author; NextAuthor, p. xx"
209 citeauthor %!startlink%%!makeauthor%%!endlink%%!makenextauthor%%!textafter%
210 # "Year; NextYear, p. xx"
211 citeyear %!startlink%%!year%%!endlink%%!nextyear%%!textafter%
213 # Fallback style: "Author (cf. Year); NextAuthor (Year, p. xx)"
214 cite %!makecitet%%!textafter%%!close%
225 # "Author [cf. ID..."
226 !makecitet %!makeauthor% %!open%%!textbefore%{%dialog%[[#ID]][[%!startlink%{%numericallabel%[[%numericallabel%]][[#%key%]]}%!endlink%]]}%!nextcitet%
228 !makecitealt %!makeauthor% %!textbefore%{%dialog%[[#ID]][[%!startlink%{%numericallabel%[[%numericallabel%]][[#%key%]]}%!endlink%]]}%!nextcitealt%
230 !hashkey {%dialog%[[#ID]][[%!startlink%{%numericallabel%[[%numericallabel%]][[#%key%]]}%!endlink%%!nexthashkey%]]}
232 # "...], NextAuthor [ID..."
233 !nextcitet {%next%[[%!close%%!sep% %!makeauthor% %!open%%!textbefore%{%dialog%[[#ID]][[%!startlink%{%numericallabel%[[%numericallabel%]][[#%key%]]}%!endlink%]]}%!nextcitet%]]}
234 # "..., NextAuthor ID..."
235 !nextcitealt {%next%[[%!sep% %!makeauthor% {%dialog%[[#ID]][[%!startlink%{%numericallabel%[[%numericallabel%]][[#%key%]]}%!endlink%]]}%!nextcitealt%]]}
236 # FIXME: What is this?
237 !nexthashid {%next%[[%!sep% #ID%!nexthashid%]]}
239 !nexthashkey {%next%[[%!sep% %!startlink%{%numericallabel%[[%numericallabel%]][[#%key%]]}%!endlink%%!nexthashkey%]]}
242 # ACTUAL STYLE DEFINITIONS
244 # (additions and modifications to default)
247 # "[cf. ID, NextID, p. xx]"
248 citep %!open%%!textbefore%%!hashkey%%!textafter%%!close%
249 # "Author [cf. ID], Nextauthor [NextID, p. xx]"
250 citet %!makecitet%%!textafter%%!close%
251 # "cf. ID, NextID, p. xx"
252 citealp %!textbefore%%!hashkey%%!textafter%
253 # "Author cf. ID, NextAuthor ID, p. xx"
254 citealt %!makecitealt%%!textafter%
255 # "Author, NextAuthor"
256 citeauthor %!startlink%%!makeauthor%%!endlink%%!makenextauthor%
258 citeyear %!startlink%%!year%%!endlink%%!nextyear%
260 # Fallback style: "[cf. ID, NextID, p. xx]"
261 cite %!open%%!textbefore%%!hashkey%%!textafter%%!close%