jgm / citeproc

CSL citation processing library in Haskell
BSD 2-Clause "Simplified" License
153 stars 14 forks source link

textsc in BibLaTeX author field ignored #63

Open whrose opened 3 years ago

whrose commented 3 years ago

In the new citeproc protocol pandoc will pick up text in a LaTeX textsc environment in a number of fields in a BibLaTeX entry, but not in the author field — unlike the old citeproc. Maybe I have missed something, maybe it is a bug. See the example below.

@online{Councileu2021Minute,
    author       = {{Council \textsc{eu}}},
    title        = {{Council \textsc{eu} Draft Minutes 22 February 2021}},
    year         = {2021},
    url          = {https://data.consilium.europa.eu/doc/document/ST-6435-2021-INIT/en/pdf},
}

Earlier

Council [eu]{.smallcaps}. 2021. 'Council [eu]{.smallcaps} Draft Minutes 22 February 2021'. 2021. https://data.consilium.europa.eu/doc/document/ST-6435-2021-INIT/en/pdf.

Recently

Council eu. 2021. 'Council [eu]{.smallcaps} Draft Minutes 22 February 2021'. 2021. https://data.consilium.europa.eu/doc/document/ST-6435-2021-INIT/en/pdf.

jgm commented 3 years ago

The type we use in citeproc to represent a name just has plain strings:

data Name =                                 
  Name               
  { nameFamily              :: Maybe Text            
  , nameGiven               :: Maybe Text             
  , nameDroppingParticle    :: Maybe Text        
  , nameNonDroppingParticle :: Maybe Text                
  , nameSuffix              :: Maybe Text                      
  , nameCommaSuffix         :: Bool
  , nameStaticOrdering      :: Bool
  , nameLiteral             :: Maybe Text               
  }                                      
  deriving (Show, Eq, Ord) 

This makes it a lot easier to work with (for all the name manipulations we need to do, like abbreviations). I can see how this is less than ideal in a few cases, like yours. We can leave this issue open, but it is not a small change that is needed. Perhaps we could set things up so that formatting is allowed in nameLiteral but not the other components...

whrose commented 3 years ago

I hope the problem can be solved one day, but I respect that you have other things on your mind. I continue to be a great fan of pandoc (I published a 320p book using pandoc in December last year). Thanks for all your work!

On 16 Apr 2021, at 19:35, John MacFarlane @.***> wrote:

 The type we use in citeproc to represent a name just has plain strings:

data Name =
Name
{ nameFamily :: Maybe Text
, nameGiven :: Maybe Text
, nameDroppingParticle :: Maybe Text
, nameNonDroppingParticle :: Maybe Text
, nameSuffix :: Maybe Text
, nameCommaSuffix :: Bool , nameStaticOrdering :: Bool , nameLiteral :: Maybe Text
}
deriving (Show, Eq, Ord) This makes it a lot easier to work with (for all the name manipulations we need to do, like abbreviations). I can see how this is less than ideal in a few cases, like yours. We can leave this issue open, but it is not a small change that is needed. Perhaps we could set things up so that formatting is allowed in nameLiteral but not the other components...

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

jblachly commented 3 years ago

@whrose a potential solution is to use luascript to scan and replace name-parts with formatted data using AST elements like Strong. I currently have a transformer working, which I verified in the outputted AST.

Unfortunately the transform seems to run after the bibliography has been rendered(?) so the citation contains original unmodified text element. Will probably turn to the mailing list for help, but thsi is very close to being a solution to your problem (mine is similar -- need to bold face my name in my CV)

edit: Well, bad news. Although I can use a transforming Luascript to modify the citation metadata and manifest this in a bibliography with a two step process (csljson -> md -> pdf), for exactly the reasons that John outlines above, the author formatting , even when present in the intermediate markdown, is lost. Unless there's a way to -- within a single pandoc run -- retrigger document generation after modifying the metadata in AST, out of luck.