Biblatex:\parencite、\cite 和 \textcite 中的连词翻译

Biblatex:\parencite、\cite 和 \textcite 中的连词翻译

我正在使用 Biblatex 和 Babel。我试图根据我提供的语言打印和的\parencite翻译连词。由于原因太长无法解释,我无法为 biblatex 包定义特定。\cite\textcitelangidstyle=

这是我正在测试的文档:

\documentclass{article}
\usepackage[letterpaper,margin=2cm]{geometry}
\usepackage{lipsum}
\usepackage[colorlinks=true, allcolors=blue]{hyperref}

\usepackage[english, main=italian, german]{babel}
\selectlanguage{italian}

\usepackage[autostyle]{csquotes} 
\setquotestyle{english} 

\usepackage[backend=biber,
natbib=true,
citestyle=authoryear-icomp,
bibstyle=authoryear-icomp,
ibidpage=true,
dashed=true,
pagetracker=false,
maxbibnames=4,
maxcitenames=2,
autolang=other
]{biblatex}
\addbibresource{sample.bib}

\DeclareQuoteStyle{english}%
    {\textquotedblleft}
    [\textquotedblleft]
    {\textquotedblright}
        [0.05em]
    {\textquoteleft}
    [\textquoteleft]
    {\textquoteright}
\DeclareQuoteStyle{german}%
    {\textquotedblleft}
    [\textquotedblleft]
    {\textquotedblright}
        [0.05em]
    {\textquoteleft}
    [\textquoteleft]
    {\textquoteright}
\DeclareQuoteStyle{italian}%
    {\textquotedblleft}
    [\textquotedblleft]
    {\textquotedblright}
        [0.05em]
    {\textquoteleft}
    [\textquoteleft]
    {\textquoteright}

\begin{document}
\section{Tutorial LaTeX}

\lipsum[1-4]

\parencite{greenwade93} \cite{greenwade93} \textcite{greenwade93}

\parencite{gurlami1943} \cite{gurlami1943} \textcite{gurlami1943}

\parencite{landa1943} \cite{landa1943} \textcite{landa1943}


\printbibliography[heading=bibintoc, title={Bibliografia}]
\nocite{*}

\end{document}

考虑这三个 bib 条目,我已经清楚地区分了它们的语言......

@article{greenwade93,
    author  = "George Greenwade and Bob Jordan",
    title   = "The {C}omprehensive {T}ex {A}rchive {N}etwork ({CTAN})",
    year    = "1993",
    journal = "TUGBoat",
    volume  = "14",
    number  = "3",
    pages   = "342-351",
    langid = "english",
}

@article{gurlami1943,
    author  = "Enzo Gurlami and Dominic DeCocco",
    title   = "How to sneak into parties",
    year    = "1943",
    journal = "Scalps",
    volume  = "14",
    number  = "3",
    pages   = "342-351",
    langid = "italian",
}

@article{landa1943,
    author  = "Hans Landa and King Schultz",
    title   = "How to be an actor",
    year    = "1943",
    journal = "The Hateful Eight",
    volume  = "14",
    number  = "3",
    pages   = "100-3901",
    langid = "german",
}

...结果是一样的——使用的连词始终是意大利语“e”: 为什么

如果我尝试自己修复该问题,结果会令人厌恶,并且每个连词都会被添加*,无论定义的语言是什么(*即使在参考书目中,这也是我不需要的)。我做错了什么?

\DeclareDelimFormat{finalnamedelim}{%
  \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}%
  \iffieldannotation{langid}{english}{\addspace\printtext{and}\space}{}%
  \iffieldannotation{langid}{italian}{\addspace\printtext{e}\space}{}%
  \iffieldannotation{langid}{german}{\addspace\printtext{und}\space}{}%
}

答案1

好吧,我不确定我是否喜欢这样,毕竟文本是意大利语,但这里应该可以

\DeclareNameWrapperFormat{labelname}{%
  \iffieldundef{langid}{#1}{\foreignlanguage[captions]{\thefield{langid}}{#1}}}

在此处输入图片描述

答案2

默认设置autolang仅适用于参考书目,而\cite命令则以周围语言排版。您可以使用language选项(其默认值为autobib)以引用作品的语言排版参考书目条目和引文(设置language=auto,)。请注意,这不仅会影响“and”:它会更改整个本地化,因此在示例中它还会影响“ibid”。

\documentclass{article}
\usepackage[letterpaper,margin=2cm]{geometry}
\usepackage{lipsum}
\usepackage[colorlinks=true, allcolors=blue]{hyperref}

\usepackage[english, main=italian, german]{babel}
\selectlanguage{italian}

\usepackage[autostyle]{csquotes} 
\setquotestyle{english} 

\usepackage[
  backend=biber,
  natbib=true,
  style=authoryear-icomp,
  ibidpage=true,
  dashed=true,
  pagetracker=false,
  maxbibnames=4,
  maxcitenames=2,
  language=auto,
  autolang=other,
]{biblatex}


\DeclareQuoteStyle{english}%
    {\textquotedblleft}
    [\textquotedblleft]
    {\textquotedblright}
        [0.05em]
    {\textquoteleft}
    [\textquoteleft]
    {\textquoteright}
\DeclareQuoteStyle{german}%
    {\textquotedblleft}
    [\textquotedblleft]
    {\textquotedblright}
        [0.05em]
    {\textquoteleft}
    [\textquoteleft]
    {\textquoteright}
\DeclareQuoteStyle{italian}%
    {\textquotedblleft}
    [\textquotedblleft]
    {\textquotedblright}
        [0.05em]
    {\textquoteleft}
    [\textquoteleft]
    {\textquoteright}

\begin{filecontents}{\jobname.bib}
@article{greenwade93,
    author  = "George Greenwade and Bob Jordan",
    title   = "The {C}omprehensive {T}ex {A}rchive {N}etwork ({CTAN})",
    year    = "1993",
    journal = "TUGBoat",
    volume  = "14",
    number  = "3",
    pages   = "342-351",
    langid = "english",
}
@article{gurlami1943,
    author  = "Enzo Gurlami and Dominic DeCocco",
    title   = "How to sneak into parties",
    year    = "1943",
    journal = "Scalps",
    volume  = "14",
    number  = "3",
    pages   = "342-351",
    langid = "italian",
}
@article{landa1943,
    author  = "Hans Landa and King Schultz",
    title   = "How to be an actor",
    year    = "1943",
    journal = "The Hateful Eight",
    volume  = "14",
    number  = "3",
    pages   = "100-3901",
    langid = "german",
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
\section{Tutorial LaTeX}

\lipsum[1-4]

\parencite{greenwade93} \cite{greenwade93} \textcite{greenwade93}

\parencite{gurlami1943} \cite{gurlami1943} \textcite{gurlami1943}

\parencite{landa1943} \cite{landa1943} \textcite{landa1943}


\printbibliography[heading=bibintoc, title={Bibliografia}]
\nocite{*}

\end{document}

(Greenwade and Jordan,1993)同上。Greenwade and Jordan(同上)(Gurlami e DeCocco,1943)同上。Gurlami e DeCocco(同上)(Landa und Schultz,1943)引自 Landa und Schultz(引自)

相关内容