]> git.lyx.org Git - lyx.git/blob - lib/citeengines/jurabib.citeengine
Implement "key only" citation style
[lyx.git] / lib / citeengines / jurabib.citeengine
1 # \DeclareLyXCiteEngine[jurabib.sty]{Jurabib (BibTeX)}
2 # DescriptionBegin
3 #   Jurabib supports a range of author-year styles primarily suitable for law studies
4 #   and the Humanities. It includes localizations for English, German, French, Dutch,
5 #   Spanish and Italian.
6 # DescriptionEnd
7
8 # Author: Julien Rioux <jrioux@lyx.org>
9
10 Format 63
11
12 Requires jurabib
13
14 # The framework (biblatex|bibtex)
15 CiteFramework bibtex
16
17 # Cite style variants (default|authoryear|natbib)
18 # We provide only authoryear citations
19 CiteEngineType authoryear
20
21 # Default style file
22 DefaultBiblio  jurabib
23
24 # Maximum number of names before "et al." chimes in
25 MaxCiteNames 3
26
27
28 # The syntax of the cite command definitions below is:
29 # LyXName|alias*<!_stardesc!_stardesctooltip>[][]=latexcmd
30
31 # * LyXName:  The LyX name as output in the LyX file. For
32 #             portability reasons, we try to use the same
33 #             name for same-formatted commands in the
34 #             different engines (thus many names stem from
35 #             natbib).
36 # * Alias:    A (comma-separated) list of commands that fall
37 #             back to the given LyX name in the current engine.
38 #             This is a bit like "ObsoletedBy" in the layouts.
39 # * latexcmd: The actual LaTeX command that is output.
40 #
41 # Alias and latexcmd are optional. If no latexcmd is given, the
42 # LyXName will be output to LaTeX.
43 #
44 # Note further:
45 #
46 # * The LyXName "keyonly" has a special meaning: only the citation key,
47 #   without any latex command, is output.
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
69 # FIXME: support for these jurabib styles (fileformat)
70 # citefield []{}
71 # footcite [][]
72 # footcitetitle [][]
73 # footcitet [][]
74 # footcitep [][]
75 # footcitealt [][]
76 # footcitealp [][]
77 # footciteauthor [][]
78 # footciteyear [][]
79 # footciteyearpar [][]
80 # footfullcite [][]
81
82 #
83 # CITE COMMAND DEFINITIONS
84 #
85 CiteEngine authoryear
86         # \cite* is not implemented: use \cite instead, it's the same
87         cite [][]
88         citetitle [][]
89         citet [][]
90         citep [][]
91         citealt [][]
92         citealp [][]
93         citeauthor [][]
94         citeyear [][]
95         citeyearpar [][]
96         fullcite [][]
97         nocite
98         keyonly
99 End
100
101 #
102 # CITE FORMAT
103 #
104
105 # The following defines how the commands are represented in the GUI
106 # (inset button and citation dialog) as well as in XHTML, docbook and
107 # plain text output.
108 #
109 CiteFormat authoryear
110         #
111         # MACROS
112         #
113         # 1. Translatable bits (need to be marked by _ prefix)
114         #    Note that preceding and trailing spaces matter.
115         #
116         _notcited not cited
117         _addtobib Add to bibliography only.
118         _keyonly Key only.
119         _key Key
120         _fullcite bibliography entry
121         _bibentry Bibliography entry.
122         _before before
123         _shorttitle short title
124         # The following are handled by BiblioInfo
125         _etal  et al.
126         _namesep /
127         _lastnamesep /
128         _pairnamesep /
129
130         #
131         # 2. Macros re-used in the style definitions
132         #
133         !open (
134         !sep ;
135         !close )
136         !obracket [
137         !cbracket ]
138
139         # A link that lets us jump to the bibliography entry in LyXHTML
140         # %clean:key% will be substituted by the cite key to give a unique id
141         !startlink {!<a href='#LyXCite-%clean:key%'>!}
142         !endlink {!</a>!}
143
144         # "ShortAuthor", "Author" or "??"
145         !shortauthor {%shortauthor%[[%shortauthor%]][[{%abbrvciteauthor%[[%abbrvciteauthor%]][[??]]}]]}
146         # "... ShortTitle"
147         !shorttitle {%shorttitle%[[ %shorttitle%]][[{%dialog%[[ <%_shorttitle%>]][[%!makejurashorttitle%]]}]]}
148         # Title or "??"
149         !maketitle {%title%[[ %title%]][[ ??]]}
150         # "Journal Volume [Year]"
151         !jurashorttitle {%journal%[[ %journal%]]}{%volume%[[ %volume%]]}{%year%[[ %!obracket%%year%%!cbracket%]]}
152         # Handle short title fallback
153         !makejurashorttitle {%ifentrytype:article%[[%!jurashorttitle%]][[{%ifentrytype:periodical%[[%!jurashorttitle%]][[ %!maketitle%]]}]]}
154         # "prenote "
155         !textbefore {%textbefore%[[%textbefore% ]]}
156         # "/prenote" (button) / "/prenote/<before>" (dialog)
157         !textbefore2 {%textbefore%[[/%textbefore%]][[{%dialog%[[/<%_before%>]]}]]}
158         # ", postnote"
159         !textafter {%textafter%[[, %textafter%]]}
160         # " postnote"
161         !textafter2 {%textafter%[[ %textafter%]]}
162         # Add a year if it exists (else "??") and possibly a modifier (as in 2017a)
163         !year {%year%[[%year%]][[??]]}{%modifier%[[%modifier%]]}
164
165         # "ShortAuthor/prenote postnote..."
166         !cite %!startlink%%!shortauthor%%!endlink%%!textbefore2%%!textafter2%%!nextcite%
167         # "ShortAuthor/prenote ShortTitle postnote..."
168         !citetitle %!startlink%%!shortauthor%%!endlink%%!textbefore2%%!shorttitle%%!textafter2%%!nextcitetitle%
169         # "prenote ShortAuthor (Year, postnote)..."
170         !citet %!textbefore%%!startlink%%!shortauthor%%!endlink% %!open%%!year%%!textafter%%!close%%!nextcitet%
171         # "(prenote ShortAuthor, Year, postnote)"
172         !citep %!open%%!citealp%%!close%
173         # "prenote ShortAuthor Year, postnote..."
174         !citealt %!textbefore%%!startlink%%!shortauthor% %!year%%!endlink%%!textafter%%!nextcitealt%
175         # "prenote ShortAuthor, Year, postnote..."
176         !citealp %!textbefore%%!startlink%%!shortauthor%, %!year%%!endlink%%!textafter%%!nextcitealp%
177         # "prenote ShortAuthor, postnote..."
178         !citeauthor %!textbefore%%!startlink%%!shortauthor%%!endlink%%!textafter%%!nextauthor%
179         # "prenote Year, postnote..."
180         !citeyear %!textbefore%%!startlink%%!year%%!endlink%%!textafter%%!nextyear%
181         # "prenote (Year), postnote..."
182         !citeyearpar %!textbefore%%!open%%!startlink%%!year%%!endlink%%!close%%!textafter%%!nextyearpar%
183         # "prenote in: Key, postnote..."
184         !fullcite {%textbefore%[[%textbefore% in: ]]}%bibentry%{%textafter%[[ %textafter%]]}%!nextfullcite%
185
186         # "...; ShortAuthor postnote..."
187         !nextcite {%next%[[%!sep% %!startlink%%!shortauthor%%!endlink%%!textafter2%%!nextcite%]]}
188         # "...; ShortAuthor ShortTitle postnote..."
189         !nextcitetitle {%next%[[%!sep% %!startlink%%!shortauthor%%!endlink%%!shorttitle%%!textafter2%%!nextcitetitle%]]}
190         # "...; prenote ShortAuthor (Year, postnote)..."
191         !nextcitet {%next%[[%!sep% %!citet%]]}
192         # "...; prenote ShortAuthor Year, postnote..."
193         !nextcitealt {%next%[[%!sep% %!citealt%]]}
194         # "...; prenote ShortAuthor, Year, postnote..."
195         !nextcitealp {%next%[[%!sep% %!citealp%]]}
196         # "...; prenote ShortAuthor, postnote..."
197         !nextauthor {%next%[[%!sep% %!citeauthor%]]}
198         # "...; prenote Year, postnote..."
199         !nextyear {%next%[[%!sep% %!citeyear%]]}
200         # "...; prenote (Year), postnote..."
201         !nextyearpar {%next%[[%!sep% %!citeyearpar%]]}
202         # "...; Key, postnote..."
203         !nextfullcite {%next%[[%!sep% %bibentry%%textafter%%!nextfullcite%]]}
204         # "...; Key..."
205         !nextkey {%next%[[%!sep% %key%%!nextkey%]]}
206
207         #
208         # ACTUAL STYLE DEFINITIONS
209         #
210
211         # "ShortAuthor/prenote postnote; NextShortAuthor postnote..."
212         cite %!cite%
213         # "ShortAuthor/prenote ShortTitle postnote; NextShortAuthor ShortTitle postnote..."
214         citetitle %!citetitle%
215         # "prenote ShortAuthor (Year, postnote); prenote NextShortAuthor (Year, postnote)..."
216         citet %!citet%
217         # "(prenote ShortAuthor, Year, postnote)"
218         citep %!citep%
219         # "prenote ShortAuthor Year, postnote; prenote NextShortAuthor Year, postnote..."
220         citealt %!citealt%
221         # "prenote ShortAuthor, Year, postnote.; prenote NextShortAuthor, Year, postnote..."
222         citealp %!citealp%
223         # "prenote ShortAuthor, postnote; prenote NextShortAuthor, postnote..."
224         citeauthor %!citeauthor%
225         # "prenote Year, postnote; prenote Year, postnote..."
226         citeyear %!citeyear%
227         # "prenote (Year), postnote; prenote (Year), postnote..."
228         citeyearpar %!citeyearpar%
229         # "Bibliography entry." (dialog) / "Key; Key ... (full cite)" (button)
230         fullcite {%dialog%[[%_bibentry%]][[{%label%[[%!fullcite%]][[%key%%!nextkey% (%_fullcite%)]]}]]}
231         # "Add to bibliography only." (dialog) / "Key; Key ... (not cited)" (button)
232         nocite {%dialog%[[%_addtobib%]][[%key%%!nextkey% (%_notcited%)]]}
233         # Output only the key
234         keyonly {%dialog%[[%_keyonly%]][[%_key%: %key%%!nextkey%]]}
235 End