# Customize op. cit. / loc. cit. entries using shorttile field from biber

I need to costumize how short titles are printed in footnote citations. To be precise I need to add (\ldots)\comma\space between shorttitle and next part of footcite. I already have biblatex.cfg with bunch of modifications to verbose-trad2 style, but I can't find what I need to put in \renewbibmacro*{}

I've searched here and I've only found this: Custom short citations (Biblatex Verbose) but I'm not sure how to adjust it for my case, so any help will be much appreciated!

MWE:

bibliografia.bib:

@book{      kowalska1,
author =    {J. Kowalska},
title =     {Jeden},
location =  {Warszawa},
year =      {2003}
}
@book{      k,
author =    {K. Maciej},
title =     {Very Long and Verbose Ttile: even with longer subtitle},
shorttitle = {Short Title},
location =  {Warszawa},
year =      {2031}
}


texfile:

\documentclass{article}
\usepackage{polyglossia}
\setmainlanguage{polish}
\usepackage[
sorting=nty,
isbn=false,
backend=biber]{biblatex}
\begin{document}
ipsum \footcite{k}
Lorem \footcite{kowalska1}
ipsum \footcite{k}
\end{document}


You could use a sourcemap, and add it directly to the field.

\DeclareSourcemap{
\maps[datatype=bibtex]{
\map[overwrite]{
\step[fieldsource=shorttitle, match=\regexp{\A.+\Z}, final]
\step[fieldset=shorttitle, fieldvalue={\addspace\bibellipsis}, append] % recommended
% \step[fieldset=shorttitle, fieldvalue={\unexpanded{\addspace(\ldots)\isdot}}, append] % if you really need the parentheses
}
}
}


In full:

\documentclass{article}
\usepackage{polyglossia}
\setmainlanguage{polish}
\usepackage[
isbn=false,
backend=biber]{biblatex}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{      kowalska1,
author =    {J. Kowalska},
title =     {Jeden},
location =  {Warszawa},
year =      {2003}
}
@book{      k,
author =    {K. Maciej},
title =     {Very Long and Verbose Ttile: even with longer subtitle},
shorttitle = {Short Title},
location =  {Warszawa},
year =      {2031}
}
\end{filecontents}

\DeclareSourcemap{
\maps[datatype=bibtex]{
\map[overwrite]{
\step[fieldsource=shorttitle, match=\regexp{\A.+\Z}, final]
\step[fieldset=shorttitle, fieldvalue={\addspace\bibellipsis}, append] % recommended
% \step[fieldset=shorttitle, fieldvalue={\unexpanded{\addspace(\ldots)\isdot}}, append] % if you really need the parentheses
}
}
}

\begin{document}
ipsum \footcite{k}
Lorem \footcite{kowalska1}
ipsum \footcite{k}
\end{document}


• I've already used solution you've edited out: \DeclareFieldFormat{citetitle}{\mkbibemph{#1}\addspace(\ldots)\isdot} \DeclareFieldFormat [article,inbook,incollection,inproceedings,patent,thesis,unpublished] {citetitle}{\mkbibemph{#1}\addspace(\ldots)\isdot} Apr 25, 2018 at 19:11
• @konserw, I did edit it out, because I found a relevant case where it will fail. If you have an entry which has no shorttitle, the \ldots will be added anyway, which is an outright error... So I do recommend you use the sourcemap instead. Apr 25, 2018 at 19:32

We can change the field format for citetitle directly if we are careful. We need to make sure that we are actually displaying the shorttitle at the moment. This is what \ifshorttitle does, it checks if a shorttitle was used for the labeltitle field and if shorttitle and title are different. We then add \ifshorttitle{\shorttitlepunct}{} in the appropriate places.

\documentclass{article}
\usepackage{polyglossia}
\setmainlanguage{polish}
\usepackage[
isbn=false,
backend=biber]{biblatex}

\newcommand*{\ifshorttitle}{%
\ifboolexpr{test {\iffieldequalstr{labeltitlesource}{shorttitle}}
and not test {\iffieldsequal{shorttitle}{title}}}}

\DeclareFieldFormat{citetitle}{\mkbibemph{#1\ifshorttitle{\shorttitlepunct}{}}}
\DeclareFieldFormat
[article,inbook,incollection,inproceedings,patent,thesis,unpublished]
{citetitle}{\mkbibquote{#1\ifshorttitle{\shorttitlepunct}{}\isdot}}
\DeclareFieldFormat
[suppbook,suppcollection,suppperiodical]
{citetitle}{#1\ifshorttitle{\shorttitlepunct}{}}

\begin{filecontents}{\jobname.bib}
@book{      kowalska1,
author =    {J. Kowalska},
title =     {Jeden},
location =  {Warszawa},
year =      {2003}
}
@book{      k,
author =    {K. Maciej},
title =     {Very Long and Verbose Ttile: even with longer subtitle},
shorttitle = {Short Title},
location =  {Warszawa},
year =      {2031}
}
\end{filecontents}

\begin{document}
ipsum \autocite{k}
Lorem \autocite{kowalska1}
ipsum \autocite{k}
Lorem \autocite{kowalska1}
\end{document}


• That's a nice trick. Some more learned, I didn't know we could test for which field is currently performing as label. Apr 26, 2018 at 10:18
• Btw, moewe, if I may. I had one particular trouble with my answer which I found strange. I trieded \addspace(\ldots)\isdot and \addspace(\ldots)\addcomma to the sourcemap. It accepts the \addspace(\ldots), as I left it. But either of these constructions, which seem better to me, threw me "undefined control sequence" errors. Do you know why? Are these macros not available when the sourcemap is executed? Apr 26, 2018 at 10:27
• @gusbrs I think the definitions are expanded when the sourcemap is written to the .bcf file, this is a problem if some of them are only available in a biblatex context, or if the commands are not robust. fieldvalue={\unexpanded{\addspace\bibellipsis\isdot}} works. Apr 26, 2018 at 10:41
• Thanks, moewe, I added this to the answer. But I confess I would expect \DeclareSourcemap to take care of that. The same way formating directives, as \DeclareFieldFormat, do. After all, what goes in fieldvalue is not meant to be used outside a biblatex context to start with. Apr 26, 2018 at 11:11
• @gusbrs I agree. The thing is that writing to files often expands commands, so we would have to stop that behaviour. I had a quick look at the code and did not immediately have an idea how to solve this. You can open an issue at the bugtracker, maybe PLK has an idea. Apr 26, 2018 at 11:14