code: def setup(app: Sphinx) -> dict[str, Any]:
      app.setup_extension("sphinx.builders.latex.transforms")
  
      app.add_builder(LaTeXBuilder)
      app.connect("config-inited", validate_config_values, priority=800)
      app.connect(
          "config-inited", validate_latex_theme_options, priority=800
      )
      app.connect("builder-inited", install_packages_for_ja)
  
      app.add_config_value(
          "latex_engine",
          default_latex_engine,
          "",
          ENUM("pdflatex", "xelatex", "lualatex", "platex", "uplatex"),
      )
      app.add_config_value(
          "latex_documents", default_latex_documents, ""
      )
      app.add_config_value("latex_logo", None, "", str)
      app.add_config_value("latex_appendices", [], "")
      app.add_config_value("latex_use_latex_multicolumn", False, "")
      app.add_config_value(
          "latex_use_xindy", default_latex_use_xindy, "", bool
      )
      app.add_config_value(
          "latex_toplevel_sectioning",
          None,
          "",
          ENUM(None, "part", "chapter", "section"),
      )
      app.add_config_value("latex_domain_indices", True, "", list)
      app.add_config_value("latex_show_urls", "no", "")
      app.add_config_value("latex_show_pagerefs", False, "")
      app.add_config_value("latex_elements", {}, "")
      app.add_config_value("latex_additional_files", [], "")
      app.add_config_value(
          "latex_table_style", ["booktabs", "colorrows"], "", list
      )
      app.add_config_value("latex_theme", "manual", "", str)
      app.add_config_value("latex_theme_options", {}, "")
      app.add_config_value("latex_theme_path", [], "", list)
  
      app.add_config_value("latex_docclass", default_latex_docclass, "")
  
      return {
          "version": "builtin",
          "parallel_read_safe": True,
          "parallel_write_safe": True,
      }
  
imports: from __future__ import annotations
  import os
  import warnings
  from os import path
  from typing import TYPE_CHECKING, Any
  from docutils.frontend import OptionParser
  import sphinx.builders.latex.nodes
  from sphinx import addnodes, highlighting, package_dir
  from sphinx.builders import Builder
  from sphinx.builders.latex.constants import ADDITIONAL_SETTINGS, DEFAULT_SETTINGS, SHORTHANDOFF
  from sphinx.builders.latex.theming import Theme, ThemeFactory
  from sphinx.builders.latex.util import ExtBabel
  from sphinx.config import ENUM, Config
  from sphinx.environment.adapters.asset import ImageAdapter
  from sphinx.errors import NoUri, SphinxError
  from sphinx.locale import _, __
  from sphinx.util import logging, texescape
  from sphinx.util.console import bold, darkgreen
  from sphinx.util.display import progress_message, status_iterator
  from sphinx.util.docutils import SphinxFileOutput, new_document
  from sphinx.util.fileutil import copy_asset_file
  from sphinx.util.i18n import format_date
  from sphinx.util.nodes import inline_all_toctrees
  from sphinx.util.osutil import SEP, make_filename_from_project
  from sphinx.util.template import LaTeXRenderer
  from sphinx.writers.latex import LaTeXTranslator, LaTeXWriter
  from docutils import nodes
label_desc: Use image node_id 8 for calling a global function with example usage: setup(app) and returns: dict