Closed TomBener closed 7 months ago
主要是gb7714-2015ay没有调整parencites所导致的,调整一下就可好了:
\DeclareMultiCiteCommand{\parencites}{\parencite}{\multicitedelim}
比如:
\documentclass{article}
\usepackage{ctex}
\usepackage[backend=biber, style=gb7714-2015ay]{biblatex}
\DeclareMultiCiteCommand{\parencites}{\parencite}{\multicitedelim}
\begin{filecontents}[force,noheader]{\jobname.bib}
@book{hickman2016,
title = {Space {{Is Power}}: {{The Seven Rules}} of {{Territory}}},
author = {Hickman, John},
date = {2016},
publisher = {Lexington Books},
location = {Lanham}
}
@book{latham2000,
title = {Modernization as {{Ideology}}: {{American Social Science}} and “{{Nation Building}}” in the {{Kennedy Era}}},
author = {Latham, Michael E.},
date = {2000-05-15},
publisher = {The University of North Carolina Press},
location = {Chapel Hill}
}
@book{guoshuanglin2006,
title = {中国近代史读本(下册)},
author = {{郭双林}},
editor = {{王续添}},
date = {2006-07},
publisher = {北京大学出版社},
location = {北京}
}
@book{aimaniuaier2007,
title = {蒙塔尤:1294–1324年奥克西坦尼的一个山村},
author = {埃马纽埃尔·勒华拉杜里},
translator = {许明龙 and 马胜利},
date = {2007-05},
publisher = {商务印书馆},
location = {北京}
}
@book{guojianlong2017,
title = {中央帝国的财政密码},
author = {{郭建龙}},
date = {2017-04},
publisher = {鹭江出版社},
location = {厦门}
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
单个行内引用 \autocite[1-3]{guojianlong2017}。
多个引用\autocites[85]{latham2000}[2]{guoshuanglin2006}[10--20]{aimaniuaier2007},以及
单个行内引用 \textcite[20, 100]{hickman2016}
多个引用 \textcites[85]{latham2000}[2]{guoshuanglin2006}[10--20]{aimaniuaier2007},
\printbibliography[heading=bibliography]
\end{document}
结果为:
或者:
\documentclass{article}
\usepackage{ctex}
\usepackage[backend=biber, style=gb7714-2015ay]{biblatex}
\DeclareCiteCommand{\parencite}[\mkbibparens]%
{\usebibmacro{cite:init}%
\usebibmacro{prenote}}%
{\usebibmacro{citeindex}%
\usebibmacro{cite}}
{}
{\usebibmacro{postnote}}
\begin{filecontents}[force,noheader]{\jobname.bib}
@book{hickman2016,
title = {Space {{Is Power}}: {{The Seven Rules}} of {{Territory}}},
author = {Hickman, John},
date = {2016},
publisher = {Lexington Books},
location = {Lanham}
}
@book{latham2000,
title = {Modernization as {{Ideology}}: {{American Social Science}} and “{{Nation Building}}” in the {{Kennedy Era}}},
author = {Latham, Michael E.},
date = {2000-05-15},
publisher = {The University of North Carolina Press},
location = {Chapel Hill}
}
@book{guoshuanglin2006,
title = {中国近代史读本(下册)},
author = {{郭双林}},
editor = {{王续添}},
date = {2006-07},
publisher = {北京大学出版社},
location = {北京}
}
@book{aimaniuaier2007,
title = {蒙塔尤:1294–1324年奥克西坦尼的一个山村},
author = {埃马纽埃尔·勒华拉杜里},
translator = {许明龙 and 马胜利},
date = {2007-05},
publisher = {商务印书馆},
location = {北京}
}
@book{guojianlong2017,
title = {中央帝国的财政密码},
author = {{郭建龙}},
date = {2017-04},
publisher = {鹭江出版社},
location = {厦门}
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
单个行内引用 \autocite[1-3]{guojianlong2017}。
多个引用\autocites[85]{latham2000}[2]{guoshuanglin2006}[10--20]{aimaniuaier2007}
单个行内引用 \textcite[20, 100]{hickman2016}
多个引用 \textcites[85]{latham2000}[2]{guoshuanglin2006}[10--20]{aimaniuaier2007},
\printbibliography[heading=bibliography]
\end{document}
结果为:
你看需要选择即可。
里面的有个book,除了author还有editor,简单处理,可以看下面的例子:
\documentclass{article}
\usepackage{ctex}
\usepackage[backend=biber, style=gb7714-2015ay]{biblatex}
\DeclareCiteCommand{\parencite}[\mkbibparens]%
{\usebibmacro{cite:init}%
\usebibmacro{prenote}}%
{\usebibmacro{citeindex}%
\usebibmacro{cite}}
{}
{\usebibmacro{postnote}}
\DefineBibliographyStrings{english}{
byeditor={\iffieldequalstr{userd}{chinese}{编}{Ed. by}}
}
\newbibmacro*{byeditor+others}{%
\ifnameundef{editor}
{}
{\iffieldequalstr{userd}{chinese}{}{\usebibmacro{byeditor+othersstrg}%
\setunit{\addspace}}%
\printnames[byeditor]{editor}%
\iffieldequalstr{userd}{chinese}{\usebibmacro{byeditor+othersstrg}}{}%
\clearname{editor}%
\newunit}%
\usebibmacro{byeditorx}%
\usebibmacro{bytranslator+others}}
\begin{filecontents}[force,noheader]{\jobname.bib}
@book{hickman2016,
title = {Space {{Is Power}}: {{The Seven Rules}} of {{Territory}}},
author = {Hickman, John},
editor={Latham, Michael E.},
date = {2016},
publisher = {Lexington Books},
location = {Lanham}
}
@book{latham2000,
title = {Modernization as {{Ideology}}: {{American Social Science}} and “{{Nation Building}}” in the {{Kennedy Era}}},
author = {Latham, Michael E.},
date = {2000-05-15},
publisher = {The University of North Carolina Press},
location = {Chapel Hill}
}
@book{guoshuanglin2006,
title = {中国近代史读本(下册)},
author = {{郭双林}},
editor = {{王续添}},
date = {2006-07},
publisher = {北京大学出版社},
location = {北京}
}
@book{aimaniuaier2007,
title = {蒙塔尤:1294–1324年奥克西坦尼的一个山村},
author = {埃马纽埃尔·勒华拉杜里},
translator = {许明龙 and 马胜利},
date = {2007-05},
publisher = {商务印书馆},
location = {北京}
}
@book{guojianlong2017,
title = {中央帝国的财政密码},
author = {{郭建龙}},
date = {2017-04},
publisher = {鹭江出版社},
location = {厦门}
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
单个行内引用 \autocite[1-3]{guojianlong2017}。
多个引用\autocites[85]{latham2000}[2]{guoshuanglin2006}[10--20]{aimaniuaier2007}
单个行内引用 \textcite[20, 100]{hickman2016}
多个引用 \textcites[85]{latham2000}[2]{guoshuanglin2006}[10--20]{aimaniuaier2007},
\printbibliography[heading=bibliography]
\end{document}
结果为:
\DeclareCiteCommand{\parencite}[\mkbibparens]% {\usebibmacro{cite:init}% \usebibmacro{prenote}}% {\usebibmacro{citeindex}% \usebibmacro{cite}} {} {\usebibmacro{postnote}}
\DefineBibliographyStrings{english}{ byeditor={\iffieldequalstr{userd}{chinese}{编}{Ed. by}} }
\newbibmacro*{byeditor+others}{% \ifnameundef{editor} {} {\iffieldequalstr{userd}{chinese}{}{\usebibmacro{byeditor+othersstrg}% \setunit{\addspace}}% \printnames[byeditor]{editor}% \iffieldequalstr{userd}{chinese}{\usebibmacro{byeditor+othersstrg}}{}% \clearname{editor}% \newunit}% \usebibmacro{byeditorx}% \usebibmacro{bytranslator+others}}
感谢回复,我加上了这段代码,确实没有了多余的括号。但是还有一个关于页码连接符号的问题,通过以上 biblatex-gb7714-2015
生成的 PDF 中,连接页码的符号是 hyphen,比如 埃马纽埃尔·勒华拉杜里, 2007, pp. 10-20
,而不是采用 biblatex
时的 en-dash,即 埃马纽埃尔·勒华拉杜里, 2007, pp. 10–20
。
加上
\DefineBibliographyExtras{english}{\renewcommand*{\bibrangedash}{{\textendash}}}
可以了,非常感谢!
请问上面这个 \autocites
的设置可以更新到宏包的默认设置中吗?在某些情况,比如使用 Quarto 自定义 LaTeX 代码不是很方便,感谢!
可以,今天更新一下。
@hushidong 感谢!
已更新,ctan需要两三天后才能通告。 要现在就用的话,你可以直接在github上下载bbx/cbx文件替代你系统中texlive里面的就可以了。
更新了,非常感谢。
不过现在出现了一个新问题,如下图红色标注所示,某些引用与正文之间缺少一个空格,之前的版本不存在这样的问题,可以修复一下吗?另外页码连接符号看起来像是 hyphen -
而不是 en-dash –
,是因为没有更新吗?
MWE:
\documentclass{article}
\usepackage{ctex}
\usepackage[backend=biber, style=gb7714-2015ay]{biblatex}
\begin{filecontents}[force,noheader]{\jobname.bib}
@book{hickman2016,
title = {Space {{Is Power}}: {{The Seven Rules}} of {{Territory}}},
author = {Hickman, John},
date = {2016},
publisher = {Lexington Books},
location = {Lanham}
}
@book{latham2000,
title = {Modernization as {{Ideology}}: {{American Social Science}} and “{{Nation Building}}” in the {{Kennedy Era}}},
author = {Latham, Michael E.},
date = {2000-05-15},
publisher = {The University of North Carolina Press},
location = {Chapel Hill}
}
@book{guoshuanglin2006,
title = {中国近代史读本(下册)},
author = {{郭双林}},
editor = {{王续添}},
date = {2006-07},
publisher = {北京大学出版社},
location = {北京}
}
@book{aimaniuaier2007,
title = {蒙塔尤:1294–1324年奥克西坦尼的一个山村},
author = {埃马纽埃尔·勒华拉杜里},
translator = {许明龙 and 马胜利},
date = {2007-05},
publisher = {商务印书馆},
location = {北京}
}
@book{guojianlong2017,
title = {中央帝国的财政密码},
author = {{郭建龙}},
date = {2017-04},
publisher = {鹭江出版社},
location = {厦门}
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
The United Nations invites each person of any age, plus every classroom
\textcite[20, 100]{hickman2016},
business and government to join in celebration of the International Day of Happiness
\autocite[85]{latham2000}.
联合国邀请无论男女老少的每一个人
\autocites[85]{latham2000}[2]{guoshuanglin2006}[10--20]{aimaniuaier2007}
一同庆祝国际幸福日
\autocite[85]{latham2000},
以及每个课堂、每家企业、每个政府
\autocite[1-3]{guojianlong2017}。
\printbibliography[heading=bibliography]
\end{document}
已更新,github上的你下载覆盖一下就好了。
昨天多放了一个unspace。
好的,没问题了,非常感谢!
问题描述
通过 Pandoc 从 Markdown 转换到 LaTeX 并使用
biblatex-gb7714-2015
宏包(样式设置为gb7714-2015ay
)时,\autocites
命令生成的多重引用中出现了不需要的额外括号。这个问题在直接使用biblatex
宏包时没有出现。复现步骤
biblatex-gb7714-2015
宏包时的 LaTeX 代码:biblatex
默认authoryear
样式时的 LaTeX 代码(作为对照):预期行为
即使是在经过 Pandoc 转换的 LaTeX 文档中,使用
biblatex-gb7714-2015
宏包时,\autocites
生成的多重引用也应该避免包含多余的括号,与直接使用biblatex
的authoryear
样式时相一致。实际行为
使用
biblatex-gb7714-2015
时,输出结果包含了多余的括号:相比之下,使用
biblatex
默认authoryear
样式时则没有此问题。由于 Pandoc 默认转换多重引用为
\autocites
命令,不方便直接修改 LaTeX 代码,请问该怎么解决这个问题?谢谢!