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.
http://tex.stackexchange.com/questions/17684/biblatex-something-like-ifentrytype
tex.stackexchange.com
crawl=CC-MAIN-2014-23
75597
application/http; msgtype=response
sha1:FBVX42OERMJPASLICSU3KS4FGSQMPFA5
<urn:uuid:27f7e18a-1683-4b64-abeb-ddddaaba2cff>
2014-07-24T06:51:00Z
198.252.206.16
sha1:5T7NN5WS7DAZQA43YXYJ2V6QT66RBGIL
<urn:uuid:38638b81-4bb1-4e1f-adc7-9a8d87d6c661>
http://tex.stackexchange.com/questions/17684/biblatex-something-like-ifentrytype
response
<urn:uuid:39463799-2ca4-4a50-81d9-3a28a75eca32>
robots: classic
hostname: ip-10-33-131-23.ec2.internal
software: Nutch 1.6 (CC)/CC WarcExport 1.0
isPartOf: CC-MAIN-2014-23
operator: CommonCrawl Admin
description: Wide crawl of the web with URLs provided by Blekko for July 2014
publisher: CommonCrawl
format: WARC File Format 1.0
conformsTo: http://bibnum.bnf.fr/WARC/WARC_ISO_28500_version1_latestdraft.pdf