From: Sebastian Harl Date: Sun, 13 Jun 2010 21:02:48 +0000 (+0200) Subject: l2l, l2l_scanner: Surround boxes with rules. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=94fae5790c44a182b0830bcf33302169ee8bf169;p=lm2latex.git l2l, l2l_scanner: Surround boxes with rules. … using the "float" package and a new float environment "l2lbox". --- diff --git a/src/l2l.c b/src/l2l.c index 2fae2b9..221fbbb 100644 --- a/src/l2l.c +++ b/src/l2l.c @@ -76,8 +76,12 @@ write_tex_preamble(FILE *out) "\\fi\n" "\n" "\\usepackage{caption}\n" +"\\usepackage{float}\n" "\\usepackage{url}\n" "\n" +"\\floatstyle{ruled}\n" +"\\newfloat{l2lbox}{tbp}{lof}\n" +"\n" "\\setlength{\\parskip}{6pt}\n" "\n" "\\renewcommand{\\headrulewidth}{0.4pt}\n" diff --git a/src/l2l_scanner.l b/src/l2l_scanner.l index d769e91..251b93b 100644 --- a/src/l2l_scanner.l +++ b/src/l2l_scanner.l @@ -428,8 +428,19 @@ ANY_COMMAND @(R|SW|D|T|V|A|L|ZT|LI|B|Bi|IT|IL|IE|KT|KL|KE|TT|TH|TL|TE): */ @(B|KT):{WHITESPACE}* { + _Bool is_image = 0; + _Bool is_box = 0; + + if (! strncmp(yytext, "@B:", 3)) + is_image = 1; + else if (! strncmp(yytext, "@KT:", 4)) + is_box = 1; + if (l2l_scanner_state != L2L_FIGURE) { - fprintf(yyout, "\\begin{figure}\n"); + if (is_box) + fprintf(yyout, "\\begin{l2lbox}\n"); + else + fprintf(yyout, "\\begin{figure}\n"); l2l_scanner_state = L2L_FIGURE; } else { @@ -437,9 +448,9 @@ ANY_COMMAND @(R|SW|D|T|V|A|L|ZT|LI|B|Bi|IT|IL|IE|KT|KL|KE|TT|TH|TL|TE): } l2l_buf_ptr = &l2l_caption; - if (! strncmp(yytext, "@B:", 3)) + if (is_image) BEGIN(caption); - else if (! strncmp(yytext, "@KT:", 4)) + else if (is_box) BEGIN(box_caption); else assert(0); @@ -470,7 +481,7 @@ ANY_COMMAND @(R|SW|D|T|V|A|L|ZT|LI|B|Bi|IT|IL|IE|KT|KL|KE|TT|TH|TL|TE): @KL: { if (l2l_scanner_state != L2L_FIGURE) { - fprintf(yyout, "\\begin{figure}\n"); + fprintf(yyout, "\\begin{l2lbox}\n"); l2l_scanner_state = L2L_FIGURE; } else { @@ -482,7 +493,7 @@ ANY_COMMAND @(R|SW|D|T|V|A|L|ZT|LI|B|Bi|IT|IL|IE|KT|KL|KE|TT|TH|TL|TE): } @(KE|L):{WHITESPACE}* { - fprintf(yyout, "\\end{figure}"); + fprintf(yyout, "\\end{l2lbox}"); l2l_scanner_state = L2L_BODY; l2l_last_yystart = INITIAL; BEGIN(l2l_last_yystart);