I’d like to change the bibmacro cite:short
only for one entry type (@music
). So is there a way to test for the entry type?
2 Answers
You can use the \iffieldequalstr
command to check for a specific entry type.
\newbibmacro*{cite:short}{%
\iffieldequalstr{entrytype}{music}
{} %true
{} %false
}
From the biblatex manual (p. 147)
\iffieldequalstr{<field>}{<string>}{<true>}{<false>}
Executes
<true>
if the value of the<field>
is equal to<string>
, and<false>
otherwise. This command is robust.
-
You are my hero ;-) I didn’t know that I can access
entrytype
in this way. Maybe I should read the whole manual in nearer future …– TobiMay 7, 2011 at 18:41
Actually, biblatex
does feature an \ifentrytype
macro, but it was undocumented until version 1.7. Quoting section 4.6.2 of the manual:
\ifentrytype{<type>}{<true>}{<false>}
Executes
<true>
if the entry type of the entry currently being processed is<type>
, and<false>
otherwise.
And quoting appendix D (Revision History):
1.7 2011-11-13
[...]
Added missing documentation for
\ifentrytype
-
1Thank you! I’ll keep Thorsten’s answers as accepted because he has less reputation, although yours is the better on according to the question title. I hope you don’t mind :-)– TobiMar 26, 2012 at 22:23
-
2This doesn't really make sense. Accepting an answer is not a means for giving away rep, but for marking the most helpful answer so people who find this question later will immediately recognize it. Mar 29, 2012 at 5:38
-
@StephanLehmke: Well, at the time of asking, the answer of Thorsten probably was the most helpful so it should stay to be the accepted answer. (I wasn't even aware of the fact that one possibly could change the accepted answer more than 10 months later, but apparently that is actually possible.)– DanielMar 29, 2012 at 6:24
-
@Daniel This doesn't make sense. When someone asks a question, s/he is referred to an identical question which has already been answered (if such exists). From this it immediately follows that answers should reflect the current optimal state of affairs (even adapting answers to new developments) and not some historical considerations at the time of asking. Mar 29, 2012 at 6:30
-
@StephanLehmke: Yeah, it doen't make a lot of sense. It is more related to the community process: We have to separate two things here: (1) The answer that has helped the OP "most" and (2) the "best / most complete" answer. For (1), the criteria is just in the eye of the OP – the accepted answer might be suboptimal or even wrong, but we have to live with the fact that many OPs never come back to change it. So (2) is in the responsibility of the community, who has to indicate the "best" answer by upvoting (and maybe even downvoting a really bad "accepted" answer).– DanielMar 29, 2012 at 6:53