From c3be50ec6d2cbef983d68dbab16cde8c91a1c7a8 Mon Sep 17 00:00:00 2001 From: Yihui Xie Date: Thu, 10 Oct 2024 22:30:27 -0500 Subject: [PATCH] use \footnotetext and \footnotemark to implement LaTeX footnotes --- src/cmark/latex.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/cmark/latex.c b/src/cmark/latex.c index 1a6367a..5fab7ee 100644 --- a/src/cmark/latex.c +++ b/src/cmark/latex.c @@ -447,8 +447,20 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node, break; case CMARK_NODE_FOOTNOTE_DEFINITION: + if (entering) { + LIT("\\footnotetext["); + OUT(cmark_chunk_to_cstr(renderer->mem, &node->as.literal), false, LITERAL); + LIT("]{"); + } else { + LIT("}"); + } + break; case CMARK_NODE_FOOTNOTE_REFERENCE: - // TODO + if (entering) { + LIT("\\footnotemark["); + OUT(cmark_chunk_to_cstr(renderer->mem, &node->parent_footnote_def->as.literal), false, LITERAL); + LIT("]"); + } break; default: