Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
add comment

2 Answers 2

up vote 10 down vote accepted

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.

share|improve this answer
    
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 … –  Tobi May 7 '11 at 18:41
add comment

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

share|improve this answer
1  
Thank 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 :-) –  Tobi Mar 26 '12 at 22:23
2  
This 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. –  Stephan Lehmke Mar 29 '12 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.) –  Daniel Mar 29 '12 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. –  Stephan Lehmke Mar 29 '12 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). –  Daniel Mar 29 '12 at 6:53
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.