Can I use a bold csl style for a bibliography?

I would like to use the style of my University for my bibliography. The tricky thing is that they use bold font for author names. They gave me a CSL file, made for Zotero.

Extract from the CSL file:

<macro name="author">
    <names variable="author">
      <name and="text" initialize-with="." name-as-sort-order="all" sort-separator=" " font-weight="bold"/>
      <et-al font-style="italic"/>
      <label form="short" text-case="lowercase" prefix=", "/>
      <substitute>
        <names variable="editor"/>
        <names variable="translator"/>
        <names variable="director"/>
        <text macro="anon"/>
      </substitute>
    </names>
   
  </macro>

The file works great with Zotero. When I use it in Typst, however, the names are not bold. Is this a limitation of Typst, or am I doing something wrong? Is there a way to fix this?

@Name2025
#bibliography("thesis_bib.bib", style: "MyUniStyle.csl")

I found a way to render the way I want. I have no knowledge at all in XML and I’m new to Typst so you might hurt your soul by reading what is following:

In the CSL file:

...
<bibliography hanging-indent="false">
    <sort>
      <key macro="author"/>
      <key variable="title"/>
    </sort>
    <layout font-variant="normal" text-decoration="none">
      *<text value="#BOLDS"/>*
      <text macro="author" suffix=", "/>
      *<text value="#BOLDE"/>*
      <text macro="year-date" suffix=". "/>
...

In text.typ:

@Name2025
#show regex("\#BOLDS.*?\#BOLDE") : authors => [
  #show ", #BOLDE" : ""
  #show "#BOLDS" : ""
  *#authors*,
]
#bibliography("Stage Cirad.bib", style: "2024_2025_IAD_Style.csl")

I’m still interested to know if there is a less dirty way to do it.

You could use formatting attributes specified in CSL.

How to edit depends on the specific CSL file, but you haven’t provided it.
In most cases, it’s just setting font-weight="bold" on <names> in the author macro.

- <names variable="author">…</names>
+ <names variable="author" font-weight="bold">…</names>

An example code
@Name2025


#bibliography(
  bytes(
    ```bib
    @article{Name2025,
      author = {Author},
      title = {Title},
    }
    ```.text,
  ),
  style: bytes(
    ```csl
      <?xml version="1.0" encoding="utf-8"?>
    <style xmlns="http://purl.org/net/xbiblio/csl" version="1.0" class="in-text">
      <info>
        <title>Minimal example</title>
        <id>https://forum.typst.app/t/can-i-use-a-bold-csl-style-for-a-bibliography/5488</id>
        <version>2025-08-08</version>
      </info>
      <macro name="author">
        <names variable="author" font-weight="bold" />
      </macro>
      <citation>
        <layout><text value="👻 (omitted)" /></layout>
      </citation>
      <bibliography>
        <layout font-variant="normal" text-decoration="none">
          <text macro="author" suffix=", " />
          <text variable="title" />
        </layout>
      </bibliography>
    </style>
    ```.text,
  ),
)

Also worth testing on multiple authors (et al.) and in case your style has separate macros e.g. author-short.

or conditional parts you need to catch:

 <else-if type="personal_communication">
   <group delimiter=" ">
      <group delimiter=" from ">
         <text variable="genre"/>
           <names variable="author">

Typst has always honoured the styles I’ve applied in the CSL style, so you’ll probably be able to remove your regex. If you’ve not seen it, Zotero has a good editor/tester that ensures you have caught each change required (prefs/cite/style editor):

2 Likes

Many thanks for your help. Adding " font-weight="bold" in “<names variable="author">” worked good enougth for me. However, this made the “and” (“et” in this case) and the coma appear bold as well. This is not intented by the creators of the style, I think this is why it was in <name and="text" initialize-with="." name-as-sort-order="all" sort-separator=" "/> in the first place. It’s not a major problem, and I had the same with my first solution with regex, but it might be something to investigate here.

Original style:

Modified style after moving " font-weight="bold"" like suggested by Y.D.X:

If you know a way to render like the first image in Typst, I’m still interested. Else maybe it needs to be a bug issue?

Here is the full CSL:

<?xml version="1.0" encoding="utf-8"?>
<style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0" demote-non-dropping-particle="sort-only" default-locale="fr-CA">
  <info>
    <title>Institut Agro Dijon Style 2024-2025</title>
    <id>http://www.zotero.org/styles/agrosupdijon</id>
    <link rel="self" href="http://www.zotero.org/styles/agrosupdijon"/>
    <author>
      <name>Jean-Hugues Roy</name>
      <email>jh@jhroy.ca</email>
    </author>
    <contributor>
      <name>Stéphanie Bouvier</name>
      <email>stb.bouvier@gmail.com</email>
    </contributor>
    <contributor>
      <name>Julien Sicot</name>
      <email>julien.sicot@gmail.com</email>
    </contributor>
    <contributor>
      <name>Annabelle Filatre</name>
      <email>annabelle.filatre@gmail.com</email>
    </contributor>
	<contributor>
      <name>Raphaël Heckmann</name>
      <email>raphael.heckmann@agrosupdijon.fr</email>
    </contributor>
	<contributor>
      <name>Emmanuelle Delarche</name>
      <email>Emmanuelle.delarche@agrosupdijon.fr</email>
    </contributor>
	<contributor>
      <name>Cosette Grandvalet</name>
      <email>cosette.grandvalet@agrosupdijon.fr</email>
    </contributor>
	<contributor>
      <name>Stéphanie Gibot-Leclerc</name>
      <email>stephanie.gibot-leclerc@agrosupdijon.fr></email>
    </contributor>
    <category citation-format="author-date"/>
    <category field="communications"/>
    <summary>Ce style a été créé à partir du style de citation des références bibliographiques du Département d'information et de communication de l'Université Laval.</summary>
    <updated>2024-08-27T11:26:55+00:00</updated>
    <rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights>
  </info>
  <macro name="anon">
    <text term="anonymous" form="short" text-case="capitalize-first" strip-periods="true"/>
  </macro>
  <macro name="author">
    <names variable="author">
      <name and="text" initialize-with="." name-as-sort-order="all" sort-separator=" " font-weight="bold"/>
      <et-al font-style="italic"/>
      <label form="short" text-case="lowercase" prefix=", "/>
      <substitute>
        <names variable="editor"/>
        <names variable="translator"/>
        <names variable="director"/>
        <text macro="anon"/>
      </substitute>
    </names>
   
  </macro>
  <macro name="author-short">
    <names variable="author">
      <name form="short" and="text" et-al-min="3" initialize-with=". "/>
      <et-al font-style="italic"/>
      <substitute>
        <names variable="editor"/>
        <names variable="translator"/>
		<names variable="director"/>
        <text macro="anon"/>
      </substitute>
    </names>
  </macro>
<macro name="isbn">
    <text variable="ISBN" prefix="ISBN "/>
  </macro>
  <macro name="editor">
    <names variable="editor" suffix=". ">
      <name delimiter-precedes-last="always" initialize-with="." name-as-sort-order="all" sort-separator=" ">
        <name-part name="family" text-case="capitalize-first"/>
        <name-part name="given" text-case="capitalize-first"/>
      </name>
      <label form="short" prefix=" (" suffix=")" text-case="lowercase"/>
    </names>
  </macro>
  <macro name="publisher">
    <text variable="publisher-place" suffix=" : "/>
    <text variable="publisher"/>
  </macro>
  <macro name="access">
    <choose>
      <if type="webpage post-weblog motion_picture legislation regulation entry-encyclopedia paper-conference thesis report" match="any">
        
        <group>
          <text variable="URL"/>
        </group>
      </if>
      <else-if match="any" variable="DOI">
        <text value=" DOI : "/>
        <group>
          <text variable="DOI"/>
        </group>
      </else-if>
    </choose>
  </macro>
  <macro name="accessed-date">
    <choose>
      <if type="webpage post-weblog motion_picture entry-encyclopedia report" match="any">
        <group>

          <text value="Consulté le " prefix="("/>
          <date form="text" variable="accessed" suffix=")"/>

        </group>
      </if>
    </choose>
  </macro>
  <macro name="year-date">
    <choose>
      <if variable="issued" match="any">
        <date variable="issued">
          <date-part name="year"/>
        </date>
      </if>
      <else>
        <text term="no date" form="short" strip-periods="true" prefix="[" suffix="]"/>
      </else>
    </choose>
  </macro>
  <macro name="journal-title">
    <choose>
      <if type="chapter paper-conference article-magazine article-newspaper broadcast motion_picture entry-encyclopedia" match="any">
        <group suffix=". ">
          <text variable="container-title" font-style="italic"/>
        </group>
      </if>
      <else-if type="article-journal" match="any">
        <text variable="container-title" font-style="italic" suffix=", "/>
      </else-if>
    </choose>
  </macro>
  <macro name="title">
    <group delimiter=" ">
      <choose>
        <if type="chapter paper-conference article-journal article-magazine article-newspaper broadcast entry-encyclopedia speech" match="none">
          <text variable="title" font-style="italic"/>
          <choose>
            <if match="all" type="report">
              <text variable="number" text-case="capitalize-first" prefix=" (" suffix=")."/>
            </if>
          </choose>
        </if>
        <else>
          <group suffix=".">
            <text variable="title" quotes="false"/>
          </group>
        </else>
      </choose>
    </group>
  </macro>
  <macro name="edition">
    <choose>
      <if is-numeric="edition">
        <group delimiter=" ">
          <number variable="edition" form="ordinal"/>
          <text term="edition" form="short"/>
        </group>
      </if>
      <else>
        <text variable="edition" suffix=". "/>
      </else>
    </choose>
  </macro>
  <macro name="collection">
    <choose>
      <if variable="collection-number">
        <text variable="collection-title" prefix="("/>
        <text variable="collection-number" prefix=", " suffix=")"/>
      </if>
      <else>
        <text variable="collection-title" prefix="(" suffix="). "/>
      </else>
    </choose>
  </macro>
  <macro name="locators">
    <choose>
      <if type="report" match="any">
        <text variable="page" suffix=" p."/>
      </if>
      <else-if type="article-journal" match="all" variable="DOI">
        <text variable="volume"/>
        <text variable="issue" prefix=" (" suffix=")"/>
        <text variable="page" prefix=", p. "/>
      </else-if>
      <else-if type="article" match="all" variable="URL">
        <text variable="volume"/>
        <text variable="issue" prefix="(" suffix=")"/>
        <text variable="page" prefix=", p. "/>
      </else-if>
      <else>
        <text variable="volume"/>
        <text variable="issue" prefix="(" suffix=")"/>
        <text variable="page" prefix=", p. " suffix="."/>
      </else>
    </choose>
  </macro>
  <macro name="event">
    <choose>
      <if type="speech" match="any">
        <text value="Présenté à : "/>
        <group>
          <text variable="event" font-style="italic" suffix=", "/>
          <text variable="event-place" font-style="normal" suffix="."/>
        </group>
      </if>
    </choose>
  </macro>
  <macro name="container-title">
    <choose>
      <if type="legislation" match="any">
        <text variable="container-title" prefix="(" suffix=", "/>
        <text variable="volume" suffix=" ), "/>
      </if>
    </choose>
  </macro>
  <macro name="number">
    <choose>
      <if type="report" match="any">
        <group>
          <text variable="number" prefix="( " suffix=" )"/>
        </group>
      </if>
    </choose>
  </macro>
  <macro name="number_of_pages">
    <choose>
      <if type="report" match="any">
        <text variable="number-of-pages" prefix=" " suffix=" p."/>
      </if>
    </choose>
  </macro>
  <citation et-al-min="4" et-al-use-first="1" disambiguate-add-year-suffix="true" disambiguate-add-names="true" disambiguate-add-givenname="true">
    <layout prefix=" (" suffix=")" delimiter=" ; ">
      <group delimiter=", ">
        <text macro="author-short"/>
        <text macro="year-date"/>
		<!-- <text variable="page" prefix="p. "/> -->
      </group>
    </layout>
  </citation>
  <bibliography hanging-indent="false">
    <sort>
      <key macro="author"/>
      <key variable="title"/>
    </sort>
    <layout font-variant="normal" text-decoration="none">
      <text macro="author" suffix=", "/>
      <text macro="year-date" suffix=". "/>
      <choose>
        <if type="thesis">
          <text value="" suffix=". "/>
        </if>
      </choose>
      <text macro="title" suffix=". "/>
      <choose>
        <if type="thesis">
          <text variable="genre" prefix="(" suffix="). "/>
          <text macro="publisher" suffix=". "/>
          <text variable="number-of-pages" prefix=", " suffix=" p."/>
        </if>
		
		
		
		
		
        <else-if type="bill book graphic legal_case legislation song" match="any">
          <text macro="edition"/>
          <text macro="publisher"/>
          <text variable="number-of-pages" prefix=", " suffix=" p. "/>
<text macro="isbn"/>
          <text macro="collection"/>
        </else-if>
        <else-if type="patent">
          <text variable="number" prefix="(" suffix="). "/>
          <text macro="publisher"/>
          <text variable="authority" suffix=", "/>
          <text variable="page" suffix=" p."/>
<text variable="ISBN"/>

        </else-if>
        <else-if type="chapter" match="any">
          <group prefix=" ">
            <text value="dans" suffix=" : " text-case="capitalize-first"/>
            <text macro="editor"/>
            <text macro="journal-title"/>
            <text variable="event" suffix=". " font-style="italic"/>
          </group>
          <text macro="publisher" prefix=" "/>
          <text variable="page" prefix=", p. " suffix=". "/>

        </else-if>
        <else-if type="entry-dictionary entry-encyclopedia" match="any">
          <group>
            <text value="dans" text-case="capitalize-first" suffix=" : "/>
            <text variable="container-title" font-style="italic" suffix=". "/>
          </group>
          <choose>
            <if match="any" variable="URL">
              <text variable="publisher-place" suffix=" : "/>
              <text variable="publisher" suffix=". "/>
            </if>
            <else>
              <text variable="publisher-place" suffix=" : "/>
              <text variable="publisher" suffix=","/>
            </else>
          </choose>
          <text variable="page" prefix=" p. " suffix="."/>
        </else-if>
        <else-if type="paper-conference" match="all">
          <text value="dans" text-case="capitalize-first" suffix=" : "/>
          <text variable="event" font-style="italic" suffix=". "/>
          <text variable="container-title" font-style="italic" suffix=". "/>
          <text variable="publisher-place" suffix=" : "/>
          <text variable="publisher" suffix=", "/>
          <text variable="page" prefix=" p. " suffix=". "/>
        </else-if>
        <else-if type="motion_picture" match="any">
          <text variable="publisher" suffix="."/>
        </else-if>
        <else-if type="report" match="any">
          <text variable="publisher-place" suffix=" : "/>
          <text variable="publisher" suffix=","/>
          <text variable="page" prefix=" " suffix=" p."/>
        </else-if>
        <else-if type="broadcast" match="any">
          <text value="dans" text-case="capitalize-first" suffix=" : "/>
          <text variable="container-title" font-style="italic" suffix=". "/>
          <text variable="publisher-place" suffix=" : "/>
          <text variable="publisher" suffix="."/>
        </else-if>
        <else>
          <text macro="journal-title"/>
          <choose>
            <if type="article-newspaper" match="all" variable="URL">
              <date form="numeric" variable="issued" suffix="."/>
            </if>
            <else-if type="article-newspaper" match="any">
              <date form="numeric" variable="issued"/>
            </else-if>
          </choose>
          <group suffix=". ">
            <text macro="locators"/>
          </group>
        </else>
      </choose>
      <text macro="event"/>
      <text macro="access"/>
      <text macro="accessed-date" prefix=" " suffix=". "/>
      <choose>
        <if type="bill book chapter graphic legal_case legislation motion_picture paper-conference song report" match="any"/>
      </choose>
    </layout>
  </bibliography>
</style>

1 Like

Indeed! font-weight="bold" on <names> is respected, but that on <name> is not.

Minimal example:

<names variable="author" font-weight="bold" />
<names variable="author">
  <name font-weight="bold" />
</names>

Full code
@Name2025


#bibliography(
  bytes(
    ```bib
    @article{Name2025,
      author = {Author},
      title = {Title},
    }
    ```.text,
  ),
  style: bytes(
    ```csl
      <?xml version="1.0" encoding="utf-8"?>
    <style xmlns="http://purl.org/net/xbiblio/csl" version="1.0" class="in-text">
      <info>
        <title>Minimal example</title>
        <id>https://forum.typst.app/t/can-i-use-a-bold-csl-style-for-a-bibliography/5488</id>
        <version>2025-08-11</version>
      </info>
      <citation>
        <layout><text value="👻 (omitted)" /></layout>
      </citation>
      <bibliography>
        <layout>
          <names variable="author" font-weight="bold" />
          <names variable="author">
            <name font-weight="bold" />
          </names>
        </layout>
      </bibliography>
    </style>
    ```.text,
  ),
)

Fortunately, it has been fixed by Simon Waloschek in April:

I’ve compiled typst with the latest hayagriva, and the following image is the result of the same code.

-hayagriva = "0.8.1"
+hayagriva = { git = "https://github.com/typst/hayagriva", rev = "90ee442" }

Let’s wait for typst v0.14. Your CSL will work as expected (without any modification) in the future.

2 Likes