借助条目langid
中的字段.bib
,该biblatex
包可以用自己的语言格式化每个书目参考。
如果我添加backref=true
到选项中biblatex
,则每个引用的结尾都会有反向引用。
但是每个反向引用都使用引用的语言而不是当前语言。
以下是 MWE:
\documentclass{article}
\usepackage{filecontents}
\usepackage[paper=a5paper,hmargin=5mm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[french,american]{babel}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead{}
\fancyfoot{}
\fancyhead[C]{\thepage}
\begin{filecontents*}{\jobname.bib}
@book{dupont-2018,
author = {Dupont, Jean and Dupond, Pierre},
title = {Ce livre: un livre en français},
year = 2018,
langid = {french}
}
@book{doe-2017,
Author = {Doe, John and Doe, Jerry},
title = {This book: an american book},
Year = 2017,
langid = {american}
}
\end{filecontents*}
\usepackage[
bibencoding=auto,
backend=biber,
backref=true,
language=auto,
autolang=other,
style=authoryear,
]{biblatex}
\usepackage{csquotes}
\usepackage{hyperref}
\addbibresource{\jobname.bib}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\begin{document}
\section{American/Américain section}
Some citations: \cite{dupont-2018,doe-2017}.
\printbibliographybibliographic
\newpage
\begin{otherlanguage}{french}
\section{Section en Français}
Quelques citations: \cite{dupont-2018,doe-2017}.
\printbibliography
\end{otherlanguage}
\end{document}
第一页
第一页是美文。法文书名(“本书:一本法语书”)是用法语写的(“:”前有一个空格)。美国书名(“本书:一本美国书“) 是用美式英语写的(“:”之前没有空格)。
但所有反向引用都应该用美式英语,如“(cit. on pp. ??)”。
第二页
第二页是法文。法文书名(“本书:一本法语书”)是用法语写的(“:”前有一个空格)。美国书名(“本书:一本美国书“) 是用美式英语写的(“:”之前没有空格)。
但所有反向引用都应使用法语,如“(cf. p. ??)”。
我的问题
如何指定书目参考文献中的反向引用必须使用当前语言(而不是书目参考文献的语言)?
答案1
我们可以尝试记住参考书目开头使用的语言,然后恢复该语言以打印后面的参考资料。
该命令\biblang
的定义类似于\mainlang
并且可用于排版参考书目周围语言的文本。
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[french,american]{babel}
\usepackage{csquotes}
\usepackage[
backend=biber,
style=authoryear,
language=auto, autolang=other,
backref=true,
]{biblatex}
\usepackage{hyperref}
\makeatletter
\newcommand*{\blx@biblangname}{\bbl@main@language}
\AtBeginBibliography{%
\edef\blx@biblangname{\languagename}%
}
\newcommand*{\biblang}{%
\select@language{\blx@biblangname}}
\DeclareFieldFormat{parens:biblang}{%
\mkbibparens{\biblang{#1}}}
\renewbibmacro*{pageref}{%
\iflistundef{pageref}
{}
{\printtext[parens:biblang]{%
\ifnumgreater{\value{pageref}}{1}
{\bibstring{backrefpages}\ppspace}
{\bibstring{backrefpage}\ppspace}%
\printlist[pageref][-\value{listtotal}]{pageref}}}}
\makeatother
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@book{dupont-2018,
author = {Dupont, Jean and Dupond, Pierre},
title = {Ce livre: un livre en français},
year = 2018,
langid = {french},
}
@book{doe-2017,
author = {Doe, John and Doe, Jerry},
title = {This book: an american book},
year = 2017,
langid = {american}
}
\end{filecontents*}
\addbibresource{\jobname.bib}
\begin{document}
\section{American/Américain section}
Some citations: \cite{dupont-2018,doe-2017}.
\printbibliography
\newpage
\begin{otherlanguage}{french}
\section{Section en Français}
Quelques citations: \cite{dupont-2018,doe-2017}.
\printbibliography
\end{otherlanguage}
\end{document}
答案2
这是一个糟糕的临时解决方案,但确实有效。当然,前提是你只有美国和法国部分。
\documentclass{article}
\usepackage{filecontents}
\usepackage[paper=a5paper,hmargin=5mm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[french,american]{babel}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead{}
\fancyfoot{}
\fancyhead[C]{\thepage}
\begin{filecontents*}{\jobname.bib}
@book{dupont-2018,
author = {Dupont, Jean and Dupond, Pierre},
title = {Ce livre: un livre en français},
year = 2018,
langid = {french}
}
@book{doe-2017,
Author = {Doe, John and Doe, Jerry},
title = {This book: an american book},
Year = 2017,
langid = {american}
}
\end{filecontents*}
\usepackage[
bibencoding=auto,
backend=biber,
backref=true,
language=auto,
autolang=other,
style=authoryear,
]{biblatex}
\usepackage{csquotes}
\usepackage{hyperref}
\addbibresource{\jobname.bib}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\newif\iffrenchsec
\renewbibmacro*{pageref}{%
\iflistundef{pageref}
{}
{\printtext[parens]{%
\ifnumgreater{\value{pageref}}{1}
{\iffrenchsec
cf\adddotspace p\adddot
\else
cit\adddotspace on pp\adddot
\fi
\ppspace}
{\iffrenchsec
cf\adddotspace p\adddot
\else
cit\adddotspace on p\adddot
\fi
\ppspace}%
\printlist[pageref][-\value{listtotal}]{pageref}}}}
\begin{document}
\section{American/Américain section}
Some citations: \cite{dupont-2018,doe-2017}.
\printbibliography
\newpage
\begin{otherlanguage}{french}
\frenchsectrue
\section{Section en Français}
Quelques citations: \cite{dupont-2018,doe-2017}.
\printbibliography
\frenchsecfalse
\end{otherlanguage}
\end{document}