Conditions | 8 |
Total Lines | 14 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | #!/usr/bin/env python3 |
||
12 | def spaces(elem, doc): |
||
13 | """ |
||
14 | Add LaTeX spaces when needed. |
||
15 | """ |
||
16 | # Is it in the right format and is it a Space? |
||
17 | if doc.format in ["latex", "beamer"] and isinstance(elem, Space): |
||
18 | if isinstance(elem.prev, Str) and elem.prev.text in ["«", "“", "‹"]: |
||
19 | return RawInline("\\thinspace{}", "tex") |
||
20 | if isinstance(elem.next, Str): |
||
21 | if elem.next.text == ":": |
||
22 | return RawInline("~", "tex") |
||
23 | if elem.next.text in [";", "?", "!", "»", "”", "›"]: |
||
24 | return RawInline("\\thinspace{}", "tex") |
||
25 | return None |
||
26 | |||
37 |