def fmt_latex_output(hyps: Sequence[Sequence[str]],
                     refs: Sequence[Sequence[str]],
                     prefixes: Sequence[str],
                     out_fn: Path,
                    ) -> None:
    """ Output the hypotheses and references to a LaTeX source file for
    pretty printing.
    """

    alignments_ = [min_edit_distance_align(ref, hyp)
                  for hyp, ref in zip(hyps, refs)]

    with out_fn.open("w") as out_f:
        print(latex_header(), file=out_f)

        print("\\begin{document}\n"
              "\\begin{longtable}{ll}", file=out_f)
        print(r"\toprule", file=out_f)
        for sent in zip(prefixes, alignments_):
            prefix = sent[0]
            alignments = sent[1:]
            print("Utterance ID: &", prefix.strip().replace(r"_", r"\_"), r"\\", file=out_f)
            for i, alignment in enumerate(alignments):
                ref_list = []
                hyp_list = []
                for arrow in alignment:
                    if arrow[0] == arrow[1]:
                        # Then don't highlight it; it's correct.
                        ref_list.append(arrow[0])
                        hyp_list.append(arrow[1])
                    else:
                        # Then highlight the errors.
                        ref_list.append("\\hl{%s}" % arrow[0])
                        hyp_list.append("\\hl{%s}" % arrow[1])
                print("Ref: &", "".join(ref_list), r"\\", file=out_f)
                print("Hyp: &", "".join(hyp_list), r"\\", file=out_f)
            print(r"\midrule", file=out_f)

        print(r"\end{longtable}", file=out_f)
        print(r"\end{document}", file=out_f)
Output the hypotheses and references to a LaTeX source file for
    pretty printing.