Skip to content

Commit

Permalink
ADDED: Add title as short caption for figures and tables to be used i…
Browse files Browse the repository at this point in the history
…n list of figures and list of tables. Addresses #177 -- thanks, 	MArpogaus
  • Loading branch information
fletcher committed Dec 11, 2019
1 parent 884b4f7 commit 3db3cf4
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions Sources/libMultiMarkdown/latex.c
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,12 @@ void mmd_export_image_latex(DString * out, const char * source, token * text, li
print_const("\n");

if (text) {
print_const("\\caption{");
if (link->title && link->title[0] != '\0') {
printf("\\caption[%s]{", link->title);
} else {
print_const("\\caption{");
}

mmd_export_token_tree_latex(out, source, text->child, scratch);
print_const("}\n");
}
Expand Down Expand Up @@ -806,14 +811,18 @@ void mmd_export_token_latex(DString * out, const char * source, token * t, scrat
if (temp_token->next &&
temp_token->next->type == PAIR_BRACKET) {
temp_token = temp_token->next;
print_const("\\caption");
print_token(temp_token);
print_const("{");
} else {
print_const("\\caption{");
}

temp_char = label_from_token(source, temp_token);

t->next->child->child->type = TEXT_EMPTY;
t->next->child->child->mate->type = TEXT_EMPTY;

print_const("\\caption{");
mmd_export_token_tree_latex(out, source, t->next->child->child, scratch);
print_const("}\n");

Expand Down

0 comments on commit 3db3cf4

Please sign in to comment.