lyx_mirror/lib/citeengines/natbib.citeengine

251 lines
8.5 KiB
Plaintext
Raw Normal View History

# \DeclareLyXCiteEngine[natbib.sty]{Natbib (BibTeX)}
# DescriptionBegin
# Natbib supports a range of both author-year and numerical styles mainly
2017-01-01 07:36:13 +00:00
# aimed at the Humanities. It features automatic sorting and merging of
# numerical citations, annotations, capitalization of the `van' part of
# author names, shortened and full author lists, and more.
# DescriptionEnd
# Author: Julien Rioux <jrioux@lyx.org>
Format 63
Requires natbib
2017-01-04 12:30:50 +00:00
# The framework (biblatex|bibtex)
CiteFramework bibtex
2017-01-04 12:30:50 +00:00
# Cite style variants (default|authoryear|natbib)
# We provide both authoryear and numerical citations
CiteEngineType authoryear|numerical
2017-01-04 12:30:50 +00:00
# Default style files for either engine type
DefaultBiblio authoryear:plainnat|numerical:plainnat
# Maximum number of names before "et al." chimes in
MaxCiteNames 2
2017-01-04 12:30:50 +00:00
# The syntax of the cite command definitions below is:
# LyXName|alias*<!_stardesc!_stardesctooltip>[][]=latexcmd
#
# * LyXName: The LyX name as output in the LyX file. For
# portability reasons, we try to use the same
# name for same-formatted commands in the
# different engines (thus many names stem from
# natbib).
# * Alias: A (comma-separated) list of commands that fall
# back to the given LyX name in the current engine.
# This is a bit like "ObsoletedBy" in the layouts.
# * latexcmd: The actual LaTeX command that is output.
#
# Alias and latexcmd are optional. If no latexcmd is given, the
# LyXName will be output to LaTeX.
#
# Note further:
#
# * Capitalization indicates that the command also has a capitalized
# form (\Latexcmd vs. \latexcmd). These usually enforce upcasing of
# name prefixes (von Goethe => Von Goethe).
# * Brackets [] indicate the number of optional arguments (0, 1, 2).
# * The star * indicates there is a starred version of the command
# (\latexcmd* vs. \latexcmd). By default, the starred version means:
# Expand the author list even if the maxnames setting would cause
# BibTeX/Biber to shorten it with "et al.".
# If the star has a different meaning for a command, it can be
# specified in angle brackets: <!_stardesc!_stardesctooltip>.
# Maximal two translatable macro keywords, marked by the prefix '!_',
# can be given. The first points to the string that replaces the
# "Full aut&hor list" checkbox label in the Citation dialog, the
# second one an optional tooltip for this checkbox. Note that these
# two macros have to be defined in the CiteFormat section (see below),
# dropping the '!' from the prefix (see below), e.g.:
# _stardesc Starred command label
# _stardesctooltip Tooltip for the starred command checkbox.
#
# CITE COMMAND DEFINITIONS for either engine type
#
CiteEngine authoryear
Citet*[][]
Citep*[][]
Citealt*[][]
Citealp*[][]
Citeauthor*[]
citeyear[]
citeyearpar[][]
nocite
End
CiteEngine numerical
Citep*[][]
Citealp*[][]
Citet*[][]
Citealt*[][]
Citeauthor*
citeyearpar[][]
citeyear
nocite
End
2017-01-04 12:30:50 +00:00
#
# CITE FORMAT
#
# The following defines how the commands are represented in the GUI
# (inset button and citation dialog) as well as in XHTML, docbook and
# plain text output.
#
# There are common definitions (default) and specific definitions for
# either cite engine type (which overwrite existing defaults.
#
CiteFormat default
2017-01-04 12:30:50 +00:00
#
# MACROS
#
# 1. Translatable bits (need to be marked by _ prefix)
# Note that preceding and trailing spaces matter.
2017-01-04 12:30:50 +00:00
#
_notcited not cited
_addtobib Add to bibliography only.
# The following are handled by BiblioInfo
_etal et al.
_namesep , [[separate author names in citation, except for last name]]
_lastnamesep , and [[separate name of last author in citation]]
_pairnamesep and [[separate two authors in citation]]
2017-01-04 12:30:50 +00:00
#
# 2. Macros re-used in the style definitions
#
# A link that lets us jump to the bibliography entry in LyXHTML
# %clean:key% will be substituted by the cite key to give a unique id
!startlink {!<a href='#LyXCite-%clean:key%'>!}
!endlink {!</a>!}
2017-01-04 12:30:50 +00:00
# "Author et al." or "??"
!abbrvciteauthor {%abbrvciteauthor%[[%abbrvciteauthor%]][[??]]}
# "Author, ..." or "??"
!fullciteauthor {%fullciteauthor%[[%fullciteauthor%]][[??]]}
# Handle starred command: abbr. or full author list
!makeauthor {%ifstar%[[%!fullciteauthor%]][[%!abbrvciteauthor%]]}
2017-01-04 12:30:50 +00:00
# "prenote "
!textbefore {%textbefore%[[%textbefore% ]]}
2017-01-04 12:30:50 +00:00
# ", postnote"
!textafter {%textafter%[[, %textafter%]]}
# Add a year if it exists (else "??") and possibly a modifier (as in 2017a)
!year {%year%[[%year%]][[??]]}{%modifier%[[%modifier%]]}
2017-01-04 12:30:50 +00:00
# "...; Author..."
!nextauthor {%next%[[%!sep% %!startlink%%!abbrvauthor%%!endlink%%!nextauthor%]]}
# Handle starred command: abbr. or full author list
!makenextauthor {%next%[[%!sep% %!startlink%%!makeauthor%%!endlink%%!makenextauthor%]]}
2017-01-04 12:30:50 +00:00
# "..., CiteKey..."
!nextkey {%next%[[%!sep% %key%%!nextkey%]]}
2017-01-04 12:30:50 +00:00
# "..., Year..."
!nextyear {%next%[[%!sep% %!startlink%%!year%%!endlink%%!nextyear%]]}
2017-01-04 12:30:50 +00:00
#
# ACTUAL STYLE DEFINITIONS
#
# (identical in authoryear and numerical)
#
# "(cf. Year; NextYear, p. xx)" [Authoryear] / "(cf. Year, NextYear, p. xx)" [Numerical]
citeyearpar %!open%%!textbefore%%!startlink%%!year%%!endlink%%!nextyear%%!textafter%%!close%
2017-01-04 12:30:50 +00:00
# "Add to bibliography only." (dialog) / "[ID] (not cited)" (button)
nocite {%dialog%[[%_addtobib%]][[%key%%!nextkey% (%_notcited%)]]}
End
CiteFormat authoryear
2017-01-04 12:30:50 +00:00
#
# MACROS
#
!open (
!sep ;
!close )
2017-01-04 12:30:50 +00:00
# "Author et al. (cf. Year..."
!makecitet %!startlink%%!makeauthor%%!endlink% %!open%%!textbefore%%!year%%!nextcitet%
2017-01-04 12:30:50 +00:00
# "Author et al. cf. Year..." [sic!]
!makecitealt %!startlink%%!makeauthor% %!textbefore%%!year%%!endlink%%!nextcitealt%
2017-01-04 12:30:50 +00:00
# "Author et al., Year..."
!makecitealp %!startlink%%!makeauthor%, %!year%%!endlink%%!nextcitealp%
2017-01-04 12:30:50 +00:00
# "...); Nextauthor (Year..."
!nextcitet {%next%[[%!close%%!sep% %!startlink%%!makeauthor%%!endlink% %!open%%!year%%!nextcitet%]]}
2017-01-04 12:30:50 +00:00
# "...; NextAuthor et al. Year..."
!nextcitealt {%next%[[%!sep% %!makecitealt%]]}
2017-01-04 12:30:50 +00:00
# "...; NextAuthor et al., Year..."
!nextcitealp {%next%[[%!sep% %!makecitealp%]]}
2017-01-04 12:30:50 +00:00
#
# ACTUAL STYLE DEFINITIONS
#
# (additions and modifications to default)
#
# "Author (cf. Year); NextAuthor (Year, p. xx)"
citet %!makecitet%%!textafter%%!close%
2017-01-04 12:30:50 +00:00
# "(cf. Author et al., Year; NextAuthor et al., Year, p. xx)"
citep %!open%%!textbefore%%!makecitealp%%!textafter%%!close%
2017-01-04 12:30:50 +00:00
# "cf. Author et al., Year; NextAuthor et al., Year, p. xx"
citealp %!textbefore%%!makecitealp%%!textafter%
2017-01-04 12:30:50 +00:00
# "Author cf. Year; NextAuthor Year, p. xx" [sic!]
citealt %!makecitealt%%!textafter%
2017-01-04 12:30:50 +00:00
# "Author; NextAuthor, p. xx"
citeauthor %!startlink%%!makeauthor%%!endlink%%!makenextauthor%%!textafter%
2017-01-04 12:30:50 +00:00
# "Year; NextYear, p. xx"
citeyear %!startlink%%!year%%!endlink%%!nextyear%%!textafter%
2017-01-04 12:30:50 +00:00
# Fallback style: "Author (cf. Year); NextAuthor (Year, p. xx)"
cite %!makecitet%%!textafter%%!close%
End
CiteFormat numerical
2017-01-04 12:30:50 +00:00
#
# MACROS
#
!open [
!sep ,
!close ]
2017-01-04 12:30:50 +00:00
# "Author [cf. ID..."
!makecitet %!makeauthor% %!open%%!textbefore%{%dialog%[[#ID]][[%!startlink%{%numericallabel%[[%numericallabel%]][[#%key%]]}%!endlink%]]}%!nextcitet%
2017-01-04 12:30:50 +00:00
# "Author cf. ID..."
!makecitealt %!makeauthor% %!textbefore%{%dialog%[[#ID]][[%!startlink%{%numericallabel%[[%numericallabel%]][[#%key%]]}%!endlink%]]}%!nextcitealt%
2017-01-04 12:30:50 +00:00
# "ID..."
!hashkey {%dialog%[[#ID]][[%!startlink%{%numericallabel%[[%numericallabel%]][[#%key%]]}%!endlink%%!nexthashkey%]]}
2017-01-04 12:30:50 +00:00
# "...], NextAuthor [ID..."
!nextcitet {%next%[[%!close%%!sep% %!makeauthor% %!open%%!textbefore%{%dialog%[[#ID]][[%!startlink%{%numericallabel%[[%numericallabel%]][[#%key%]]}%!endlink%]]}%!nextcitet%]]}
2017-01-04 12:30:50 +00:00
# "..., NextAuthor ID..."
!nextcitealt {%next%[[%!sep% %!makeauthor% {%dialog%[[#ID]][[%!startlink%{%numericallabel%[[%numericallabel%]][[#%key%]]}%!endlink%]]}%!nextcitealt%]]}
# FIXME: What is this?
!nexthashid {%next%[[%!sep% #ID%!nexthashid%]]}
2017-01-04 12:30:50 +00:00
# "..., NextID..."
!nexthashkey {%next%[[%!sep% %!startlink%{%numericallabel%[[%numericallabel%]][[#%key%]]}%!endlink%%!nexthashkey%]]}
2017-01-04 12:30:50 +00:00
#
# ACTUAL STYLE DEFINITIONS
#
# (additions and modifications to default)
#
# "[cf. ID, NextID, p. xx]"
citep %!open%%!textbefore%%!hashkey%%!textafter%%!close%
2017-01-04 12:30:50 +00:00
# "Author [cf. ID], Nextauthor [NextID, p. xx]"
citet %!makecitet%%!textafter%%!close%
2017-01-04 12:30:50 +00:00
# "cf. ID, NextID, p. xx"
citealp %!textbefore%%!hashkey%%!textafter%
2017-01-04 12:30:50 +00:00
# "Author cf. ID, NextAuthor ID, p. xx"
citealt %!makecitealt%%!textafter%
2017-01-04 12:30:50 +00:00
# "Author, NextAuthor"
citeauthor %!startlink%%!makeauthor%%!endlink%%!makenextauthor%
2017-01-04 12:30:50 +00:00
# "Year, NextYear"
citeyear %!startlink%%!year%%!endlink%%!nextyear%
2017-01-04 12:30:50 +00:00
# Fallback style: "[cf. ID, NextID, p. xx]"
cite %!open%%!textbefore%%!hashkey%%!textafter%%!close%
End