我一直试图使用\SplitArgument
一个命令也包含一个s型参数。我尝试了所有方法,但还是没有考虑到星号,而且最重要的是,我得到了一个寄生空间。知道我做错了什么吗?
在里面平均能量损失,星号变体应删除自动的初始空格。
AUX 命令运行完美,但我无法分割我的论点。
\documentclass{article}
\usepackage[citestyle=ext-authoryear-comp]{biblatex}
\DeclareNameWrapperFormat{labelname:poss}{#1's}
\DeclareFieldFormat{shorthand:poss}{%
\ifnameundef{labelname}{#1's}{#1}}
\DeclareFieldFormat{citetitle:poss}{\mkbibemph{#1}'s}
\DeclareFieldFormat{label:poss}{#1's}
\newrobustcmd*{\posscitealias}{%
\AtNextCite{%
\DeclareNameWrapperAlias{labelname}{labelname:poss}%
\DeclareFieldAlias{shorthand}{shorthand:poss}%
\DeclareFieldAlias{citetitle}{citetitle:poss}%
\DeclareFieldAlias{label}{label:poss}}}
\newrobustcmd*{\tcitepos}{%
\posscitealias%
\textcite}
\NewDocumentCommand{\tcitecomAUX}{smm}{%
\IfBooleanF{#1}{\space}%
\textcite{#2}\space and\space\tcitepos{#3}}
\NewDocumentCommand{\tcitecom}{s>{\SplitArgument{1}{,}}m}{\tcitecomAUX#2{#1}}
\begin{filecontents}{\jobname.bib}
@book{smi96,
author = {Smith, Adam},
year = {1996},
title = {Economy},
publisher = {My company}
}
@book{joh84,
author = {Jones, Indiana},
year = {1984},
title = {The Graal},
publisher = {My company}
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
As in\tcitecomAUX{smi96}{joh84} common theory...
As in\tcitecomAUX*{smi96}{joh84} common theory... % Works nicely.
\vspace{2ex}
As in\tcitecom{smi96,joh84} common theory... % Extra space.
As in\tcitecom*{smi96,joh84} common theory... % The star is ignored.
\end{document}
答案1
你传递了错误的参数(并且没有得到那输出)。
\begin{filecontents}{\jobname.bib}
@book{smi96,
author = {Smith, Adam},
year = {1996},
title = {Economy},
publisher = {My company}
}
@book{joh84,
author = {Jones, Indiana},
year = {1984},
title = {The Graal},
publisher = {My company}
}
\end{filecontents}
\documentclass{article}
\usepackage[citestyle=ext-authoryear-comp]{biblatex}
\DeclareNameWrapperFormat{labelname:poss}{#1's}
\DeclareFieldFormat{shorthand:poss}{%
\ifnameundef{labelname}{#1's}{#1}}
\DeclareFieldFormat{citetitle:poss}{\mkbibemph{#1}'s}
\DeclareFieldFormat{label:poss}{#1's}
\newrobustcmd*{\posscitealias}{%
\AtNextCite{%
\DeclareNameWrapperAlias{labelname}{labelname:poss}%
\DeclareFieldAlias{shorthand}{shorthand:poss}%
\DeclareFieldAlias{citetitle}{citetitle:poss}%
\DeclareFieldAlias{label}{label:poss}}}
\newrobustcmd*{\tcitepos}{%
\posscitealias%
\textcite}
\NewDocumentCommand{\tcitecomAUX}{mmm}{%
#1\textcite{#2} and \tcitepos{#3}}
\NewDocumentCommand{\tcitecom}{s>{\SplitArgument{1}{,}}m}{%
\IfBooleanTF{#1}{\tcitecomAUX{}#2}{\tcitecomAUX{ }#2}%
}
\addbibresource{\jobname.bib}
\begin{document}
As in\tcitecom{smi96,joh84} common theory... % Extra space.
As in\tcitecom*{smi96,joh84} common theory... % The star is ignored.
\end{document}