我已经使用作者年份 APA 格式一段时间了。然而,数字样式参考列表看起来很整洁。
问题是数字\citep{}
只在括号中显示 [数字]。所以我想知道如何扭曲数字引用样式,例如:
\cite[Johnson:2013]
----> Johnson 等人 [19](\textcite{}
可以做这项工作)
\citep[Johnson:2013]
---->(约翰逊等人[19])
如何创建新命令\textcitep{}
来实现第二种风格?
\usepackage[
style=numeric,
backend=biber,
refsection=chapter,
uniquename=true,
uniquelist=false,
maxcitenames=2,
natbib=true ]{biblatex}
答案1
给你:
\documentclass{report}
\usepackage[
style=numeric,
backend=biber,
refsection=chapter,
uniquename=true,
uniquelist=false,
maxcitenames=2,
natbib=true ]{biblatex}
\addbibresource{biblatex-examples.bib}
\newcommand\textcitep[1]{\mkbibparens{\textcite{#1}}}
\newcommand\textcitesp[1]{\mkbibparens{\textcites{#1}}}
\begin{document}
Text \textcitesp{knuth:ct:c, companion}. See also \textcitep{knuth:ct:d}
\printbibliography
\end{document}
答案2
我们可以很容易地重新定义\textcite
( s
) 并将其括在括号中,方法是
\makeatletter
\DeclareCiteCommand{\cbx@textcite}[\mkbibparens]
{\usebibmacro{textcite:init}}
{\usebibmacro{citeindex}%
\usebibmacro{textcite}}
{}
{\usebibmacro{textcite:postnote}}
\DeclareMultiCiteCommand{\cbx@textcites}[\mkbibparens]{\cbx@textcite}{}
\makeatother
如果您想要为此创建一个新命令\textcitep
,我们还必须从中复制一些定义numeric.cbx
并进行调整。然后我们需要
\makeatletter
\DeclareCiteCommand{\cbx@textcitep}[\mkbibparens]
{\usebibmacro{textcite:init}}
{\usebibmacro{citeindex}%
\usebibmacro{textcite}}
{}
{\usebibmacro{textcite:postnote}}
\DeclareMultiCiteCommand{\cbx@textciteps}[\mkbibparens]{\cbx@textcitep}{}
\DeclareCiteCommand{\textcitep}[\cbx@textcite@init\cbx@textcitep]
{\gdef\cbx@savedkeys{}%
\citetrackerfalse%
\pagetrackerfalse%
\DeferNextCitekeyHook%
\usebibmacro{textcite:init}}
{\ifthenelse{\iffirstcitekey\AND\value{multicitetotal}>0}
{\protected@xappto\cbx@savedcites{()(\thefield{multipostnote})}%
\global\clearfield{multipostnote}}
{}%
\xappto\cbx@savedkeys{\thefield{entrykey},}%
\iffieldequals{namehash}{\cbx@lasthash}
{}
{\stepcounter{textcitetotal}%
\savefield{namehash}{\cbx@lasthash}}}
{}
{\protected@xappto\cbx@savedcites{%
[\thefield{prenote}][\thefield{postnote}]{\cbx@savedkeys}}}
\DeclareMultiCiteCommand{\textciteps}[\cbx@textcites@init\cbx@textciteps]{\textcitep}{}
\makeatother
创建一个新的\textcitep
和一个新的 multicite \textciteps
。
平均能量损失
\documentclass{article}
\usepackage[
style=numeric,
backend=biber,
uniquename=true,
uniquelist=false,
maxcitenames=2,
natbib=true ]{biblatex}
\addbibresource{biblatex-examples.bib}
\makeatletter
\DeclareCiteCommand{\cbx@textcitep}[\mkbibparens]
{\usebibmacro{textcite:init}}
{\usebibmacro{citeindex}%
\usebibmacro{textcite}}
{}
{\usebibmacro{textcite:postnote}}
\DeclareMultiCiteCommand{\cbx@textciteps}[\mkbibparens]{\cbx@textcitep}{}
\DeclareCiteCommand{\textcitep}[\cbx@textcite@init\cbx@textcitep]
{\gdef\cbx@savedkeys{}%
\citetrackerfalse%
\pagetrackerfalse%
\DeferNextCitekeyHook%
\usebibmacro{textcite:init}}
{\ifthenelse{\iffirstcitekey\AND\value{multicitetotal}>0}
{\protected@xappto\cbx@savedcites{()(\thefield{multipostnote})}%
\global\clearfield{multipostnote}}
{}%
\xappto\cbx@savedkeys{\thefield{entrykey},}%
\iffieldequals{namehash}{\cbx@lasthash}
{}
{\stepcounter{textcitetotal}%
\savefield{namehash}{\cbx@lasthash}}}
{}
{\protected@xappto\cbx@savedcites{%
[\thefield{prenote}][\thefield{postnote}]{\cbx@savedkeys}}}
\DeclareMultiCiteCommand{\textciteps}[\cbx@textcites@init\cbx@textciteps]{\textcitep}{}
\makeatother
\begin{document}
Text \textcites{knuth:ct:c, companion}. See also \textcite{knuth:ct:d}.
Text \textciteps{knuth:ct:c, companion}. See also \textcitep{knuth:ct:d}
\printbibliography
\end{document}