5

Could somebody help me to make shorthands when I cite entries Inproceedings with Proceedings as crossref?

I use this code:

\documentclass[a4paper]{article}

\usepackage[T1]{fontenc}

\usepackage[english,ngerman]{babel}

\usepackage[style=verbose-ibid,citepages=suppress,sorting=nty]{biblatex}

\usepackage{filecontents}

\begin{filecontents}{conference.bib}

@Inproceedings{Science:Environment2000,
title = {Environmental Science and Management in Developing versus Developed Countries: education and research perspectives},
crossref = {Environment2000},
author = {John Doe},
pages = {23--45}
}


@Inproceedings{health:Environment2000,
title = {Public health: implications from a compromised environment },
crossref = {Environment2000},
author = {Ho Chi Minh},
pages = {330--335}
}

@Proceedings{Environment2000,
title = {International Conference on Environmental Pollution, Restoration,and Management},
booktitle = {International Conference on Environmental Pollution, Restoration,and Management},
shorthand = {ICEP},
date = {2000},
}

@Article{Episkepsis1970:1,
title = {Decide ne plus refuser},
crossref = {Episkepsis},
date = {1970},
number = {1},
pages = {6--7},
}


@Article{Episkepsis1972:62,
title = {La jeunesse et la préparation},
crossref = {Episkepsis},
date = {1972},
number = {62},
pages = {5--7},
}

@Article{Episkepsis2009:701,
title = {Réunion à Chambésy de la IV\textsuperscript{e} Conférence},
crossref = {Episkepsis},
date = {2009},
number = {701},
pages = {8--21}
}

@Collection{Episkepsis,
journaltitle = {Episkepsis},
publisher = {Ceneter OPO},
address = {Chambésy--Genève},
shorthand = {EP},
keywords = {primary},
}

\end{filecontents}

\addbibresource{conference.bib}


\begin{document}
test\footcite[331]{health:Environment2000} est\footcite[23--27]{Science:Environment2000} test \footcite[23--27]{Episkepsis1970:1}test\footcite[23--27]{Episkepsis1972:62} \footcite[23--27]{Episkepsis2009:701}

\printbibliography

\end{document}

and I have this

enter image description here

But I would like to have

  1. Ho Chi Minh. "Public health: implications from a compromised environment". In: International Conference on Environmental Pollution, Restoration,and Management. 2000 (henceforth cited as ICEP), p.331.
  2. John Doe. "Environmental Science and Management in Developing versus Developed Countries: education and research perspectives". In: ICEP, pp.23-27

And the same for the Incollection and @Article (for articles' crossref I used @Collection may be it's not wright) entries.

Thank you.

filokalos
  • 1,037

1 Answers1

7

This solution uses cross-referencing via xref instead of crossref in order to work consistently with either backend. It is based on an example from section 4.11.1 of the biblatex manual (version 1.4b).

\documentclass[a4paper]{article}
\usepackage[style=verbose-ibid,citepages=suppress,sorting=nty]{biblatex}
\usepackage{filecontents}

\newbibmacro*{cite:xref}{%
    \ifciteseen
        {\iffieldundef{shorthand}
            {\usebibmacro{cite:short}}
            {\usebibmacro{cite:shorthand}}}
        {\ifentrytype{periodical}
            {\usebibmacro{cite:short}\usebibmacro{shorthandintro}}
            {\usebibmacro{cite:full}}}}

\DeclareCiteCommand{\xrefcite}
    {}
    {\usebibmacro{cite:xref}}
    {}
    {}

\renewbibmacro*{journal}{%
    \iffieldundef{xref}
        {\iffieldundef{journaltitle}
            {}
            {\printtext[journaltitle]{%
                \printfield[titlecase]{journaltitle}%
                \setunit{\subtitlepunct}%
                \printfield[titlecase]{journalsubtitle}}}}
        {\entrydata{\thefield{xref}}{%
            \ifboolexpr{
                test {\iffieldundef{title}}
                and
                test {\iffieldundef{subtitle}}
            }
            {}
            {\printtext[title]{\printfield[titlecase]{title}%
                \setunit{\subtitlepunct}%
                \printfield[titlecase]{subtitle}}}}}}

\DeclareBibliographyDriver{article}{%
    \usebibmacro{bibindex}%
    \usebibmacro{begentry}%
    \usebibmacro{author/translator+others}%
    \setunit{\labelnamepunct}\newblock
    \usebibmacro{title}%
    \newunit
    \printlist{language}%
    \newunit\newblock
    \usebibmacro{byauthor}%
    \newunit\newblock
    \usebibmacro{bytranslator+others}%
    \newunit\newblock
    \printfield{version}%
    \newunit\newblock
    \usebibmacro{in:}%
    \ifthenelse{\ifbibliography\OR\iffieldundef{xref}}
        {\usebibmacro{journal+issuetitle}%
            \newunit
            \usebibmacro{byeditor+others}%
            \newunit
            \usebibmacro{note+pages}%
            \newunit\newblock
            \iftoggle{bbx:isbn}{\printfield{issn}}{}%
            \newunit\newblock
            \usebibmacro{doi+eprint+url}%
            \newunit\newblock
            \usebibmacro{addendum+pubstate}%
            \newunit\newblock
            \setunit{\bibpagerefpunct}\newblock
            \usebibmacro{pageref}%
            \usebibmacro{finentry}}%
        {\xrefcite{\thefield{xref}}%
            \ifciteseen{}{%
                \setunit{\addspace}%
                \usebibmacro{volume+number+eid}%
                \setunit{\addspace}%
                \usebibmacro{issue+date}}}}

\newbibmacro*{in:collection}{%
    \usebibmacro{byeditor+others}%
    \newunit\newblock
    \printfield{edition}%
    \newunit
    \iffieldundef{maintitle}{\printfield{volume}\printfield{part}}{}%
    \newunit
    \printfield{volumes}%
    \newunit\newblock
    \usebibmacro{series+number}%
    \newunit\newblock
    \usebibmacro{publisher+location+date}%
    \newunit\newblock
    \iftoggle{bbx:isbn}{\printfield{isbn}}{}}

\DeclareBibliographyDriver{incollection}{%
    \usebibmacro{bibindex}%
    \usebibmacro{begentry}%
    \usebibmacro{author/translator+others}%
    \setunit{\labelnamepunct}\newblock
    \usebibmacro{title}%
    \newunit
    \printlist{language}%
    \newunit\newblock
    \usebibmacro{byauthor}%
    \newunit\newblock
    \usebibmacro{in:}%
    \iffieldundef{xref}
        {\usebibmacro{maintitle+booktitle}%
            \newunit\newblock
            \usebibmacro{in:collection}}%
        {\ifcitation
            {\xrefcite{\thefield{xref}}}
            {\entrydata{\thefield{xref}}{%
                \usebibmacro{title}%
                \newunit\newblock
                \usebibmacro{in:collection}}}}%
    \newunit\newblock
    \usebibmacro{chapter+pages}%
    \newunit\newblock
    \printfield{note}%
    \newunit\newblock
    \usebibmacro{doi+eprint+url}%
    \newunit\newblock
    \usebibmacro{addendum+pubstate}%
    \setunit{\bibpagerefpunct}\newblock
    \usebibmacro{pageref}%
    \usebibmacro{finentry}}

\newbibmacro*{in:proceedings}{%
    \usebibmacro{event+venue+date}%
    \newunit\newblock
    \usebibmacro{byeditor+others}%
    \newunit\newblock
    \iffieldundef{maintitle}{\printfield{volume}\printfield{part}}{}%
    \newunit
    \printfield{volumes}%
    \newunit\newblock
    \usebibmacro{series+number}%
    \newunit\newblock
    \printlist{organization}%
    \newunit
    \usebibmacro{publisher+location+date}%
    \newunit\newblock
    \iftoggle{bbx:isbn}{\printfield{isbn}}{}}

\DeclareBibliographyDriver{inproceedings}{%
    \usebibmacro{bibindex}%
    \usebibmacro{begentry}%
    \usebibmacro{author/translator+others}%
    \setunit{\labelnamepunct}\newblock
    \usebibmacro{title}%
    \newunit
    \printlist{language}%
    \newunit\newblock
    \usebibmacro{byauthor}%
    \newunit\newblock
    \usebibmacro{in:}%
    \iffieldundef{xref}
        {\usebibmacro{maintitle+booktitle}%
            \newunit\newblock
            \usebibmacro{in:proceedings}}%
        {\ifcitation
            {\xrefcite{\thefield{xref}}}
            {\entrydata{\thefield{xref}}{%
                \usebibmacro{title}%
                \newunit\newblock
                \usebibmacro{in:proceedings}}}}%
    \newunit\newblock
    \usebibmacro{chapter+pages}%
    \newunit\newblock
    \printfield{note}%
    \newunit\newblock
    \usebibmacro{doi+eprint+url}%
    \newunit\newblock
    \usebibmacro{addendum+pubstate}%
    \setunit{\bibpagerefpunct}\newblock
    \usebibmacro{pageref}
    \usebibmacro{finentry}}

\begin{filecontents}{\jobname.bib}
@Inproceedings{Science:Environment2000,
title = {Environmental Science and Management in Developing versus Developed Countries: education and research perspectives},
xref = {Environment2000},
author = {John Doe},
pages = {23--45}}

@Inproceedings{health:Environment2000,
title = {Public health: implications from a compromised environment},
xref = {Environment2000},
author = {Ho Chi Minh},
pages = {330--335}}

@Proceedings{Environment2000,
title = {International Conference on Environmental Pollution, Restoration, and Management},
shorthand = {ICEP},
date = {2000}}

@InCollection{westfahl:space,
xref = {westfahl:frontier},
author = {Westfahl, Gary},
title = {The True Frontier},
subtitle = {Confronting and Avoiding the Realities of Space in American Science Fiction Films},
pages = {55--65}}

@Collection{westfahl:frontier,
editor = {Westfahl, Gary},
shorthand = {FTSF},
title = {Space and Beyond},
subtitle = {The Frontier Theme in Science Fiction},
publisher = {Greenwood},
location = {Westport, Conn. and London},
date = {2000}}

@Article{Episkepsis1970:1,
title = {Decide ne plus refuser},
xref = {Episkepsis},
date = {1970},
number = {1},
pages = {6--7}}

@Article{Episkepsis1972:62,
title = {La jeunesse et la preparation},
xref = {Episkepsis},
date = {1972},
number = {62},
pages = {5--7}}

@Article{Episkepsis2009:701,
title = {Reunion a Chambesy de la IV\textsuperscript{e} Conference},
xref = {Episkepsis},
date = {2009},
number = {701},
pages = {8--21}}

@periodical{Episkepsis,
options = {skipbib=true},
title = {Episkepsis},
shorthand = {EP},
date = {1970/},
publisher = {Ceneter OPO},
address = {Chambesy--Geneve},
keywords = {primary}}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}
\footcite[cf.][332]{health:Environment2000}
\footcite{Science:Environment2000}
\footcite[331]{health:Environment2000}
\footcite{westfahl:space}
\footcite{westfahl:frontier}
\footcite[cf.][6]{Episkepsis1972:62}
\footcite{Episkepsis2009:701}
\footcite[7]{Episkepsis1972:62}
\printbibliography
\end{document}

enter image description here

Some notes:

  • A cross-reference here actually invokes an explicit citation of the parent entry. This is done intentionally to ensure "availability" of the parent entry for child citations. [To see what I mean, try making \xrefcite an (implicit) internal command (by renaming it to, say, bbx@xref) and add the biblatex package option mincrossrefs=99. Also see the xref entry description in the manual.]

  • A consequence of the above item that every parent will appear in the bibliography, unless you add options = {skipbib=true} to its entry. (See the @periodical entry above for an example.)

  • In this setup @article inherits only journaltitle and journalsubtitle from @periodical. The child entry types @inproceedings and @incollection inherit many more fields from @proceedings and @collection - pretty much everything I deemed specific to the parent. Any of this could be changed by editing the above bibliography drivers and macros.

  • A drawback to using xref for cross-referencing is that there is no inheritance already defined for you. But crossref behaviour depends on the backend. It also appears to give some unanticipated* results. For example with biber, a child @article gets the same date format as its parent @periodical. With bibtex, any child gets cited with its parent's shorthand.

*Possibly due to some misuse of the biblatex interface on my part...

Audrey
  • 28,881
  • @Audrey Thank you very much. I've tried to make your example with biber, but my biber said "I found no \citation commands---while reading file". I'm updating my TexLive 2010 now and will try again. Could you tell me, sorry for disturbing you, will your code work for articles when I cite a lot of articles of a magazine? – filokalos May 23 '11 at 09:40
  • @Audrey The same result :(((( The Biber says "I found no \citation commands---while reading file rabota.aux I found no \bibdata command---while reading file rabota.aux I found no \bibstyle command---while reading file rabota.aux (There were 3 error messages)" – filokalos May 23 '11 at 10:03
  • @Audrey Thank you. :))) The guys helped me to solve problem with biber here http://tex.stackexchange.com/questions/18859/biber-gives-i-found-no-citation-commands-is-there-exists-a-solution/18868#18868 . And now your example WORKS!!! Thank you once more! – filokalos May 23 '11 at 14:55
  • @filokalos: Just logging in now... Good to hear. – Audrey May 23 '11 at 15:01
  • @Audrey :)))) Just tell me will your example work for the articles? I cited a lot of articles of the same magazine (different years).Or it's need some different code? – filokalos May 23 '11 at 15:07
  • @filokalos: You'd probably need additional code - what I provided will only handle proceedings and collections. Can you edit your question to show what you're wanting for magazines? – Audrey May 23 '11 at 15:26
  • @Audrey Thank you anyway. You really helped me a lot. :) – filokalos May 23 '11 at 19:53
  • @filokalos You're welcome. One thing I don't like about this solution is that the journal volume/number/issue information won't be provided the first time an article with a crossref is cited. If this is something you want to fix, let me know. I am pretty sure there is an easy way to do it. – Audrey May 23 '11 at 20:45
  • @Audrey Yes, you right. The number and issue of journal it would be great. But even just number would be fine. If you will have time, I will be very appreciate if you could fix it. :) Thanks. – filokalos May 23 '11 at 21:08
  • @filokalos OK. I've applied a fix. I can think of a few cases where this solution will need some further refinements - the most obvious one being an @article entry with a crossref and date that is more than just a year. But I'll leave it alone for now. – Audrey May 23 '11 at 22:14
  • @Audrey SUPER! Thank you very much. You know, I thought, and what if to use the @periodical entry without date field. I mean to delete "date = {1970/}" ? – filokalos May 25 '11 at 06:44
  • @filokalos I thought the same thing. I think date is a mandatory field for @periodical, but I'm sure there is a way to at least avoid printing it. I'll post an edit when I find some spare time in the next day or so. – Audrey May 25 '11 at 14:27
  • @filokalos I just came across some material in the biblatex manual that led to a new solution. It works with either bibtex or biber. (Sorry you went through that headache of installing biber...) It also uses cross-referencing via the xref field, not crossref. So you'll have to update your .bib file. If you do switch back to bibtex, make sure you also delete any output files (.bcf, .blx, etc.) before re-compiling. – Audrey May 25 '11 at 23:03
  • @Audrey Amazing! Thank you very much!!! It works SUPER! And it's ok about 'biber' and 'biblatex' - I have TexLive 2010 (on Linux), so all this packages are included. Thank you once more!. :)) – filokalos May 26 '11 at 15:20
  • @filokalos You're welcome! – Audrey May 26 '11 at 16:37
  • Just an aside - biber isn't a headache to install any more - there are binaries for most platforms available in TL. Also, if you are using biber, see section 2.4.1.2 of the bibaltex manual for details on how to completely customise crossref inheritance. – PLK May 26 '11 at 17:13
  • @PLK Agreed. I was referring to the trouble filokalos had at the beginning of this thread. Perhaps "installing" wasn't the right word. Given the issues I ran into with crossref, I'd recommend using xref even with biber as the backend for this particular problem. – Audrey May 26 '11 at 17:50
  • @Audrey Tell me, please, is there is a possibility to combine in \printshorthands of the code above shorthands of bibliography's entries and acronyms used in text? – filokalos May 29 '11 at 15:27
  • @filokalos A couple different packages can manage acronyms in text. There is probably a way to combine an acronym list with the shorthand list produced by biblatex, but I'd have to look into it. Perhaps you can post this as another question? The above code has no impact on \printshorthands, so you wouldn't need to include it in a MWE. – Audrey May 29 '11 at 20:23
  • @Audrey Ok. Thank you. I will post it in a new question. :) – filokalos May 30 '11 at 07:32