|
|
@ -136,6 +136,25 @@ def tex(e, indent_level: int=0, indent_str: str="\t") -> str: |
|
|
|
if inlinify(e) is not None: |
|
|
|
return f'\\fn{{{tex(inlinify(e), 0, "")}}}' |
|
|
|
|
|
|
|
if isinstance(e, Table): |
|
|
|
aligns = { |
|
|
|
"AlignLeft": "\\quad#\\quad\\hfil", |
|
|
|
"AlignRight": "\\quad\\hfil#\\quad", |
|
|
|
"AlignCenter": "\\quad\\hfil#\\hfil\\quad", |
|
|
|
"AlignDefault": "\\quad#\\quad\\hfil" |
|
|
|
} |
|
|
|
text = "\strut"+"&".join([aligns[col[0]] for col in e.colspec])+"\cr\n" |
|
|
|
text += tex(e.head.content, 0, "") |
|
|
|
text += "\\noalign{\\hrule}\n" |
|
|
|
text += tex(e.content[0].content, 0, "") |
|
|
|
text += "\\noalign{\\hrule}\n" |
|
|
|
text += tex(e.foot.content, 0, "") |
|
|
|
return "\\vskip1em\n\\halign{"+text+"}\n\\vskip1em\n" |
|
|
|
# FIXME: Implement rowspan |
|
|
|
|
|
|
|
if isinstance(e, TableRow): |
|
|
|
return "&".join([("\\multispan"+str(cell.colspan)+" " if cell.colspan > 1 else "")+tex(cell.content, 0, "") for cell in e.content])+"\cr\n" |
|
|
|
|
|
|
|
if isinstance(e, RawInline): |
|
|
|
if e.format == "tex": |
|
|
|
return e.text |
|
|
|