在上一个主题中 (Biblatex 作者年份用括号括起来,年份用圆括号括起来),有人问如何在使用authoryear
引用时将年份放在括号中biblatex
。当我将解决方案应用到我的代码中时,每个标签与下一个标签之间没有空格
解决这个问题的一种方法是修改上一个问题中的代码,将其包含;<space>
在命令之后\usebibmacro{cite:shorthand}}
(参见原始问题)。这基本上解决了这个问题
我需要做的最后一件事是删除最后一个分隔符,因为它不应该存在,因为它附加在最后一个标签上。
\begin{filecontents*}{sample.bib}
@ARTICLE{wu2017,
title={{Assessing Impact of Renewable Energy Integration on System Strength Using Site-Dependent Short Circuit Ratio}},
author={Wu, Di and Li, Gangan and Javadi, Milad and Malyscheff, Alexander M and Hong, Mingguo and Jiang, John Ning},
journal={IEEE Transactions on Sustainable Energy},
year={2017},
publisher={IEEE}
}
@article{wu2019method,
title={A method to identify weak points of interconnection of renewable energy resources},
author={Wu, Di and Aldaoudeyeh, Al~Motasem and Javadi, Milad and Ma, Feng and Tan, Jin and Jiang, John N and others},
journal={International Journal of Electrical Power \& Energy Systems},
volume={110},
pages={72--82},
year={2019},
publisher={Elsevier}
}
@INPROCEEDINGS{zhu2015,
author={Y. Zhu and D. Brown},
booktitle={2015 IEEE Power Energy Society General Meeting},
title={{Prepare to meet the challenges in regional transmission planning and development}},
year={2015},
volume={},
number={},
pages={1-5},
keywords={hydroelectric power;investment;power grids;power transmission economics;power transmission planning;power transmission reliability;regional planning;wind power;economical benefit analysis;federal right of first refusal removal;hydro power export;regional cost allocation;regional transmission development;regional transmission planning;system reliability enhancement;transmission investment;weak grid;wind energy delivery;wind energy energy export;Economics;HVDC transmission;Planning;Reactive power;Reliability;Voltage control;Wind farms;Competition;Economic Analysis;FERC Order 1000;Project Screening;Project Selection;ROFR;Regional Transmission Planning;Reliability Analysis;Renewable Energy;Transfer Limit;Weak Grid},
doi={10.1109/PESGM.2015.7286306},
ISSN={1932-5517},
month={July},
}
@inproceedings{lorenzen2016,
title={{Control of a grid connected converter during weak grid conditions}},
author={Lorenzen, S{\o}ren Lund and Nielsen, Alex Buus and Bede, Lorand},
booktitle={Power Electronics for Distributed Generation Systems (PEDG), 2016 IEEE 7th International Symposium on},
pages={1--6},
year={2016},
organization={IEEE}
}
@inproceedings{manjure2001,
title={{Steady state stability assessment using the bus impedance matrix}},
author={Manjure, DP and Makram, EB},
booktitle={Power Engineering, 2001. LESCOPE'01. 2001 Large Engineering Systems Conference on},
pages={153--157},
year={2001},
organization={IEEE}
}
\end{filecontents*}
\documentclass{book}
\usepackage[x11names]{xcolor}
\usepackage{hyperref}
\hypersetup{citecolor=DodgerBlue3, citebordercolor=DodgerBlue3, colorlinks=true}
\usepackage[style=authoryear-comp]{biblatex}
\addbibresource{sample.bib}
\makeatletter
\newrobustcmd*{\parentexttrack}[1]{%
\begingroup
\blx@blxinit
\blx@setsfcodes
\blx@bibopenparen#1\blx@bibcloseparen
\endgroup}
\AtEveryCite{%
\let\parentext=\parentexttrack%
\let\bibopenparen=\bibopenbracket%
\let\bibcloseparen=\bibclosebracket}
\renewbibmacro*{cite}{%
\iffieldundef{shorthand}
{\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
{\usebibmacro{cite:label}%
\setunit{\addspace}}
{\printnames{labelname}%
\setunit{\nameyeardelim}}%
% \usebibmacro{cite:labelyear+extrayear}}% DELETED
\printtext[parens]{\usebibmacro{cite:labelyear+extrayear}}}% ADDED
{\usebibmacro{cite:shorthand}}}
\makeatother
\begin{document}
\cite{wu2017,wu2019method}
\cite{zhu2015,lorenzen2016,manjure2001}
\printbibliography
\end{document}
答案1
这是我写的作业之一biblatex-ext
对于。与
\DeclareInnerCiteDelims{textcite}{\bibopenbracket}{\bibclosebracket}
您可以告诉\textcite
您使用方括号而不是圆括号来表示年份。您只需加载ext-
样式的版本,因此您将加载style=ext-authoryear-comp
而不是style=authoryear-comp
。其他所有内容将保持原样。
我从中复制了\autocite
–映射\textcite
David Purton 的回答。
\documentclass{article}
\usepackage[style=ext-authoryear-comp]{biblatex}
\DeclareAutoCiteCommand{textcite}{\textcite}{\textcites}
\ExecuteBibliographyOptions{autocite=textcite}
\DeclareInnerCiteDelims{textcite}{\bibopenbracket}{\bibclosebracket}
\addbibresource{biblatex-examples.bib}
\begin{document}
\autocite{knuth:ct:a,knuth:ct:b}
\autocite{knuth:ct:a,worman,sigfridsson}
\printbibliography
\end{document}
当然biblatex-ext
也允许您\cite
直接更改,但我避免这样做,因为我相信您想要的输出更像\textcite
。
\DeclareInnerCiteDelims{cite}{\bibopenbracket}{\bibclosebracket}
\textcite
和之间在后注和前注以及引用分隔符的位置上有细微的差别\cite
。
答案2
您的麻烦来自于宏与有cite
一点不同。authoryear-comp
authoryear
这也使得在年份周围加上括号变得更加复杂,因为它们可能会被压缩。
我建议利用\textcite
并修补textcite
宏以使用括号而不是圆括号。(根据您确切的需求,可能有多种方法可以做到这一点。)
要将使用的分隔符设置\textcite
为分号,请使用\renewcommand*{\textcitedelim}{\addsemicolon\space}
为了使其成为默认设置,但仍允许灵活地更改样式,我建议您添加一个autocite
指向textcite
并\autocite
在任何地方使用的样式,然后可以轻松地在全球范围内更改它。
平均能量损失
\RequirePackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{wu2018,
title={Assessing Impact of Renewable Energy Integration on System Strength Using Site-Dependent Short Circuit Ratio},
author={Wu, Di and Li, Gangan and Javadi, Milad and Malyscheff, Alexander M and Hong, Mingguo and Jiang, John Ning},
journaltitle={IEEE Transactions on Sustainable Energy},
date={2018}
}
@article{wu2017,
title={Assessing Impact of Renewable Energy Integration on System Strength Using Site-Dependent Short Circuit Ratio},
author={Wu, Di and Li, Gangan and Javadi, Milad and Malyscheff, Alexander M and Hong, Mingguo and Jiang, John Ning},
journaltitle={IEEE Transactions on Sustainable Energy},
date={2017}
}
@article{wu2019method,
title={A method to identify weak points of interconnection of renewable energy resources},
author={Wu, Di and Aldaoudeyeh, Al~Motasem and Javadi, Milad and Ma, Feng and Tan, Jin and Jiang, John N and others},
journaltitle={International Journal of Electrical Power \& Energy Systems},
volume={110},
pages={72-82},
date={2019},
}
@inproceedings{zhu2015,
author={Y. Zhu and D. Brown},
booktitle={2015 IEEE Power Energy Society General Meeting},
title={Prepare to Meet the Challenges in Regional Transmission Planning and Development},
date={2015},
pages={1-5},
doi={10.1109/PESGM.2015.7286306},
ISSN={1932-5517},
month={July}
}
@inproceedings{lorenzen2016,
title={Control of a Grid Connected Converter During Weak Grid Conditions},
author={Lorenzen, Søren Lund and Nielsen, Alex Buus and Bede, Lorand},
booktitle={Power Electronics for Distributed Generation Systems (PEDG), 2016 IEEE 7th International Symposium on},
pages={1-6},
date={2016},
organization={IEEE}
}
@inproceedings{manjure2001,
title={Steady State Stability Assessment Using the Bus Impedance Matrix},
author={Manjure, DP and Makram, EB},
booktitle={Power Engineering, 2001. LESCOPE'01. 2001 Large Engineering Systems Conference on},
pages={153-157},
date={2001},
organization={IEEE}
}
\end{filecontents}
\documentclass{article}
\usepackage[style=authoryear-comp]{biblatex}
\addbibresource{\jobname.bib}
\DeclareAutoCiteCommand{textcite}{\textcite}{\textcites}
\ExecuteBibliographyOptions{autocite=textcite}
% You need to patch in a few places
\usepackage{xpatch}
\renewcommand*{\textcitedelim}{\addsemicolon\space}
\xpatchbibmacro{textcite}
{\bibopenparen}
{\bibopenbracket}
{}
{}
\xpatchbibmacro{textcite}
{\bibcloseparen}
{\bibclosebracket}
{}
{}
\xpatchbibmacro{textcite}
{\bibopenparen}
{\bibopenbracket}
{}
{}
\renewbibmacro*{textcite:postnote}{%
\usebibmacro{postnote}%
\ifthenelse{\value{multicitecount}=\value{multicitetotal}}
{\setunit{}%
\printtext{%
\ifbool{cbx:parens}
{\bibclosebracket\global\boolfalse{cbx:parens}}
{}}}
{\setunit{%
\ifbool{cbx:parens}
{\bibclosebracket\global\boolfalse{cbx:parens}}
{}%
\textcitedelim}}}
\begin{document}
\autocite{wu2017,wu2018}
\autocite{wu2017,wu2019method}
\autocite{zhu2015,lorenzen2016,manjure2001}
\end{document}