pandoc icon indicating copy to clipboard operation
pandoc copied to clipboard

-@Citekey outside square brackets not working

Open bcdavasconcelos opened this issue 3 years ago • 7 comments

Hello John,

I noticed that sometime in the past month or so -@Citekey stopped working (meaning that it will display both author and date) and that one now has to add square brackets to get just the year of the publication [-@Citekey]. I wonder if it would be possible to revert to the old behavior and allow it to be typed outside of square brackets.

Thank you for maintaining and developing this wonderfully useful tool.

bcdavasconcelos avatar Apr 09 '21 12:04 bcdavasconcelos

The following diff will restore the old behavior. But I'm wondering whether we should. I actually hadn't intended for -@citekey to work in the first place -- the "bare" form is for an author-in-text citation, and if you're suppressing the author it doesn't make much sense!

diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
index 6c3947a81..ceb2f48d0 100644
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -1500,7 +1500,7 @@ inline = do
      '\145'  -> smart
      '\8220' -> smart
      '\147'  -> smart
-     '-'     -> smart
+     '-'     -> cite <|> smart
      '.'     -> smart
      '&'     -> return . B.singleton <$> charRef
      ':'     -> emoji

jgm avatar Apr 09 '21 21:04 jgm

My CSL file does not add the parenthesis automatically. This allows me to use Citeproc for citing reference works and ancient sources that come frequently outside of the parenthesis. E.g. @KrRV, @EN, @APo and so on.

This means that, for other works of the secondary literature, I cite using normal parenthesis (@citekey) and not square brackets [@citekey]. With the old behavior, I could write (@Frede2012, -@Frede2013), but now it would have to be (@Frede2012, [-@Frede2013]). This is very minor, of course. It would simply mean less clutter. Should it be the cause of other issues, please leave it aside. But if this proves to be harmless, I would appreciate the flexibility.

bcdavasconcelos avatar Apr 10 '21 22:04 bcdavasconcelos

Should we close this?

bcdavasconcelos avatar Jun 02 '21 00:06 bcdavasconcelos

I still want to think about it, so we can keep it open

jgm avatar Jun 02 '21 03:06 jgm

@bcdavasconcelos Regarding:

(@Frede2012, [-@Frede2013])

Here I think you're trying to do something manually that should be controlled by the style. Some CSL styles do "citation collapsing", e.g. "(Frede 2012, Frede 2013)" -> "(Frede 2012, 2013)". So you should be using a style with this feature.

jgm avatar Dec 16 '21 20:12 jgm

Agreed, @jgm. Thanks for bringing this to my attention.

This remains the case, however, in different circumstances, such as:

According to Frede, lorem ipsum dolor sit amet, consectetur adipisicing elit ([-@Frede2012], cf. @Nails2002).

But, as I said, this is minor. If the brackets are actually doing important work there, I am happy to keep coping with them. (I actually made a filter to add them before processing the text).

bcdavasconcelos avatar Dec 21 '21 13:12 bcdavasconcelos

On this issue, @jgm would it be possible to have the syntax of -@citekey in a footnote itself so as to suppress an author? This is helpful when citing an ancient primary source, followed by a modern translation where with the modern translation one does not want the author repeated, e.g.:

[^1]: Augustine, _Confessiones_ 10.12, -@Augustine2006, 78.

At the moment this will not work, and I have to have the following:

[^1]: Augustine, _Confessiones_ 10.12, [-@Augustine2006, 78].

This leaves a messy looking footnote with the modern translation surrounded by parentheses.

Ratramnus avatar May 18 '22 12:05 Ratramnus