2

I've implemented a circa tag in my .bib file using natbib as per the this tex.stackexchange.com answer.

Is there an easy way to modify this so that I can produce the "ca." in the in-text citation? As far as I can tell, natbib extracts the last four characters in the year field to be produced in the in-text citation, so I am not sure of how to easily add characters to the front without doing an \xpatchcmd{} or similar.

MWE:

The .bst is here.

\documentclass{article}

\usepackage{url}
\usepackage{csquotes}
\usepackage{natbib}
\usepackage{filecontents}

\newcommand{\noopsort}[1]{} % old BibTeX trick

\begin{filecontents}[overwrite]{\jobname.bib}
@book{dante_paradiso_1317,
    title = {Paradiso},
    author = {Alighieri, Dante},
    year = {\noopsort{1317}ca. 1317},
    note = {Canto XVI}
}

@book{asimov_robot_1950,
  title={I, Robot},
  author={Asimov, I.},
  isbn={9780451012821},
  lccn={68070665},
  series={Panther science fiction},
  url={https://books.google.co.nz/books?id=MD0GAQAAIAAJ},
  year={1950},
  publisher={Dennis Dobson}
}

\end{filecontents}

\begin{document}
    In \textit{Paradiso}, Dante writes
    
    \begin{displayquote}
        E come 'l volger del ciel de la luna \\
        cuopre e discuopre i liti sanza posa, \\
        così fa di Fiorenza la Fortuna: \\
        \begin{flushright}
            -- Alighieri (ca. 1317)\nocite{dante_paradiso_1317}
        \end{flushright}
    \end{displayquote}

    which is a really cool line in Canto XVI. Also in \textit{I, Robot}, Asimov introduces the three laws of robotics:

    \begin{displayquote}
        The First Law: A robot may not injure a human being or, through inaction, allow a human being to come to harm. \\
        The Second Law: A robot must obey the orders given it by human beings except where such orders would conflict with the First Law. \\
        The Third Law: A robot must protect its own existence as long as such protection does not conflict with the First or Second Law.
        \begin{flushright}
            -- \citet{asimov_robot_1950}
        \end{flushright}
    \end{displayquote}

    \bibliographystyle{mnras}
    \bibliography{\jobname.bib}
\end{document}

MWE Output:

The output of the MWE.

Desired Output:

My desired output

1 Answer 1

1

In short, I needed to edit the .bst file. In the definition of calc.label,

  year field.or.null purify$ #-1 #4 substring$  % use all four digits

becomes

  year field.or.null #-1 #8 substring$  % use all eight characters (year + "ca. " if it exists)

If you want to use a shorter "ca. ", change #8. The digit must be 4+number of characters preceding the year in the .bib key to include.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .