Compare commits

...

4 Commits

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

2
src/formatitko/tex/formatitko.tex

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

18
src/formatitko/tex_generator.py

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

Loading…
Cancel
Save