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