def create_heading_component_l(data: GTData, use_longtable: bool) -> str:
    """
    Create the heading component for LaTeX output.

    This function generates the LaTeX code for the heading component of a table which involves the
    title and the optional subtitle. There is variation in the output based on whether the table
    uses the `longtable` environment or not.

    Parameters
    ----------
    data : GTData
        The GTData object that contains all the information about the table.

    Returns
    -------
    str
        The LaTeX code for the heading component of the table.
    """

    title = data._heading.title
    subtitle = data._heading.subtitle

    line_continuation = "\\\\"

    has_title = heading_has_title(title)

    # If there is no title, then return an empty string
    if not has_title:
        return ""

    title_str = _process_text(title, context="latex")

    title_row = f"{{\\large {title_str}}}"

    has_subtitle = heading_has_subtitle(subtitle)

    if has_subtitle:
        subtitle_str = _process_text(subtitle, context="latex")

        subtitle_row = f"{{\\small {subtitle_str}}}"

        header_component = f"""\\caption*{{
{title_row} \\\\
{subtitle_row}
}} {line_continuation if use_longtable else ""}"""

    else:
        header_component = f"""\\caption*{{
{title_row}
}} {line_continuation if use_longtable else ""}"""

    return header_component

    Create the heading component for LaTeX output.

    This function generates the LaTeX code for the heading component of a table which involves the
    title and the optional subtitle. There is variation in the output based on whether the table
    uses the `longtable` environment or not.

    Parameters
    ----------
    data : GTData
        The GTData object that contains all the information about the table.

    Returns
    -------
    str
        The LaTeX code for the heading component of the table.
    
great_tables/_utils_render_latex.py