Add support for biblatex-chicago (#12240)

File format change
This commit is contained in:
Juergen Spitzmueller 2024-07-09 15:18:06 +02:00
parent a4b99aee94
commit 8941b05774
11 changed files with 828 additions and 54 deletions

View File

@ -7,6 +7,10 @@ changes happened in particular if possible. A good example would be
----------------------- -----------------------
2024-07-09 Jürgen Spitzmüller <spitz@lyx.org>
* Format incremented to 624: Add biblatex-chicago cite engine.
We will revert new commands to ERT where necessary
2024-06-11 Udi Fogiel <ufogiel@lyx.org> 2024-06-11 Udi Fogiel <ufogiel@lyx.org>
* Format incremented to 623: Remove hebrew letter document class. * Format incremented to 623: Remove hebrew letter document class.
Old documents will be mapped to regular letter document class. Old documents will be mapped to regular letter document class.

View File

@ -2709,6 +2709,7 @@ citeenginesdir = $(pkgdatadir)/citeengines
dist_citeengines_DATA = \ dist_citeengines_DATA = \
citeengines/basic.citeengine \ citeengines/basic.citeengine \
citeengines/biblatex.citeengine \ citeengines/biblatex.citeengine \
citeengines/biblatex-chicago.citeengine \
citeengines/biblatex-natbib.citeengine \ citeengines/biblatex-natbib.citeengine \
citeengines/jurabib.citeengine \ citeengines/jurabib.citeengine \
citeengines/natbib.citeengine citeengines/natbib.citeengine

View File

@ -0,0 +1,421 @@
# \DeclareLyXCiteEngine[biblatex-chicago.sty]{Biblatex (Chicago style)}
# DescriptionBegin
# This Biblatex variety uses the biblatex-chicago package on top of
# biblatex to produce citations according to the Chicago Manual of Style.
# As with normal Biblatex, the use of 'biber' as Bibliography
# processor is advised.
# DescriptionEnd
# Author: Jürgen Spitzmüller <spitz@lyx.org>
Format 106
Requires biblatex-chicago
# The framework (biblatex|bibtex)
CiteFramework biblatex
# Cite style variants (default|authoryear|natbib)
# We provide authoryear and notational citations
CiteEngineType authoryear|notes
# Default style files for either engine type
DefaultBiblio authoryear:authoryear|notes:notes
# Maximum number of names before "et al." chimes in
MaxCiteNames 3
# 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:
#
# * The LyXName "keyonly" has a special meaning: only the citation key,
# without any latex command, is output.
# * 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.
# * A trailing $ indicates that a command features "qualified citation
# lists" (a specific Biblatex feature)
#
# CITE COMMAND DEFINITIONS for either engine type
#
CiteEngine authoryear
Cite$|citealt,citealp,smartcite[][]
Citet$[][]=textcite
Gentextcite$[][]
Citep$[][]=parencite
Citeauthor*<!_citeauthorstar!_citeauthorstartooltip>[][]
citeyearpar[][]=parencite*
citeyear[][]=cite*
citebyear[][]=citeyear
Footcite$[][]
Autocite$[][]
atcite
atpcite
citetitle*<!_citetitlestar!_citetitlestartooltip>[][]
fullcite[][]
footfullcite[][]
nocite
keyonly
End
CiteEngine notes
cite$|parencite,citep,citealt,citealp*<!_citestar!_citestartooltip>[][]
Citet$[][]=textcite
Gentextcite$[][]
Citep$[][]=parencite
Footcite$[][]=smartcite
Autocite$[][]
Citeauthor*<!_citeauthorstar!_citeauthorstartooltip>[][]
citeyear[][]=citeyear*
citebyear[][]=citeyear
Citetitle$*<!_citetitlestar!_citetitlestartooltip>[][]
fullcite[][]
shortcite*<!_shortcitestar!_shortcitestartooltip>[][]
shortrefcite[][]
shorthandcite*<!_shortcitestar!_shortcitestartooltip>[][]
shorthandrefcite[][]
footfullcite[][]
citejournal[][]
Headlesscite$[][]
headlessfullcite$[][]
surnamecite[][]
nocite
keyonly
End
#
# 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.
#
# Input standard format definitions for the bibliography
Input stdciteformats.inc
CiteFormat default
#
# MACROS
#
# 1. Translatable bits (need to be marked by _ prefix, if translated to the GUI language,
# or B_, if translated to the buffer language)
# Note that preceding and trailing spaces matter.
#
_notcited not cited
_addtobib Add to bibliography only.
_keyonly Key only.
_key Key
_footnote Footnote
_foot Foot
_fullcite bibliography entry
_bibentry Full bibliography entry.
_autocite Autocite
_auto Auto
# GUI strings for the starred commands
_citeauthorstar S&horten author list[[Possible substitute to All aut&hors]]
_citeauthorstartooltip Force a short author list (using et al.)
_citetitlestar F&orce full title[[Possible substitute to All aut&hors]]
_citetitlestartooltip Use full title even if shorttitle exists
# The following are handled by BiblioInfo
B_etal et al.
B_namesep , [[separate author names in citation, except for last name]]
B_lastnamesep , and [[separate name of last author in citation]]
B_pairnamesep and [[separate two authors in citation]]
B_gensuffix 's[[genitive suffix for author names]]
#
# 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>!}
# Add " , and " before the last item (but " and " if there are only two), else ", "
!smartsep {%second%[[{%next%[[%B_namesep%]][[%B_pairnamesep%]]}]][[{%next%[[%B_namesep%]][[%B_lastnamesep%]]}]]}
# A dummy year modifier. This just indicates that a modifier might be output,
# to differentiate \cite* and \citeyear
!dummymod [a]
# "...; Nextauthor ..."
!nextauthor {%next%[[%!sep% %!startlink%%!abbrvciteauthor%%!endlink%%!nextauthor%]]}
# Handle starred command: abbr. or full author list
!makenextauthor {%next%[[%!sep% %!startlink%%!makeauthor%%!endlink%%!makenextauthor%]]}
# "...; [NextID] ..."
!nextkey {%next%[[%!sep% %key%%!nextkey%]]}
# "...; Nextyear ..." (including extra label, as in 2017a)
!nextyear {%next%[[%!sep% %!startlink%%!year%%!endlink%%!nextyear%]]}
# "...; Nextyear ..." (including emulated extra label, as in 2017[a])
!nextshmyear {%next%[[%!sep% %!startlink%%!shmyear%%!endlink%%!nextshmyear%]]}
# "...; Nextyear ..." (without any extra label)
!nextbyear {%next%[[%!sep% %!startlink%%!byear%%!endlink%%!nextbyear%]]}
# "...; Nexttitle ..."
!makenexttitle {%next%[[%!sep% %!startlink%%!maketitle%%!endlink%%!makenexttitle%]]}
# "...; NextKey..."
!nextfullcite {%next%[[%!sep% %bibentry%%!nextfullcite%]]}
# "Author et al." (if > 3 authors) or "??"
!abbrvciteauthor {%abbrvciteauthor%[[%abbrvciteauthor%]][[??]]}
# "Author et al." (always) or "??"
!forceabbrvciteauthor {%forceabbrvciteauthor%[[%forceabbrvciteauthor%]][[??]]}
# Handle starred command: force of abbr. author list, independent of maxcitenames
!makeauthor {%ifstar%[[%!forceabbrvciteauthor%]][[%!abbrvciteauthor%]]}
# "prenote "
!textbefore {%textbefore%[[%textbefore% ]]}
# ", postnote"
!textafter {%textafter%[[, %textafter%]]}
# "prenote " (for qualified lists)
!ctextbefore {%curpretext%[[%curpretext% ]]}
# ", postnote" (for qualified lists)
!ctextafter {%curposttext%[[, %curposttext%]]}
# Add a year if it exists (else "??") and possibly a modifier (as in 2017a)
!year {%year%[[%year%]][[??]]}{%modifier%[[%modifier%]]}
# Add a year if it exists (else "??") and indicate a possible modifier (as in 2017[a])
!myear {%year%[[%year%]][[??]]}{%modifier%[[%modifier%]][[{%export%[[]][[%!dummymod%]]}]]}
# Add a shorthand if it exists else myear (see above)
!shmyear {%shorthand%[[%shorthand%]][[%!myear%]]}
# Add a year if it exists (else "??") without any modifier at all
!byear {%year%[[%year%]][[??]]}
# Add a shorttitle or title if it exists (else "??")
!makeshorttitle {%shorttitle%[[%shorttitle%]][[{%title%[[%title%]][[??]]}]]}
# Add a title (or "??")
!maketitle {%ifstar%[[{%title%[[%title%]][[??]]}]][[%!makeshorttitle%]]}
# "cf. Key..."
!fullcite %!startlink%%bibentry%%!endlink%%!nextfullcite%
#
# ACTUAL STYLE DEFINITIONS
#
# (identical in authoryear and numerical)
#
# "cf. Author; Nextautor, p. xx"
citeauthor %!textbefore%%!startlink%%!makeauthor%%!endlink%%!makenextauthor%%!textafter%
# "cf. Year; Nextyear, p. xx" (including extra label, as in 2017a)
citeyear %!textbefore%%!startlink%%!shmyear%%!endlink%%!nextshmyear%%!textafter%
# "cf. Year; Nextyear, p. xx" (without any extra label)
citebyear %!textbefore%%!startlink%%!byear%%!endlink%%!nextbyear%%!textafter%
# "cf. Title; Nexttitle, p. xx" (without any extra label)
citetitle %!textbefore%%!startlink%%!maketitle%%!endlink%%!makenexttitle%%!textafter%
# "Bibliography entry." (dialog) / "cf. Key; NextKey..., p. xx (bibliography entry)" (button)
fullcite {%dialog%[[%_bibentry%]][[%!textbefore%{%label%[[%!fullcite%]][[%key%%!nextkey% (%_fullcite%)]]}%!textafter%}]]}
# "Footnote: Full bibliography entry." (dialog) / "Foot: Key (bibliography entry)"
footfullcite {%dialog%[[%_footnote%]][[%_foot%]]}: {%dialog%[[%_bibentry%]][[{%label%[[%!fullcite%]][[%key%%!nextkey% (%_fullcite%)]]}]]}
# "Add to bibliography only." (dialog) / "[ID] (not cited)" (button)
nocite {%dialog%[[%_addtobib%]][[%key%%!nextkey% (%_notcited%)]]}
# Output only the key
keyonly {%dialog%[[%_keyonly%]][[%_key%: %key%%!nextkey%]]}
End
CiteFormat authoryear
#
# MACROS
#
!open (
!sep ;
!close )
# "cf. Author et. al Year..."
!makecite %!ctextbefore%%!startlink%%!abbrvciteauthor% %!year%%!endlink%%!ctextafter%%!nextcite%
# Author et al. (cf. Year...
!maketextcite {%ifqualified%[[%!textbefore%]]}%!startlink%%!abbrvciteauthor%%!endlink% %!open%{%ifqualified%[[%!ctextbefore%]][[%!textbefore%]]}%!year%%!ctextafter%%!nexttextcite%
# Author's et al. (cf. Year...
!makegentextcite {%ifqualified%[[%!textbefore%]]}%!startlink%%!abbrvciteauthor%%B_gensuffix%%!endlink% %!open%{%ifqualified%[[%!ctextbefore%]][[%!textbefore%]]}%!year%%!ctextafter%%!nextgentextcite%
# "cf. Author et. al Title..."
!maketcite %!ctextbefore%%!startlink%%!abbrvciteauthor%{%title%[[, %title%]]}%!endlink%%!ctextafter%%!nexttcite%
# "...; Nextauthor Year..."
!nextcite {%next%[[%!sep% %!makecite%]]}
# "...; Nextauthor Title..."
!nexttcite {%next%[[%!sep% %!maketcite%]]}
# "...); Nextauthor (Year..."
!nexttextcite {%next%[[%!close%%!smartsep%%!startlink%%!abbrvciteauthor%%!endlink% %!open%%!ctextbefore%%!year%%!ctextafter%%!nexttextcite%]]}
# "...); Nextauthor's (Year..."
!nextgentextcite {%next%[[%!close%%!smartsep%%!startlink%%!abbrvciteauthor%%B_gensuffix%%!endlink% %!open%%!ctextbefore%%!year%%!ctextafter%%!nexttextcite%]]}
# Add a year if it exists (else title, else "??") and possibly a modifier (as in 2017a)
!yeartitle {%year%[[%year%{%modifier%[[%modifier%]][[{%export%[[]][[%!dummymod%]]}]]}]][[{%title%[[%title%]][[??]]}]]}
# Add a shorthand if it exists, else yeartitle (above)
!shyeartitle {%shorthand%[[%shorthand%]][[%!yeartitle%]]}
# "...; Shorthand|Nextyear ..." (including extra label, as in 2017a)
!nextshyeartitle {%next%[[%!sep% %!startlink%%!yeartitle%%!endlink%%!nextshyeartitle%]]}
#
# ACTUAL STYLE DEFINITIONS
#
# (additions and modifications to default)
#
# "cf. Author A Year; Author B Year, p. xx"
cite %!textbefore%%!makecite%%!textafter%
# "cf. Author A (Year),[ and] Author B (Year, p. xx)"
citet %!maketextcite%%!textafter%%!close%
# "cf. Author A (Year),[ and] Author B (Year, p. xx)"
gentextcite %!makegentextcite%%!textafter%%!close%
# "(cf. Author A Year; Author B Year, p. xx)"
citep %!open%%!textbefore%%!makecite%%!textafter%%!close%
# This prints year or title, if year is missing
citeyear %!textbefore%%!startlink%%!shyeartitle%%!endlink%%!nextshyeartitle%%!textafter%
# "(cf. Year; Nextyear, p. xx)"
citeyearpar %!open%%!textbefore%%!startlink%%!shmyear%%!endlink%%!nextshmyear%%!textafter%%!close%
# "Footnote: cf. Author A Year; Author B Year, p. xx."
footcite {%dialog%[[%_footnote%]][[%_foot%]]}: %!textbefore%%!makecite%%!textafter%.
# "Auto: (cf. Author A Year; Author B Year, p. xx)"
autocite {%dialog%[[%_autocite%]][[%_auto%]]}: %!open%%!textbefore%%!makecite%%!textafter%%!close%
# "cf. Author A Title; Author B Title, p. xx"
atcite %!textbefore%%!maketcite%%!textafter%
# "cf. Author A Title; Author B Title, p. xx"
atpcite %!open%%!textbefore%%!maketcite%%!textafter%%!close%
End
CiteFormat notes
#
# MACROS
#
# 1. Translatable bits (need to be marked by _ prefix, if translated to the GUI language,
# or B_, if translated to the buffer language)
#
_super Super
_superscript Superscript
_innote + footnote: full or abbr. bib. entry
_facite full or abbr. bib. entry
_fabibentry Full or abbreviated bibliography entry.
_hlcite full or abbr. bib. entry w/o author
_hlbibentry Full or abbreviated bibliography entry without author.
_shortcite abbr. bib. entry
_scbibentry Abbreviated bibliography entry.
_hlfcite full bib. entry w/o author
_hlfbibentry Full bibliography entry without author.
_sncite full or abbr. bib. entry w/o prenames
_snbibentry Full or abbreviated bibliography, omit prenames.
_noibid No ibidem tracking
_noib No ibid.
_citestar No &ibidem tracking[[Possible substitute to All aut&hors]]
_citestartooltip Disable ibidem tracking for this entry
_shortcitestar No &back reference[[Possible substitute to All aut&hors]]
_shortcitestartooltip Disable page tracking for this entry to prevent back references (with option "noteref")
_shortrefcite abbr. bib. entry w/ back ref.
_shortrefcitedialog Abbreviated bib. entry (enforce back reference)
_shorthandrefcite (w/ back ref.)
_shorthandrefcitedialog (enforce back reference)
_noshorthand ??? (no shorthand!)
_nojtitle ??? (no journal title!)
#
# 2. Macros re-used in the style definitions
#
!open [
!sep ,
!close ]
# "Full or abbreviated bibliography entry." (dialog) / "cf. Key; NextKey..., p. xx (full or abbr. bib. entry)" (button)
!makecite {%dialog%[[%_fabibentry%]][[%!textbefore%%key%%!nextkey% (%_facite%)%!textafter%]]}
# Author et al. [cf. Year...
!maketextcite %!startlink%%!abbrvciteauthor%%!endlink%{%dialog%[[]][[ %!open%%!textbefore%%!ctextbefore%%!year%%!ctextafter%]]}%!nexttextcite%
# Author et al.'s (cf. Year...
!makegentextcite %!startlink%%!abbrvciteauthor%%B_gensuffix%%!endlink%{%dialog%[[]][[ %!open%%!textbefore%%!ctextbefore%%!year%%!ctextafter%]]}%!nextgentextcite%
# "(Full or abbreviated bibliography entry.)" (dialog) / "(cf. Key; NextKey..., p. xx [full or abbr. bib. entry])" (button)
!makecitep ({%dialog%[[%_fabibentry%]][[%!textbefore%%key%%!nextkey% %!open%%_facite%%!close%%!textafter%]]})
#
!makejtitle %!startlink%%!abbrvciteauthor%%!endlink%%!sep% {%journal%[[%!emphjournal% X]][[{%journaltitle%[[%!emphjournal% Y]][[%_nojtitle%,]]}{%volume%[[ %volume%]]}]]}%!makenextjtitle%
# "Full or abbreviated bibliography entry without author." (dialog) / "cf. Key; NextKey..., p. xx (full or abbr. bib. entry w/o author)" (button)
!makehlcite {%dialog%[[%_hlbibentry%]][[%!textbefore%%key%%!nextkey% (%_hlcite%)%!textafter%]]}
# "Full bibliography entry without author." (dialog) / "cf. Key; NextKey..., p. xx (full bib. entry w/o author)" (button)
!makehlfcite {%dialog%[[%_hlfbibentry%]][[%!textbefore%%key%%!nextkey% (%_hlfcite%)%!textafter%]]}
# "Abbreviated bibliography entry." (dialog) / "cf. Key; NextKey..., p. xx (abbr. bib. entry)" (button)
!makeshortcite {%dialog%[[%_scbibentry%]][[%!textbefore%%key%%!nextkey% (%_shortcite%)%!textafter%]]}
# "Abbreviated bib. entry (enforce back reference)" (dialog) / "cf. Key; NextKey..., p. xx (abbr. bib. entry w/ back ref.)" (button)
!makeshortrefcite {%dialog%[[%_shortrefcitedialog%]][[%!textbefore%%key%%!nextkey% (%_shortrefcite%)%!textafter%]]}
# Shorthand if available
!tryshorthand {%shorthand%[[%shorthand%]][[%_noshorthand%]]}
# Shorthand [cf. Year...
!makeshorthandcite %!textbefore%%!ctextbefore%%!startlink%%!tryshorthand%%!endlink%%!nextshorthand%
# Shorthand [cf. Year...
!makeshorthandrefcite %!makeshorthandcite% {%dialog%[[%_shorthandrefcitedialog%]][[%_shorthandrefcite%]]}
# "Full or abbreviated bibliography, omit prenames." (dialog) / "cf. Key; NextKey..., p. xx (full or abbr. bib. entry w/o prenames)" (button)
!makesncite {%dialog%[[%_snbibentry%]][[%!textbefore%%key%%!nextkey% (%_sncite%)%!textafter%]]}
# "...); Nextauthor (Year..."
!nexttextcite {%next%[[{%dialog%[[]][[%!close%]]}%!smartsep%%!startlink%%!abbrvciteauthor%%!endlink%{%dialog%[[]][[ %!open%%!ctextbefore%%!year%%!ctextafter%]]}%!nexttextcite%]]}
# "...); Nextauthor (Year..."
!nextgentextcite {%next%[[{%dialog%[[]][[%!close%]]}%!smartsep%%!startlink%%!abbrvciteauthor%%B_gensuffix%%!endlink%{%dialog%[[]][[ %!open%%!ctextbefore%%!year%%!ctextafter%]]}%!nexttextcite%]]}
# "...; Nexttitle ..."
!makenextjtitle {%next%[[%!sep% %!startlink%%!makejtitle%%!endlink%%!makenextjtitle%]]}
# "...; NextShorthand..."
!nextshorthand {%next%[[%!smartsep%%!ctextbefore%%!startlink%%!tryshorthand%%!endlink%%!ctextafter%%!nextshorthand%]]}
#
# ACTUAL STYLE DEFINITIONS
#
# (additions and modifications to default)
#
# "Full or abbreviated bibliography entry." (dialog) / "cf. Key; NextKey..., p. xx (full or abbr. bib. entry)" (button)
cite %!makecite%
# "Author [cf. ...],[ and] Nextauthor [..., p. xx]"
citet %!maketextcite%{%dialog%[[ %_innote%]][[%!textafter%%!close%]]}
# "Author's [cf. ID],[ and] Nextauthor [NextID, p. xx]"
gentextcite %!makegentextcite%{%dialog%[[ %_innote%]][[%!textafter%%!close%]]}
# "(Full or abbreviated bibliography entry.)" (dialog) / "(cf. Key; NextKey..., p. xx [full or abbr. bib. entry])" (button)
citep %!makecitep%
# "Footnote: cf. ID, NextID, p. xx."
footcite {%dialog%[[%_footnote%]][[%_foot%]]}: %!makecite%
# "Auto: (cf. Author A Year; Author B Year, p. xx)"
autocite {%dialog%[[%_autocite%]][[%_auto%]]}: %!makecite%
# "cf. Author, Journal vol., NextAuthor, ..., p. xx"
citejournal %!textbefore%%!makejtitle%%!textafter%
# "Full or abbreviated bibliography entry without author." (dialog) / "cf. Key; NextKey..., p. xx (full or abbr. bib. entry w/o author)" (button)
headlesscite %!makehlcite%
# "Full bibliography entry without author." (dialog) / "cf. Key; NextKey..., p. xx (full bib. entry w/o author)" (button)
headlessfullcite %!makehlfcite%
# "Abbreviated bibliography entry." (dialog) / "cf. Key; NextKey..., p. xx (abbr. bib. entry)" (button)
shortcite %!makeshortcite%
# "Shorthand" (dialog) / "cf. Shorthand; NextShorthand..., p. xx" (button)
shorthandcite %!makeshorthandcite%
# "Abbreviated bib. entry (enforce back reference)" (dialog) / "cf. Key; NextKey..., p. xx (abbr. bib. entry w/ back ref.)" (button)
shortrefcite %!makeshortrefcite%
# "Shorthand (enforce back reference)" (dialog) / "cf. Shorthand; NextShorthand..., p. xx (abbr. bib. entry w/ back ref.)" (button)
shorthandrefcite %!makeshorthandrefcite%
# "Full or abbreviated bibliography, omit prenames." (dialog) / "cf. Key; NextKey..., p. xx (full or abbr. bib. entry w/o prenames)" (button)
surnamecite %!makesncite%
End

View File

@ -1,4 +1,4 @@
#LyX 2.5 created this file. For more info see https://www.lyx.org/ #LyX 2.4 created this file. For more info see https://www.lyx.org/
\lyxformat 620 \lyxformat 620
\begin_document \begin_document
\begin_header \begin_header
@ -158,6 +158,7 @@ logicalmkup
\docbook_table_output 0 \docbook_table_output 0
\docbook_mathml_prefix 1 \docbook_mathml_prefix 1
\author -1162675398 "Tobias Hilbricht" hilbricht@linopus.de \author -1162675398 "Tobias Hilbricht" hilbricht@linopus.de
\author -712698321 "Jürgen Spitzmüller"
\author -584632292 "Richard Kimberly Heck" \author -584632292 "Richard Kimberly Heck"
\author 5863208 "ab" \author 5863208 "ab"
\end_header \end_header
@ -9645,12 +9646,14 @@ Verbatim
\end_layout \end_layout
\begin_layout Verbatim \begin_layout Verbatim
This is Verbatim. This is Verbatim.
\end_layout \end_layout
\begin_layout Verbatim \begin_layout Verbatim
\noindent \noindent
\align block \align block
The following 2 lines are empty: The following 2 lines are empty:
\end_layout \end_layout
@ -9663,6 +9666,7 @@ The following 2 lines are empty:
\end_layout \end_layout
\begin_layout Verbatim \begin_layout Verbatim
Almost everything is allowed in Verbatim:"%&$§#~'` Almost everything is allowed in Verbatim:"%&$§#~'`
\backslash \backslash
}][{| }][{|
@ -9686,6 +9690,7 @@ Verbatim
\end_layout \end_layout
\begin_layout Verbatim* \begin_layout Verbatim*
This is Verbatim*. This is Verbatim*.
\end_layout \end_layout
@ -33547,6 +33552,16 @@ literal "true"
\end_inset \end_inset
. .
\change_inserted -712698321 1720530740
\end_layout
\begin_layout Standard
\change_inserted -712698321 1720530806
Note that the Chicago style biblatex mode has built-in citation and bibliography styles which can only be slightly adapted via the bibliography options (please refer to the package manual for details).
\change_unchanged
\end_layout \end_layout
\begin_layout Standard \begin_layout Standard
@ -34013,6 +34028,85 @@ biblatex
Options Options
\family default \family default
field. field.
\change_inserted -712698321 1720530575
\end_layout
\begin_layout Description
\change_inserted -712698321 1720530576
Biblatex
\begin_inset space ~
\end_inset
(Chicago
\begin_inset space ~
\end_inset
style) loads the package
\series bold
biblatex-chicago
\series default
\begin_inset Index idx
range none
pageformat default
status collapsed
\begin_layout Plain Layout
\change_inserted -712698321 1720530576
\SpecialChar LaTeX
packages
\begin_inset IndexMacro subentry
status open
\begin_layout Plain Layout
\change_inserted -712698321 1720530576
biblatex-chicago
\end_layout
\end_inset
\end_layout
\end_inset
.
This is a specific variant particularly for users who want to follow the
\emph on
Chicago Manual of Style
\emph default
.
Both
\begin_inset Flex Code
status collapsed
\begin_layout Plain Layout
\change_inserted -712698321 1720530576
authordate
\end_layout
\end_inset
and
\begin_inset Flex Code
status collapsed
\begin_layout Plain Layout
\change_inserted -712698321 1720530576
notes-bibliography
\end_layout
\end_inset
mode are supported.
\change_unchanged
\end_layout \end_layout
\begin_layout Description \begin_layout Description
@ -34051,6 +34145,8 @@ Biblatex
biblatex biblatex
\series default \series default
styles are also supported by this variant. styles are also supported by this variant.
\change_inserted -712698321 1720530371
\end_layout \end_layout
\begin_layout Description \begin_layout Description

View File

@ -32880,6 +32880,12 @@ literal "true"
. .
\end_layout \end_layout
\begin_layout Standard
Beachten Sie,
dass der Chicago-Stil von biblatex fest vorgegebene Zitier- und Bibliographiestile voraussetzt,
die nur über die Zitierstil-Optionen leicht angepasst werden können (bitte konsultieren Sie die Paketdokumentation für genauere Informationen).
\end_layout
\begin_layout Standard \begin_layout Standard
Ein Querverweis auf einen Datenbankeintrag erfolgt wie in Abschnitt Ein Querverweis auf einen Datenbankeintrag erfolgt wie in Abschnitt
\begin_inset space ~ \begin_inset space ~
@ -33371,6 +33377,50 @@ Optionen
eingeben. eingeben.
\end_layout \end_layout
\begin_layout Description
Biblatex
\begin_inset space ~
\end_inset
(Chicago-Stil) lädt das Paket
\series bold
biblatex-chicago
\series default
\begin_inset Index idx
range none
pageformat default
status collapsed
\begin_layout Plain Layout
\SpecialChar LaTeX
-Paket
\begin_inset IndexMacro subentry
status open
\begin_layout Plain Layout
biblatex-chicago
\end_layout
\end_inset
\end_layout
\end_inset
.
Dieses bietet eine spezifische Variante für Benutzer,
die sich nach dem
\emph on
\lang english
Chicago Manual of Style
\emph default
\lang ngerman
richten wollen.
Sowohl Autor-Jahr als auch Fuß-/Endnoten mit Bibliografie werden unterstützt.
\end_layout
\begin_layout Description \begin_layout Description
\family sans \family sans

View File

@ -21,19 +21,29 @@ import re
# Uncomment only what you need to import, please (lyx2lyx_tools): # Uncomment only what you need to import, please (lyx2lyx_tools):
# convert_info_insets, get_ert, hex2ratio, insert_to_preamble, # convert_info_insets, get_ert, hex2ratio, insert_to_preamble,
# length_in_bp, lyx2latex, lyx2verbatim, put_cmd_in_ert, # length_in_bp, lyx2latex, lyx2verbatim,
# revert_flex_inset, revert_flex_inset, revert_font_attrs, # revert_flex_inset, revert_flex_inset, revert_font_attrs,
# revert_language, str2bool # revert_language, str2bool
from lyx2lyx_tools import add_to_preamble, latex_length from lyx2lyx_tools import (
add_to_preamble,
latex_length,
put_cmd_in_ert
)
# Uncomment only what you need to import, please (parser_tools): # Uncomment only what you need to import, please (parser_tools):
# check_token, count_pars_in_inset, del_complete_lines, del_token, # check_token, count_pars_in_inset, del_complete_lines, del_token,
# del_value, find_complete_lines, find_end_of, find_end_of_layout, # del_value, find_complete_lines, find_end_of, find_end_of_layout,
# find_re, find_substring, find_token_backwards, find_token_exact, # find_re, find_substring, find_token_backwards, find_token_exact,
# find_tokens, get_bool_value, get_containing_inset, # find_tokens, get_bool_value, get_containing_inset,
# get_containing_layout, get_option_value, get_quoted_value, # get_containing_layout, get_option_value,
# is_in_inset, set_bool_value # is_in_inset, set_bool_value
from parser_tools import find_end_of_inset, find_re, find_token, get_value from parser_tools import (
find_end_of_inset,
find_re,
find_token,
get_quoted_value,
get_value
)
#################################################################### ####################################################################
# Private helper functions # Private helper functions
@ -213,6 +223,158 @@ def convert_he_letter(document):
document.textclass = "letter" document.textclass = "letter"
chicago_local_layout = [
"### Inserted by lyx2lyx (biblatex-chicago) ###",
"Requires biblatex-chicago",
"### End of insertion by lyx2lyx (biblatex-chicago) ###" "",
]
def convert_biblatex_chicago(document):
"""Convert biblatex-chicago documents"""
chicago = document.del_local_layout(chicago_local_layout)
if not chicago:
chicago = document.del_from_header(["Requires biblatex-chicago"])
if not chicago:
return
# 1. Get cite engine
engine = "basic"
i = find_token(document.header, "\\cite_engine", 0)
if i == -1:
document.warning("Malformed document! Missing \\cite_engine")
else:
engine = get_value(document.header, "\\cite_engine", i)
# 2. If biblatex set to chicago
biblatex = False
if engine not in ["biblatex", "biblatex-natbib"]:
return
document.header[i] = "\\cite_engine biblatex-chicago"
i = find_token(document.header, "\\biblio_options", 0)
bibopts = ""
if i == -1:
val = get_value(document.header, "\\biblio_options", i)
cetype = "authoryear"
if bibopts.find("authordate") == -1:
cetype = "notes"
# 2. Set cite type
i = find_token(document.header, "\\cite_engine_type", 0)
if i == -1:
document.warning("Malformed document! Missing \\cite_engine_type")
else:
document.header[i] = "\\cite_engine_type %s" % cetype
def revert_biblatex_chicago(document):
"""Revert biblatex-chicago to ERT where necessary"""
# 1. Get and reset cite engine
engine = "basic"
i = find_token(document.header, "\\cite_engine", 0)
if i == -1:
document.warning("Malformed document! Missing \\cite_engine")
else:
engine = get_value(document.header, "\\cite_engine", i)
document.header[i] = "\\cite_engine biblatex"
# 2. Do we use biblatex-chicago?
if engine != "biblatex-chicago":
return
# 3. Set cite type
cetype = "authoryear"
i = find_token(document.header, "\\cite_engine_type", 0)
if i == -1:
document.warning("Malformed document! Missing \\cite_engine_type")
else:
cetype = get_value(document.header, "\\cite_engine_type", i)
document.header[i] = "\\cite_engine_type authoryear"
# 4. Add authordate option if needed
if cetype == "authoryear":
i = find_token(document.header, "\\biblio_options", 0)
if i != -1:
bibopts = get_value(document.header, "\\biblio_options", i)
if bibopts.find("authordate") != -1:
document.header[i] = "\\biblio_options %s" % bibopts + ", authordate"
else:
i = find_token(document.header, "\\biblio_style", 0)
if i == -1:
document.warning("Malformed document! Missing \\biblio_style")
else:
document.header[i+1:i+1] = ["\\biblio_options authordate"]
# 5. Set local layout
document.append_local_layout(chicago_local_layout)
# 6. Handle special citation commands
# Specific citation insets used in biblatex that need to be reverted to ERT
new_citations = {
"atcite": "atcite",
"atpcite": "atpcite",
"gentextcite": "gentextcite",
"Gentextcite": "Gentextcite",
}
if cetype == "notes":
new_citations = {
"citeyear": "citeyear*",
"Citetitle": "Citetitle",
"Citetitle*": "Citetitle*",
"gentextcite": "gentextcite",
"Gentextcite": "Gentextcite",
"shortcite": "shortcite",
"shortcite*": "shortcite*",
"shortrefcite": "shortrefcite",
"shorthandcite": "shorthandcite",
"shorthandcite*": "shorthandcite*",
"shorthandrefcite": "shorthandrefcite",
"citejournal": "citejournal",
"headlesscite": "headlesscite",
"Headlesscite": "Headlesscite",
"headlessfullcite": "headlessfullcite",
"surnamecite": "surnamecite",
}
i = 0
while True:
i = find_token(document.body, "\\begin_inset CommandInset citation", i)
if i == -1:
break
j = find_end_of_inset(document.body, i)
if j == -1:
document.warning("Can't find end of citation inset at line %d!!" % (i))
i += 1
continue
k = find_token(document.body, "LatexCommand", i, j)
if k == -1:
document.warning("Can't find LatexCommand for citation inset at line %d!" % (i))
i = j + 1
continue
cmd = get_value(document.body, "LatexCommand", k)
if cmd in list(new_citations.keys()):
pre = get_quoted_value(document.body, "before", i, j)
post = get_quoted_value(document.body, "after", i, j)
key = get_quoted_value(document.body, "key", i, j)
if not key:
document.warning("Citation inset at line %d does not have a key!" % (i))
key = "???"
# Replace known new commands with ERT
res = "\\" + new_citations[cmd]
if pre:
res += "[" + pre + "]"
if post:
res += "[" + post + "]"
elif pre:
res += "[]"
res += "{" + key + "}"
document.body[i : j + 1] = put_cmd_in_ert([res])
i = j + 1
## ##
# Conversion hub # Conversion hub
# #
@ -222,10 +384,12 @@ convert = [
[621, [convert_url_escapes, convert_url_escapes2]], [621, [convert_url_escapes, convert_url_escapes2]],
[622, []], [622, []],
[623, [convert_he_letter]], [623, [convert_he_letter]],
[624, [convert_biblatex_chicago]]
] ]
revert = [ revert = [
[623, [revert_biblatex_chicago]],
[622, []], [622, []],
[621, [revert_glue_parskip]], [621, [revert_glue_parskip]],
[620, [revert_url_escapes2, revert_url_escapes]], [620, [revert_url_escapes2, revert_url_escapes]],

View File

@ -2607,6 +2607,15 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
+ encodings.fromLyXName(bib_encoding)->latexName(); + encodings.fromLyXName(bib_encoding)->latexName();
delim = ","; delim = ",";
} }
// biblatex-chicago offers the style options "authordate"
// or "authordate-trad". We use "authordate" if none
// is given via the options field.
if (chicago && citeEngineType() == ENGINE_TYPE_AUTHORYEAR
&& !contains(biblio_opts, "authordate")) {
opts += delim + "authordate";
delim = ",";
}
if (!biblio_opts.empty()) if (!biblio_opts.empty())
opts += delim + biblio_opts; opts += delim + biblio_opts;
if (!opts.empty()) if (!opts.empty())

View File

@ -3157,6 +3157,8 @@ void GuiDocument::checkPossibleCiteEngines()
force_engine = "biblatex"; force_engine = "biblatex";
else if (documentClass().provides("biblatex-natbib")) else if (documentClass().provides("biblatex-natbib"))
force_engine = "biblatex-natbib"; force_engine = "biblatex-natbib";
else if (documentClass().provides("biblatex-chicago"))
force_engine = "biblatex-chicago";
if (!force_engine.empty()) if (!force_engine.empty())
biblioModule->citeEngineCO->setCurrentIndex( biblioModule->citeEngineCO->setCurrentIndex(
@ -3217,7 +3219,18 @@ void GuiDocument::citeEngineChanged(int n)
void GuiDocument::updateEngineDependends() void GuiDocument::updateEngineDependends()
{ {
// These are useful with biblatex, jurabib and natbib
QString const engine =
biblioModule->citeEngineCO->itemData(
biblioModule->citeEngineCO->currentIndex()).toString();
LyXCiteEngine const * ce = theCiteEnginesList[fromqstr(engine)];
bool const biblatex = isBiblatex(); bool const biblatex = isBiblatex();
bool const citepack = biblatex
|| ce->required("jurabib.sty")
|| ce->required("natbib.sty");
biblioModule->citePackageOptionsLE->setEnabled(citepack);
biblioModule->citePackageOptionsL->setEnabled(citepack);
// These are only useful with BibTeX // These are only useful with BibTeX
biblioModule->defaultBiblioCO->setEnabled(!biblatex); biblioModule->defaultBiblioCO->setEnabled(!biblatex);
@ -3225,25 +3238,16 @@ void GuiDocument::updateEngineDependends()
biblioModule->resetDefaultBiblioPB->setEnabled(!biblatex); biblioModule->resetDefaultBiblioPB->setEnabled(!biblatex);
biblioModule->bibtopicCB->setEnabled(!biblatex); biblioModule->bibtopicCB->setEnabled(!biblatex);
// These are only useful with Biblatex // These are only useful with Biblatex (but not with
biblioModule->biblatexBbxCO->setEnabled(biblatex); // biblatex-chicago or maybe other portmanteau packages)
biblioModule->biblatexBbxLA->setEnabled(biblatex); bool const biblatex_pure = biblatex && !ce->required("biblatex-chicago.sty");
biblioModule->biblatexCbxCO->setEnabled(biblatex); biblioModule->biblatexBbxCO->setEnabled(biblatex_pure);
biblioModule->biblatexCbxLA->setEnabled(biblatex); biblioModule->biblatexBbxLA->setEnabled(biblatex_pure);
biblioModule->resetBbxPB->setEnabled(biblatex); biblioModule->biblatexCbxCO->setEnabled(biblatex_pure);
biblioModule->resetCbxPB->setEnabled(biblatex); biblioModule->biblatexCbxLA->setEnabled(biblatex_pure);
biblioModule->matchBbxPB->setEnabled(biblatex); biblioModule->resetBbxPB->setEnabled(biblatex_pure);
biblioModule->resetCbxPB->setEnabled(biblatex_pure);
// These are useful with biblatex, jurabib and natbib biblioModule->matchBbxPB->setEnabled(biblatex_pure);
QString const engine =
biblioModule->citeEngineCO->itemData(
biblioModule->citeEngineCO->currentIndex()).toString();
LyXCiteEngine const * ce = theCiteEnginesList[fromqstr(engine)];
bool const citepack = ce->required("biblatex.sty") || ce->required("jurabib.sty")
|| ce->required("natbib.sty");
biblioModule->citePackageOptionsLE->setEnabled(citepack);
biblioModule->citePackageOptionsL->setEnabled(citepack);
} }

View File

@ -1806,20 +1806,29 @@ void Preamble::handle_package(Parser &p, string const & name,
h_biblio_options = join(options, ","); h_biblio_options = join(options, ",");
} }
else if (name == "biblatex") { else if (name == "biblatex" || name == "biblatex-chicago") {
bool const chicago = name == "biblatex-chicago";
h_biblio_style = "plainnat"; h_biblio_style = "plainnat";
h_cite_engine = "biblatex"; h_cite_engine = "biblatex";
h_cite_engine_type = "authoryear"; h_cite_engine_type = "authoryear";
string opt; string opt;
vector<string>::iterator it = if (chicago) {
find(options.begin(), options.end(), "natbib"); h_cite_engine = "biblatex-chicago";
if (it != options.end()) { vector<string>::iterator it =
options.erase(it); find(options.begin(), options.end(), "authordate");
h_cite_engine = "biblatex-natbib"; if (it == options.end())
h_cite_engine_type = "notes";
} else { } else {
opt = process_keyval_opt(options, "natbib"); vector<string>::iterator it =
if (opt == "true") find(options.begin(), options.end(), "natbib");
if (it != options.end()) {
options.erase(it);
h_cite_engine = "biblatex-natbib"; h_cite_engine = "biblatex-natbib";
} else {
opt = process_keyval_opt(options, "natbib");
if (opt == "true")
h_cite_engine = "biblatex-natbib";
}
} }
opt = process_keyval_opt(options, "style"); opt = process_keyval_opt(options, "style");
if (!opt.empty()) { if (!opt.empty()) {

View File

@ -217,6 +217,14 @@ char const * const known_biblatex_commands[] = { "cite", "Cite", "textcite", "Te
"supercite", "cites", "Cites", "textcites", "Textcites", "parencites", "Parencites", "supercite", "cites", "Cites", "textcites", "Textcites", "parencites", "Parencites",
"smartcites", "Smartcites", "autocites", "Autocites", 0 }; "smartcites", "Smartcites", "autocites", "Autocites", 0 };
/*!
* biblatex-chicago commands.
* Known starred forms: \cite*, \citeauthor*, \Citeauthor*, \parencite*, \citetitle*.
*/
char const * const known_biblatex_chicago_commands[] = { "atcite", "atpcite", "Citetitle", "gentextcite",
"Gentextcite", "shortcite", "shortrefcite", "shorthandcite", "shorthandrefcite",
"citejournal", "headlesscite", "Headlesscite", "headlessfullcite", "surnamecite", 0 };
// Whether we need to insert a bibtex inset in a comment // Whether we need to insert a bibtex inset in a comment
bool need_commentbib = false; bool need_commentbib = false;
@ -3180,7 +3188,9 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
&& preamble.citeEngine() != "biblatex-natbib"; && preamble.citeEngine() != "biblatex-natbib";
bool const use_biblatex_natbib = isProvided("biblatex-natbib") bool const use_biblatex_natbib = isProvided("biblatex-natbib")
|| (isProvided("biblatex") && preamble.citeEngine() == "biblatex-natbib"); || (isProvided("biblatex") && preamble.citeEngine() == "biblatex-natbib");
need_commentbib = use_biblatex || use_biblatex_natbib; bool const use_biblatex_chicago = isProvided("biblatex-chicago")
|| (isProvided("biblatex") && preamble.citeEngine() == "biblatex-chicago");
need_commentbib = use_biblatex || use_biblatex_natbib || use_biblatex_chicago;
string last_env; string last_env;
// it is impossible to determine the correct encoding for non-CJK Japanese. // it is impossible to determine the correct encoding for non-CJK Japanese.
@ -4683,22 +4693,24 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
} }
if ((use_biblatex if ((use_biblatex
&& is_known(t.cs(), known_biblatex_commands) && is_known(t.cs(), known_biblatex_commands)
&& ((t.cs() == "cite" && ((t.cs() == "cite"
|| t.cs() == "citeauthor" || t.cs() == "citeauthor"
|| t.cs() == "Citeauthor" || t.cs() == "Citeauthor"
|| t.cs() == "parencite" || t.cs() == "parencite"
|| t.cs() == "citetitle") || t.cs() == "citetitle")
|| p.next_token().asInput() != "*")) || p.next_token().asInput() != "*"))
|| (use_biblatex_natbib || (use_biblatex_natbib
&& (is_known(t.cs(), known_biblatex_commands) && (is_known(t.cs(), known_biblatex_commands)
|| is_known(t.cs(), known_natbib_commands)) || is_known(t.cs(), known_natbib_commands))
&& ((t.cs() == "cite" || t.cs() == "citet" || t.cs() == "Citet" && ((t.cs() == "cite" || t.cs() == "citet" || t.cs() == "Citet"
|| t.cs() == "citep" || t.cs() == "Citep" || t.cs() == "citealt" || t.cs() == "Citealt" || t.cs() == "citealp" || t.cs() == "Citealp"
|| t.cs() == "Citealt" || t.cs() == "citealp" || t.cs() == "Citealp" || t.cs() == "citeauthor" || t.cs() == "Citeauthor"
|| t.cs() == "citeauthor" || t.cs() == "Citeauthor" || t.cs() == "parencite" || t.cs() == "citetitle")
|| t.cs() == "parencite" || t.cs() == "citetitle") || p.next_token().asInput() != "*"))
|| p.next_token().asInput() != "*"))){ || (use_biblatex_chicago
&& (is_known(t.cs(), known_biblatex_commands)
|| is_known(t.cs(), known_biblatex_chicago_commands)))){
context.check_layout(os); context.check_layout(os);
string command = t.cs(); string command = t.cs();
if (p.next_token().asInput() == "*") { if (p.next_token().asInput() == "*") {
@ -4856,10 +4868,14 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
end_inset(os); end_inset(os);
// Need to set the cite engine if biblatex is loaded by // Need to set the cite engine if biblatex is loaded by
// the document class directly // the document class directly
if (preamble.citeEngine() == "basic") if (preamble.citeEngine() == "basic") {
use_biblatex_natbib ? if (use_biblatex_natbib)
preamble.citeEngine("biblatex-natbib") preamble.citeEngine("biblatex-natbib");
: preamble.citeEngine("biblatex"); else if (use_biblatex_chicago)
preamble.citeEngine("biblatex-chicago");
else
preamble.citeEngine("biblatex");
}
continue; continue;
} }

View File

@ -32,8 +32,8 @@ extern char const * const lyx_version_info;
// Do not remove the comment below, so we get merge conflict in // Do not remove the comment below, so we get merge conflict in
// independent branches. Instead add your own. // independent branches. Instead add your own.
#define LYX_FORMAT_LYX 623 // ufogiel: remove hebrew letter #define LYX_FORMAT_LYX 624 // spitz: support biblatex-chicago
#define LYX_FORMAT_TEX2LYX 623 #define LYX_FORMAT_TEX2LYX 624
#if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX #if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX
#ifndef _MSC_VER #ifndef _MSC_VER