Example of a Template SegmentΒΆ

{
  "$schema": "../../schema/segment.schema.json",
  "identifier": "ipypublish-biblio_natbib",
  "description": "with the main ipypublish bibliography",
  "segments": {
    "document_packages": [
      "",
      "% bibliography formatting",
      "((*- if nb.metadata.ipub and nb.metadata.ipub.biboptions: *))",
      "\\usepackage[(((nb.metadata.ipub.biboptions | dict_to_kwds)))]{natbib}",
      "((*- else *))",
      "\\usepackage[numbers, square, super, sort&compress]{natbib}",
      "((*- endif *))",
      "% hyperlink doi's",
      "\\usepackage{doi}"
    ],
    "document_bibliography": [
      "",
      "((*- if nb.metadata.ipub: -*))",
      "((*- if nb.metadata.ipub.bibliography: -*))",
      "((* set filename = nb.metadata.ipub.bibliography | strip_ext | posix_path *))",
      "((*- if nb.metadata.ipub.bibstyle: *))",
      "\\bibliographystyle{((( nb.metadata.ipub.bibstyle )))}",
      "((*- else *))",
      "% sort citations by order of first appearance",
      "\\bibliographystyle{unsrtnat}",
      "((*- endif *))",
      "\\bibliography{((( filename )))}",
      "",
      "((*- endif *))",
      "((*- endif *))"
    ]
  }
}