I need to take the first string (considering First~Second a single string) from the title field from anonym entries and:
Format this first string differently from the rest of the title, e.g.:
LES MILLES et un nuit trans. by M. Galland. Paris: Compaigne des Libraires, 1745.
THE BOOK of the thousand nights and a night trans. and annot. by Richard F. Burton. London: Burton Club, 1885.
Use that string as a citation label, e.g.
LES MILLES..., 1745; THE BOOK..., 1885
So, the style file needs to check for author and editor names and, in their absence, reformat the first word of the title to uppercase, as well as use it as a label for quotations.
My attempt
This is what I've tried so far.
I tried to achieve this result through the use of xstring with something like:
\newbibmacro{author+title}{%
\ifnameundef{author}%
{\ifnameundef{editor}%
{%
\StrCut[1]{\thefield{title}}{ }\StringA\StringB%
\SpecialTitleFormat{\StringA}\space\StringB%
\setunit\newblock
}%
{\usebibmacro{editor}
\setunit{\labelnamepunct}\newblock
\usebibmacro{title}}}%
{\usebibmacro{author}%
\setunit{\labelnamepunct}\newblock%
\usebibmacro{title}}
And I tried to remap this string to the shorttitle field via biber's \DeclareSourcemap functionality
\DeclareSourcemap{
\maps[datatype=bibtex]{
\map[overwrite]{
\step[fieldsource=title,
fieldset=shorttitle,
match=\regexp{(\w+).*},
fieldvalue={$1}]
}
}
}
\renewbibmacro*{labeltitle}{%
\iffieldundef{label}
{\iffieldundef{shorttitle}
{\printfield{title}%
\clearfield{title}}
{\printfield[shorttitle]{shorttitle}}}
{\printfield{label}}}
The problem with this approach is that the citation label and the emphasis in the bibliography are taken from the field through different means, what makes it inconsistent, e.g. the ~ works for the bibliography part, but not for the label.
Here's a MWE:
\documentclass{article}
\usepackage{filecontents}
% Bibliographic Database
\begin{filecontents*}{\jobname.bib}
@book{simple,
title = {Simple anonym entry},
publisher = {Publisher},
year = {2013},
}
@book{1001nights,
title = {The~Book of the thousand nights and a night},
subtitle = {A plain and literal translation of the Arabian nights' entertainments},
translator = {Richard F. Burton},
annotator = {Richard F. Burton},
location = {London},
publisher = {Burton Club},
year = {1885},
}
@book{1001nuit,
title = {Les~milles et un nuit},
subtitle = {Contes Arabes},
translator = {M. Galland},
address = {Paris},
publisher = {Compaigne des Libraires},
year = {1745},
}
@book{editoranonym,
title = {An anonym entry with an editor},
editor = {Editor, Ed},
publisher = {Publisher},
year = {2000},
}
\end{filecontents*}
% Biblatex Style file
\begin{filecontents*}{\jobname.bbx}
\ProvidesFile{\jobname.bbx}
\RequireBibliographyStyle{standard}
% I'm redefining the book driver to use an author+title bibmacro
\DeclareBibliographyDriver{book}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author+title}%
\newunit
\printlist{language}%
\newunit\newblock
\usebibmacro{byauthor}%
\newunit\newblock
\usebibmacro{byeditor+others}%
\newunit\newblock
\printfield{edition}%
\newunit
\iffieldundef{maintitle}
{\printfield{volume}%
\printfield{part}}
{}%
\newunit
\printfield{volumes}%
\newunit\newblock
\usebibmacro{series+number}%
\newunit\newblock
\printfield{note}%
\newunit\newblock
\usebibmacro{publisher+location+date}%
\newunit\newblock
\usebibmacro{chapter+pages}%
\newunit
\printfield{pagetotal}%
\newunit\newblock
\iftoggle{bbx:isbn}
{\printfield{isbn}}
{}%
\newunit\newblock
\usebibmacro{doi+eprint+url}%
\newunit\newblock
\usebibmacro{addendum+pubstate}%
\setunit{\bibpagerefpunct}\newblock
\usebibmacro{pageref}%
\newunit\newblock
\usebibmacro{related}%
\usebibmacro{finentry}}
\RequirePackage{xstring}
\DeclareRobustCommand{\SpecialTitleFormat}[1]{%
\MakeUppercase{#1}}
% author+title bibmacro
% this should check for author and editor, and, in their absence, use
% the title field
\newbibmacro{author+title}{%
\ifnameundef{author}%
{\ifnameundef{editor}%
{%
\StrCut[1]{\thefield{title}}{ }\StringA\StringB%
\SpecialTitleFormat{\StringA}\space\StringB%
\setunit\newblock
}%
{\usebibmacro{editor}
\setunit{\labelnamepunct}\newblock
\usebibmacro{title}}}%
{\usebibmacro{author}%
\setunit{\labelnamepunct}\newblock%
\usebibmacro{title}}
}
\DeclareSourcemap{
\maps[datatype=bibtex]{
\map[overwrite]{
\step[fieldsource=title,
fieldset=shorttitle,
match=\regexp{(\w+).*},
fieldvalue={$1}]%
}
}
}
\renewbibmacro*{labeltitle}{%
\iffieldundef{label}
{\iffieldundef{shorttitle}
{\printfield{title}%
\clearfield{title}}
{\printfield[shorttitle]{shorttitle}}}
{\printfield{label}}}
\endinput
\end{filecontents*}
\usepackage[utf8]{inputenc}
\usepackage[bibstyle=\jobname,citestyle=verbose]{biblatex}
\addbibresource{\jobname.bib}
\usepackage{xstring}
\begin{document}
\thispagestyle{empty}
\citetitle{simple} \citetitle{1001nights} \citetitle{1001nuit} \citetitle{editoranonym}
\printbibliography
\end{document}


~separator to keep it simple (I was thinking in something similar to what Audrey did). – henrique Mar 12 at 11:44