Is there a way to cite TV Shows and Episodes with the MLA style?

I have been trying to find a workaround for this issue for days and am now at my wits’ end.
I am using Typst for the first time, and I am new to coding. My issue is that the MLA format that Typst uses doesn’t support Television shows and episodes, but my BA is about sitcoms, so that is very unfortunate.
I have tried using a .csl file from GitHub and adding/changing the macros for Television shows and episodes, but I always ran into some form of error code and just kept running in circles. I tried to define the citation format separately, but that also didn’t work. I even ended up asking ChatGPT, and the conclusion it came to was that I needed to do it manually, which I can do but that would be a pain.
My goal is that in-text citations or references use the title and not the author.

Example:

  1. During the interaction between the characters in #cite(<lockdown_B99>, form: "prose"), it becomes evident that…
    OR
  2. During the characters’ interaction, it becomes evident… @lockdown_B99

Output should be:

  1. During the interaction between the characters in “Lockdown,” it becomes evident that…
    OR
  2. During the characters’ interaction, it becomes evident… (“Lockdown,” 00:10:24)

Output is:

  1. During the interaction between the characters in Linda Mendoza (director), it becomes evident…
    OR
  2. During the characters’ interaction, it becomes evident… (Linda Mendoza, director)

The issue is that if I leave out the “author” (being the creator or director) to force the program to use the title, the work cited entry is incomplete.
The entries in my .bib look like this:
Episode:

@misc{key,
  title       = {Episode Title},
  booktitle   = {Show Name},
  author      = {{creator} {director}},
  year        = {year},
  howpublished= {Network/production company},
  note        = {Season #, Episode #. Streaming Platform. URL}
}

show: 
@misc{key,
  title       = {Show Name},
  author      = {{creators}},
  year        = {running time},
  howpublished= {production company/network},
}

Goal for work cited is:

Episode:
"Title of Episode." *Title of TV Series*, Contributors Name(s), season, episode,  Production Company, Year of Release. Name of Streaming Website, URL.
Show:
*Title of Series.* Creators, Prod. Comp., Running Time. Name of Streaming Service, URL.

In-text citation/reference:
First point of work cited page, so either “Episode Title” or Title of Series

I am really grateful for any kind of advice because I am starting to lose my hair over this issue, and going bald over my BA was not on my Bingo card (I am exaggerating, but it is really annoying).

1 Like

Hi welcome!

Could you clarify what is 00:10:24?
Also, you’ve provided both “Output should be” and “In-text citation/reference”, but they’re different. Which one is preferred?

My half answer so far:

main.typ
#set page(height: auto, width: 240pt, margin: 15pt)

// In case you have other citations, I use `#tv(<label>)` here.
#let tv = cite.with(style: "television.csl")

- During the interaction between the characters in #tv(<show>), it becomes evident that…

- During the characters’ interaction, it becomes evident… #tv(<episode>)

#let bib = ```bib
% Some how, booktitle in misc will be ignored
@incollection{episode,
  title = {Episode Title},
  booktitle = {Show Name},
  author = {{Creator} and {Director}},
  date = {2161},
  howpublished = {Network/production company},
  note = {Season 1, Episode 1. Streaming Platform. URL},
}

@misc{show,
  title = {Show Name},
  author = {{Creators}},
  date = {2161},
  howpublished = {production company/network},
}
```.text

#bibliography(
  bytes(bib),
  style: "modern-language-association",
)
television.csl
<?xml version='1.0' encoding='utf-8'?>
<style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0">
  <info>
    <title>TV shows and episodes</title>
    <id>https://forum.typst.app/t/is-there-a-way-to-cite-tv-shows-and-episodes-with-the-mla-style/6522</id>
  </info>
  <citation>
    <layout>
      <choose>
        <if variable="container-title">
          <text value="("/>
          <text variable="container-title" prefix="“" suffix=",” " />
          <text value="hard-coded 00:10:24" />
          <text value=")"/>
        </if>
        <else>
          <text variable="title" prefix="“" suffix="”" />
        </else>
      </choose>
    </layout>
  </citation>
  <bibliography>
    <layout>
      <text value="This CSL style is only intended for citations, not bibliography."/>
    </layout>
  </bibliography>
</style>

Hi,
Thanks for taking the time to help me with this issue.
Sorry for not clarifying, 00:10:24 is just a hypothetical timecode to mark the exact point I am referring to.

I used the term ‘in-text citation’ synonymously with ‘prose style’. I used the wrong coding in the example; it should be #cite(, form: “prose”). I used ‘reference’ to refer to the citation at the end of the sentence in brackets.

Or do you mean further down the “First point of work cited page” bit? The two are different because single episodes and complete shows have different citation formats; however, in both cases, the variable that’s first in a full citation is used for in-text references.

So for a whole show it would be:
The show Friends frequently features a coffee shop.

Basically, I need to introduce two new citation formats into my document, one for episodes and one for entire shows.
Does that make sense?

1 Like

Hi there, welcome to the forum,

Would it be possible to edit your first post to format you code to improve readability please? The editor has quite a few options for that, including bullets and code blocks such as:

1 Like

Hi,

I tried giving it some more structure and improve readability. Thanks for the hint :)

1 Like

I’m afraid it’s impossible to achieve it with #cite(, form: “prose”) + CSL, because do_author is hard-coded by typst.

Instead, I managed to develop a CSL with a special #tv(<key>) function.

(At present, it only conforms to your citation format.)

#let tv = cite.with(style: "television.csl")

- During the interaction between the characters in #tv(<show>), it becomes evident that…

- During the characters’ interaction, it becomes evident… #tv(<episode>, supplement: [00:10:24])

#let televisions = ```yaml
episode:
  type: video
  title: Title of Episode
  author:
    - Creator
    - Another contributor
  director: Director
  date: 2161
  note: Season 1, Episode 1.
  archive: Streaming Platform
  url: https://example.com
  parent:
    title: Title of TV Series
    author: Production company
show:
  type: video
  title: Title of Series
  author:
    - Creators
  date: 1999
```.text

#bibliography(
  (
    "ref.bib", // Your other citations
    bytes(televisions),
  ),
  style: "modern-language-association",
)
television.csl
<?xml version='1.0' encoding='utf-8'?>
<style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0">
  <info>
    <title>TV shows and episodes</title>
    <id>https://forum.typst.app/t/is-there-a-way-to-cite-tv-shows-and-episodes-with-the-mla-style/6522</id>
  </info>
  <macro name="video-episode">
    <text value="("/>
    <text variable="title" prefix="“" suffix=",” " />
    <text variable="locator" />
    <text value=")"/>
  </macro>
  <macro name="video-show">
    <text variable="title" prefix="“" suffix="”" />
  </macro>
  <citation>
    <layout>
      <choose>
        <!--
          Somehow, type="motion_picture" does not match videos with parents.
          https://github.com/typst/hayagriva/blob/799cfdcc5811894f62949a63b155878e2f30b879/src/csl/taxonomy.rs#L636
        -->
        <if type="broadcast">
          <text macro="video-episode"/>
        </if>
        <else-if type="motion_picture">
          <text macro="video-show"/>
        </else-if>
        <else>
          <text value="(Please paste the original CSL here)"/>
        </else>
      </choose>
    </layout>
  </citation>
  <bibliography>
    <layout>
      <text value="This CSL style is only intended for citations, not bibliography."/>
    </layout>
  </bibliography>
</style>
Why *.bib becomes *.yaml?

I switch from *.bib to the hayagriva *.yaml format, in order to make things simpler.

  • For *.bib, the entry type will be converted multiple times: @type in the file → biblatex::EntryTypehayagriva::EntryTypecitationberg::Kind.

    For example, it looks like that @videobiblatex::EntryType::Unknown("video")hayagriva::EntryType::Misccitationberg::Kind::Document, which is ridiculous…

  • For *.yaml, it gets simplified as type: … in the file = hayagriva::EntryTypecitationberg::Kind.

    For the same example, it is type: video = hayagriva::EntryType::Videocitationberg::Kind::MotionPicture.

Details can be found in How do I determine which type a legislation bibentry will have in CSL? - #2 by Y.D.X.

2 Likes

All right, prose form is secondary anyway, I can always rewrite sentences accordingly. Thank you for your help and your work. I am currently implementing it.
To clarify, should I create a separate bibliography in YAML format specifically for the shows and episodes? And reference it like so:

#let tv = cite.with(style: "television.csl")
#let televisions = yaml("Bibliography.yaml")

Using that method, I keep getting the error code

Key does not exist in Bibliography

So, I am assuming I missed a step or did something wrong. Sorry, for the stupid questions, I am still getting the hang of this :sweat_smile:.

Edit: I made sure both keys matched in both the yaml and bib document and now the key is recognized but translated into

Please paste the original CSL here

Unfortunately, yes. You can pass multiple files to the bibliography function.

#bibliography(
  ("ref.bib", "Bibliography.yaml"),
  style: "modern-language-association",
)

Key does not exist in Bibliography

harry: # 👈 Here is the citation key
    type: Book
    title: Harry Potter and the Order of the Phoenix
    author: Rowling, J. K.
    volume: 5
    page-total: 768
    date: 2003-06-21

EDIT:

Please paste the original CSL here

This line pops comes television.csl, because that current version is only for cite(…, style: "television.csl"), not biliography(…, style: "television.csl")

IT WORKED! Took me a moment to find my mistake but it worked! I will just need to manually adjust the work cited entry, but that’s so much less work than doing all in-text references manually.
Genuinely, thank you so much. This massively improves my workflow.

2 Likes

Hello again,
I am not sure what happened, but when I opened the document today, Typst flagged an issue with the code that I don’t know how to fix.

Failed to parse YAML (invalid type: string “televisions.csl”, expected a map between cite keys and entries at 1:1)

I made no changes to the code that worked until yesterday:

#bibliography(
  ( "Bibliography.yaml",
    "Bachelor Bibliography.bib",
bytes("television.csl")),
style: "modern-language-association",
title: [#underline[Work Cited]])

I tried changing it to:

#bibliography(
  ( "Bibliography.yaml",
    "Bachelor Bibliography.bib",
bytes("televisions")),
style: "modern-language-association",
title: [#underline[Work Cited]])

to reference

#let tv = cite.with(style: "television.csl")
#let televisions = yaml("Bibliography.yaml")

The error code remained. I checked the YAML file, and it’s still identical to your solution.
My research on how to solve this issue is once again just leading me in circles. Any idea what happened and how I can fix it? Thank you!

I guess what you meant is to create a televisions.yaml file and record TV shows in it, then write the following typst code?

#let tv = cite.with(style: "television.csl") // Keep the CSL file untouched

#bibliography(
  (
    "Bibliography.yaml",
    "Bachelor Bibliography.bib",
    "televisions.yaml", // Record TV shows here
  ),
  style: "modern-language-association",
  title: [#underline[Work Cited]]
)

Explainations:

There are two ways to specify a bibliography source:

  • Put a path string to load a bibliography file from the given path.

    This is the way you’ve already done with "Bibliography.yaml" and "Bachelor Bibliography.bib"

  • Put raw bytes from which the bibliography should be decoded.

    This is the way I did with #let television = ```…```.text (assign a multi-line string to the variable) and bytes(television) (convert the variable to bytes).

    Note that the bytes function converts strings to bytes. It has nothing to do with file paths or reading files.

    (You can use the read function to read files, but that’s unnecessary in this case.)

In addition, television.csl is the bibliography style/format, not the bibliography source / TV shows. It should be used as the style parameter of bibliography or cite, not the first (positional) parameter of bibliography.

1 Like