Cite title only but create auto “hereafter” shorthand

biblatex

I am new to LaTeX and have some questions regarding biblatex.

For my thesis, there will be "Primary Sources" and "Secondary Sources" in the Bibliography section. The abbreviations are for these primary sources only. When I first cite them, I only need the short titles, but I need to let the shorthand start to work when I cite a text for the second time.

Therefore, I would like to know how to use \citetitle to enjoy the function of shorthandintro? I have learnt from here (Custom abbreviation for citation in bibtex) that the second solution only works for \cite. However, what I want to have is to cite a book title (the short one) with "hereafter xxx", and cite only the acronym next time.

For instance:

  • in a paragraph: Manusmṛti (hereafter MS)… From the MS we know …
  • in the bibliography:
    Primary sources: [MS] Manusmṛti with Manubhāṣya. Edited by …
    Secondary sources: Karl, M. (1987). How to cite something. Oxford.
\documentclass[12pt]{article}
\usepackage{fontspec}
\usepackage{polyglossia}
\usepackage{filecontents}

\usepackage[backend=biber,
citestyle=authoryear,
bibstyle=alphabetic,
sorting=nty, 
citetracker=true]{biblatex}

\begin{filecontents*}{\jobname.bib} 

@book{ms32,
  editor  = {XXX},
  title   = {MS in wonderland with others and so on},
  shorttitle = MS in wonderland
  year = {1932},
  publisher    = {YYY},
  shorthand = {MS},
  keywords = {Primary},
}

@book{Karl87,
  author  = {Mark Karl},
  title   = {How to cite something},
  year = {1987},
  publisher    = {Oxford},
  keywords = {Secondary},
}

\end{filecontents*}


\addbibresource{\jobname.bib}

\newbibmacro*{longcite}{%
  \ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
    {\usebibmacro{cite:lable}%
     \setunit{\addspace}}
    {\printnames{labelname}%
     \setunit{\nameyeardelim}}%
  \usebibmacro{cite:labelyear+extrayear}}
%Can I make some changes here, so \citetitle also works?

\renewbibmacro*{cite:title}{%
  \ifciteseen
    {\iffieldundef{shorthand}
      {\usebibmacro{longcite}}
      {\usebibmacro{cite:shorthand}}}
    {\usebibmacro{longcite}
     \usebibmacro{shorthandintro}}}

\begin{document}

This is found in \citetitle{ms32} (the short title "MS in wonderland" is shown here). Something else... and cite again but use the acronym MS, \cite{ms32} works perfectly as showing only the MS.

To cite a secondary source, \textcite[36]{Karl87}.


\printbibliography[keyword={Primary},title={Primary Sources}] 
\printbibliography[keyword={Secondary},title={Secondary Sources}]


\end{document}

Best Answer

If we can assume that an entry has a shorthand field if and only if it is a primary source, I would suggest the following approach.

We no longer filter by keyword, but instead use the bibcheck suggested in biblatex: excluding shorthand entries from the main bibliography to filter entries with shorthands. To print the shorthands we can use \printshorthands.

Note that you get better results with options = {useeditor=false}, if you don't want the editor to be displayed before the title in the list of shorthands for the relevant work.

\documentclass[12pt]{article}
\usepackage[
  backend=biber,
  style=authoryear,
  citetracker=true,
]{biblatex}

\defbibcheck{noshorthand}{%
  \iffieldundef{shorthand}{}{\skipentry}%
}

\newbibmacro*{normalcite}{%
  \ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
    {\usebibmacro{cite:label}%
     \setunit{\printdelim{nonameyeardelim}}}
    {\printnames{labelname}%
     \setunit{\printdelim{nameyeardelim}}}%
  \usebibmacro{cite:labeldate+extradate}}

\renewbibmacro*{cite}{%
  \iffieldundef{shorthand}
    {\usebibmacro{normalcite}}
    {\ifciteseen
       {\usebibmacro{cite:shorthand}}
       {\usebibmacro{cite:label}%
        \usebibmacro{shorthandintro}}}}

\begin{filecontents*}{\jobname.bib} 
@book{ms32,
  editor     = {XXX},
  title      = {MS in wonderland with others and so on},
  shorttitle = {MS in wonderland},
  year       = {1932},
  publisher  = {YYY},
  shorthand  = {MS},
  keywords   = {Primary},
  options    = {useeditor=false},
}
@book{Karl87,
  author    = {Mark Karl},
  title     = {How to cite something},
  year      = {1987},
  publisher = {Oxford},
  keywords  = {Secondary},
}
\end{filecontents*}
\addbibresource{\jobname.bib}

\begin{document}
Lorem \cite{ms32}
ipsum \cite{ms32}
dolor \textcite[36]{Karl87}.

\printshorthands[title={Primary Sources}] 
\printbibliography[check=noshorthand, title={Secondary Sources}]
\end{document}

Lorem MS in wonderland (henceforth cited as MS) ipsum MS dolor Karl (1987, p. 36).
MS MS in wonderland (1932). MS in wonderland with others and so on. Ed. by XXX. YYY.
Karl, Mark (1987). How to cite something. Oxford.