Skip to content

Commit

Permalink
use \footnotetext and \footnotemark to implement LaTeX footnotes
Browse files Browse the repository at this point in the history
  • Loading branch information
yihui committed Oct 11, 2024
1 parent 170be64 commit f9835be
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/cmark/latex.c
Original file line number Diff line number Diff line change
Expand Up @@ -447,15 +447,21 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node,
break;

case CMARK_NODE_FOOTNOTE_DEFINITION:
break;
case CMARK_NODE_FOOTNOTE_REFERENCE:
if (entering) {
LIT("\\footnote{");
// How can I get the footnote content here?
LIT("\\footnotetext[");
OUT(cmark_chunk_to_cstr(renderer->mem, &node->as.literal), false, LITERAL);
LIT("]{");
} else {
LIT("}");
}
break;
case CMARK_NODE_FOOTNOTE_REFERENCE:
if (entering) {
LIT("\\footnotemark[");
OUT(cmark_chunk_to_cstr(renderer->mem, &node->parent_footnote_def->as.literal), false, LITERAL);
LIT("]");
}
break;

default:
assert(false);
Expand Down

0 comments on commit f9835be

Please sign in to comment.