How to implement the bibtex @string in hayagriva yaml?

I want to convert individual bibtex entries to hayagriva by hand.

In my bibtex file have

@string{ACMTM = "ACM Trans. Math. Software"}

and later

@article{ANDERSEN:96:H,

 author       = "K. D. Andersen",
 title        = "{A Modified Schur Complement Method for Handling
                  Dense Columns in Interior-Point Methods for Linear
                  Programming}",
 journal      = ACMTM,
 volume       = 22,
 number       = 3,
 pages        = "348--356",
 year         = 1996
}

Note ACTMM is a macro I can use in multiple places, which helps me be consistent.

Can I have macros in hayagriva? Or what do you suggest?

Erling

PS. I tried to convert my 25 year old bibtex file with hayagriva with zero success. So I gave up on that.

Hello @Erling_D_Andersen,

You can achieve this using YAML anchors. Here is a MWE:

#let bib = bytes(
  ```yaml

  constants:
    type: misc
    title: &var-title The Constant Title

  a:
    type: book
    title: *var-title
  ```.text,
)

@a
#bibliography(bib)
Solution for your case:
#let bib = bytes(
  ```yaml

  constants:
    type: book
    title: &var-title The Constant Title
    journal: &ACMTM ACM Trans. Math. Software

  a:
    type: book
    title: *var-title

  ANDERSEN:96:H:
    type: Article
    author: K. D. Andersen
    title: "A Modified Schur Complement Method for Handling Dense Columns in Interior-Point Methods for Linear Programming"
    journal: *ACMTM
    volume: 22
    issue: 3
    page-range: 348-356
    date: 1996
  ```.text,
)

#yaml(bib).at("ANDERSEN:96:H").journal

@ANDERSEN:96:H
#bibliography(bib)

Could I please ask you to edit the title of your post for it to conform to our guidelines:

Also if you could surround your code with backticks, as in ``` code here ``` or

```
code here
```

This way, it is easier for everyone to read your code and to copy and paste it in their editor ;)

1 Like

I have modified the question title.

So the anchor stuff is not a feature of Hayagriva but of the YAML specification. That is why I could not find anything about it in the Hayagriva documentation.

Thank you for that, if you could also please edit your post and add the backticks ` to format the code you provided. You will notice when you don’t, some characters (like the double quotes) won’t appear properly.

Are you satisfied with the solution? If so, please mark the post you consider to be the answer with :white_check_mark: so others can find it.

Welcome to the forum :nerd_face: