Skip to content

Commit

Permalink
Support LaTeX labels and references
Browse files Browse the repository at this point in the history
Support `tex_ref` tag for references and use labels in tables.
  • Loading branch information
enzet committed Aug 2, 2024
1 parent 0bcfa14 commit 4118116
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
14 changes: 14 additions & 0 deletions data/text.moi
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,21 @@ find in existing writing systems.

\3 {Relations to the existing symbols} {featural_existing}

The use of basic geometric forms, common in many existing writing systems,
facilitates easier learning and reproduction of the symbols.

The proposed system can be used to model symbols from naturally evolved
alphabets. Table \tex_ref {tbl:model_latin} shows symbols from Latin alphabet.
Or Cyrillic (see table \tex_ref {tbl:model_cyrillic}).

\table
{tbl:model_number}
{Modeling numbers}
{{Existing symbol} {2} {7}}
{{Proposed system} {\symbol {hto / hb}} {\symbol {ht /}}}

\table
{tbl:model_latin}
{Modeling Latin symbols}
{
{Existing symbol} {C} {D} {E} {F} {H} {I} {J} {L} {N} {O} {S} {T} {U}
Expand All @@ -194,6 +203,7 @@ find in existing writing systems.
}

\table
{tbl:model_cyrillic}
{Modeling Cyrillic symbols}
{{Existing symbol} {Г} {Ж} {И} {П} {Ш} {Э}}
{
Expand All @@ -207,6 +217,7 @@ find in existing writing systems.
}

\table
{tbl:model_hangulc}
{Modeling Hangul symbols for consonants}
{
{Existing symbol}
Expand Down Expand Up @@ -234,6 +245,7 @@ find in existing writing systems.
}

\table
{tbl:model_hangulv}
{Modeling Hangul symbols for vowels}
{
{Existing symbol}
Expand Down Expand Up @@ -268,6 +280,7 @@ find in existing writing systems.
}

\table
{tbl:model_myanmar}
{Modeling Myanmar symbols}
{{Existing symbol} {လ}}
{
Expand All @@ -279,6 +292,7 @@ Several existing symbols cannot be recreated precisely, but can still be
recognizable.

\table
{tbl:model_other}
{Modeling other symbols}
{{Existing symbol} {A} {M} {Y} {У} {Ф} {Ч}}
{
Expand Down
10 changes: 7 additions & 3 deletions python/moire_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ def figure(self, arg) -> str:
s += "\\end{figure}"
return s

def tex_ref(self, arg) -> str:
return f"\\ref{{{arg[0][0]}}}"

def table(self, arg) -> str:
s = dedent(
"""\
Expand All @@ -63,14 +66,14 @@ def table(self, arg) -> str:
\\begin{tabular}{|"""
)
max_tds = 0
for tr in arg[1:]:
for tr in arg[2:]:
if isinstance(tr, list):
tds = sum([1 for td in tr if isinstance(td, list)])
max_tds = max(max_tds, tds)
for k in range(max_tds):
s += "c|"
s += "}\n\\hline\n"
for tr in arg[1:]:
for tr in arg[2:]:
if isinstance(tr, list):
tds = []
for td in tr:
Expand All @@ -83,7 +86,8 @@ def table(self, arg) -> str:
s += dedent(
f"""\
\\end{{tabular}}
\\caption{{{self.parse(arg[0])}}}
\\caption{{{self.parse(arg[1])}}}
\\label{{{arg[0][0]}}}
\\end{{center}}
\\end{{table}}"""
)
Expand Down

0 comments on commit 4118116

Please sign in to comment.