Skip to content

Commit 5573f7c

Browse files
author
Remo Ronca
committed
Enables the automatic adornment of code blocks by the \smaller command/environment provided by the LaTeX relsize package (cf. <http://www.ctan.org/tex-archive/macros/latex/contrib/relsize>).
Only the `CODE` and `VERBATIM*` cases in `latex.c` have been altered. The respective output is now preceded by `\\ifx\\smaller\\undefined \\relax \\else <applied relsize macro> \\fi`. By embedding the `relsize` commands in a conditional TeX block, the availability of the `relsize` commands is reassured.
1 parent 3488a6c commit 5573f7c

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

latex.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ void print_latex_node(GString *out, node *n, scratch_pad *scratch) {
205205
break;
206206
}
207207
}
208-
g_string_append_printf(out, "\\begin{verbatim}\n%s\\end{verbatim}",n->str);
208+
g_string_append_printf(out, "\\ifx\\smaller\\undefined \\relax \\else \\begin{smaller}\n \\fi \\begin{verbatim}\n%s\\end{verbatim}\\ifx\\smaller\\undefined \\relax \\else \n\\end{smaller} \\fi",n->str);
209209
scratch->padded = 0;
210210
break;
211211
case BULLETLIST:
@@ -818,9 +818,9 @@ void print_latex_node(GString *out, node *n, scratch_pad *scratch) {
818818
case GLOSSARYSORTKEY:
819819
break;
820820
case CODE:
821-
g_string_append_printf(out, "\\texttt{");
821+
g_string_append_printf(out, "\\ifx\\smaller\\undefined \\else \\smaller \\fi \\texttt{");
822822
print_latex_string(out, n->str, scratch);
823-
g_string_append_printf(out, "}");
823+
g_string_append_printf(out, "}\\ifx\\smaller\\undefined \\else \\normalsize \\fi");
824824
break;
825825
case BLOCKQUOTEMARKER:
826826
print_latex_node_tree(out, n->children, scratch);

0 commit comments

Comments
 (0)