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 would like to have the shorthand printed in the bibliography in square brackets before the bibliography item. I adapted this answer by lockstep which works with one problem: if there is no author, there is a superfluous dot. This comes obviously from the \labelnamepunct which is set by the \setunit command of the bibliography drivers. Is there an easy way to avoid the output of the \labelnamepunct?

Here is an example that illustrates the problem (KpV is correct, CTAN has the superfluous punctuation):

\listfiles
\documentclass[ngerman]{scrartcl}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@InBook{kant:kpv,
  shorthand   = {KpV},
  hyphenation     = {german},
  author      = {Kant, Immanuel},
  bookauthor      = {Kant, Immanuel},
  title       = {Kritik der praktischen Vernunft},
  shorttitle      = {Kritik der praktischen Vernunft},
  booktitle   = {Kritik der praktischen Vernunft. Kritik der Urtheilskraft},
  maintitle   = {Kants Werke. Akademie Textausgabe},
  volume      = {5},
  publisher   = {Walter de Gruyter},
  location    = {Berlin},
  date        = {1968},
  pages       = {1--163}
}
@Online{ctan,
  shorthand       = {CTAN},
  hyphenation     = {american},
  title       = {CTAN},
  subtitle    = {The Comprehensive TeX Archive Network},
  date        = {2006},
  url         = {http://www.ctan.org},
  urldate     = {2006-10-01}
}
\end{filecontents}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel,csquotes}

\usepackage[
  style=authortitle,
  backend=biber
]{biblatex}
\addbibresource{\jobname.bib}

\renewbibmacro*{begentry}{%
  \iffieldundef{shorthand}
    {}
    {\printtext[brackets]{\usebibmacro{cite}}%
     \addspace}}

\begin{document}
\nocite{*}

\printbibliography
\end{document}

And here is what I get: enter image description here

share|improve this question

1 Answer 1

up vote 4 down vote accepted

Add \nopunct to the redefinition of the begentry bibmacro. This way, the next punctuation command will print nothing.

\renewbibmacro*{begentry}{%
  \iffieldundef{shorthand}
    {}
    {\printtext[brackets]{\usebibmacro{cite}}%
     \nopunct\addspace}}

enter image description here

See also my answer to Fixing punctuation after a field in biblatex.

share|improve this answer
    
Wow, this was easy! How come that I did not know \nopunct yet …? Shame on me. –  domwass Jun 12 '12 at 14:16

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.