Compare commits

...

4 Commits

  1. 2
      src/formatitko/tex/formatitko.tex
  2. 26
      src/formatitko/tex_generator.py

2
src/formatitko/tex/formatitko.tex

@ -21,6 +21,8 @@
\pdfglyphtounicode{radicalbig}{221A} \pdfglyphtounicode{radicalbig}{221A}
\pdfglyphtounicode{radicalBig}{221A} \pdfglyphtounicode{radicalBig}{221A}
\pdfglyphtounicode{radicalbigg}{221A}
\pdfglyphtounicode{radicalBigg}{221A}
\pdfglyphtounicode{hatwidest}{0302} \pdfglyphtounicode{hatwidest}{0302}
\input formatitkolib.tex \input formatitkolib.tex

26
src/formatitko/tex_generator.py

@ -89,7 +89,7 @@ class UCWTexGenerator(OutputGenerator):
elif lang == "sk": elif lang == "sk":
return r"\uselanguage{slovak}\frenchspacing\lefthyphenmin=2\righthyphenmin=2{}" return r"\uselanguage{slovak}\frenchspacing\lefthyphenmin=2\righthyphenmin=2{}"
elif lang == "en": elif lang == "en":
return r"\uselanguage{english}\nofrenchspacing\lefthyphenmin=2\righthyphenmin=2{}" return r"\uselanguage{USenglish}\nonfrenchspacing\lefthyphenmin=2\righthyphenmin=2{}"
else: else:
return "" return ""
@ -170,14 +170,17 @@ class UCWTexGenerator(OutputGenerator):
self.writeln(r"}{") self.writeln(r"}{")
self.indent_more() self.indent_more()
if 'number' in e.attributes: if 'number' in e.attributes:
self.writeln(f"Obrázek {e.attributes['number']}:") type_text = e.attributes.get("type_text", "Obrázek")
self.writeln(f"{type_text} {e.attributes['number']}:")
self.generate(e.caption) self.generate(e.caption)
if 'number' in e.attributes: if 'number' in e.attributes:
self.writeln(r"\addtoc\tocpicture{"+str(e.attributes['number'])+"}{}{") tocmac = e.attributes.get("tocmac", "tocpicture")
self.indent_more() if tocmac:
self.generate(e.caption.content) self.writeln("\\addtoc\\"+tocmac+r"{"+str(e.attributes['number'])+"}{}{")
self.indent_less() self.indent_more()
self.writeln("}") self.generate(e.caption.content)
self.indent_less()
self.writeln("}")
self.indent_less() self.indent_less()
self.writeln(r"}{}{}") self.writeln(r"}{}{}")
@ -251,11 +254,12 @@ class UCWTexGenerator(OutputGenerator):
self.write(r"}") self.write(r"}")
def generate_Table(self, e: Table): def generate_Table(self, e: Table):
hskip = r"\hskip 0.6em\relax"
aligns = { aligns = {
"AlignLeft": r"\quad#\quad\hfil", "AlignLeft": hskip+r"\relax#\hfil"+hskip,
"AlignRight": r"\quad\hfil#\quad", "AlignRight": hskip+r"\hfil#"+hskip,
"AlignCenter": r"\quad\hfil#\hfil\quad", "AlignCenter": hskip+r"\hfil#\hfil"+hskip,
"AlignDefault": r"\quad#\quad\hfil" "AlignDefault": hskip+r"#\hfil"+hskip,
} }
self.writeln(r"\vskip1em") self.writeln(r"\vskip1em")
self.writeln(r"\leavevmode\vbox{\halign{\strut"+"&".join([aligns[col[0]] for col in e.colspec])+r"\cr") self.writeln(r"\leavevmode\vbox{\halign{\strut"+"&".join([aligns[col[0]] for col in e.colspec])+r"\cr")

Loading…
Cancel
Save