diff --git a/apps/reader/tex_parser.cpp b/apps/reader/tex_parser.cpp index 5c03903c3..1815d43d1 100644 --- a/apps/reader/tex_parser.cpp +++ b/apps/reader/tex_parser.cpp @@ -147,7 +147,92 @@ Layout TexParser::popCommand() { m_text += strlen(k_pmCommand); if (*m_text == ' ' || *m_text == '\\' || *m_text == '$') { return poppmCommand(); - } } + } + } + else if (strncmp(k_inftyCommand, m_text, strlen(k_inftyCommand)) == 0) { + m_text += strlen(k_inftyCommand); + if (*m_text == ' ' || *m_text == '\\' || *m_text == '$') { + return popinftyCommand(); + } + } + else if (strncmp(k_approxCommand, m_text, strlen(k_approxCommand)) == 0) { + m_text += strlen(k_approxCommand); + if (*m_text == ' ' || *m_text == '\\' || *m_text == '$') { + return popapproxCommand(); + } + } + else if (strncmp(k_neqCommand, m_text, strlen(k_neqCommand)) == 0) { + m_text += strlen(k_neqCommand); + if (*m_text == ' ' || *m_text == '\\' || *m_text == '$') { + return popneqCommand(); + } + } + else if (strncmp(k_equivCommand, m_text, strlen(k_equivCommand)) == 0) { + m_text += strlen(k_equivCommand); + if (*m_text == ' ' || *m_text == '\\' || *m_text == '$') { + return popequivCommand(); + } + } + else if (strncmp(k_leftarrowCommand, m_text, strlen(k_leftarrowCommand)) == 0) { + m_text += strlen(k_leftarrowCommand); + if (*m_text == ' ' || *m_text == '\\' || *m_text == '$') { + return popleftarrowCommand(); + } + } + else if (strncmp(k_uparrowCommand, m_text, strlen(k_uparrowCommand)) == 0) { + m_text += strlen(k_uparrowCommand); + if (*m_text == ' ' || *m_text == '\\' || *m_text == '$') { + return popuparrowCommand(); + } + } + else if (strncmp(k_rightarrowCommand, m_text, strlen(k_rightarrowCommand)) == 0) { + m_text += strlen(k_rightarrowCommand); + if (*m_text == ' ' || *m_text == '\\' || *m_text == '$') { + return poprightarrowCommand(); + } + } + else if (strncmp(k_downarrowCommand, m_text, strlen(k_downarrowCommand)) == 0) { + m_text += strlen(k_downarrowCommand); + if (*m_text == ' ' || *m_text == '\\' || *m_text == '$') { + return popdownarrowCommand(); + } + } + else if (strncmp(k_leftrightarrowCommand, m_text, strlen(k_leftrightarrowCommand)) == 0) { + m_text += strlen(k_leftrightarrowCommand); + if (*m_text == ' ' || *m_text == '\\' || *m_text == '$') { + return popleftrightarrowCommand(); + } + } + else if (strncmp(k_updownarrowCommand, m_text, strlen(k_updownarrowCommand)) == 0) { + m_text += strlen(k_updownarrowCommand); + if (*m_text == ' ' || *m_text == '\\' || *m_text == '$') { + return popupdownarrowCommand(); + } + } + else if (strncmp(k_LeftarrowCommand, m_text, strlen(k_LeftarrowCommand)) == 0) { + m_text += strlen(k_LeftarrowCommand); + if (*m_text == ' ' || *m_text == '\\' || *m_text == '$') { + return popLeftarrowCommand(); + } + } + else if (strncmp(k_UparrowCommand, m_text, strlen(k_UparrowCommand)) == 0) { + m_text += strlen(k_UparrowCommand); + if (*m_text == ' ' || *m_text == '\\' || *m_text == '$') { + return popUparrowCommand(); + } + } + else if (strncmp(k_RightarrowCommand, m_text, strlen(k_RightarrowCommand)) == 0) { + m_text += strlen(k_RightarrowCommand); + if (*m_text == ' ' || *m_text == '\\' || *m_text == '$') { + return popRightarrowCommand(); + } + } + else if (strncmp(k_DownarrowCommand, m_text, strlen(k_DownarrowCommand)) == 0) { + m_text += strlen(k_DownarrowCommand); + if (*m_text == ' ' || *m_text == '\\' || *m_text == '$') { + return popDownarrowCommand(); + } + } // Greek capital letters else if (strncmp(k_AlphaCommand, m_text, strlen(k_AlphaCommand)) == 0) { @@ -485,6 +570,62 @@ Layout TexParser::poppmCommand() { return CodePointLayout::Builder(CodePoint(0xb1)); } +Layout TexParser::popapproxCommand() { + return CodePointLayout::Builder(CodePoint(0x2248)); +} + +Layout TexParser::popinftyCommand() { + return CodePointLayout::Builder(CodePoint(0x221e)); +} + +Layout TexParser::popneqCommand() { + return CodePointLayout::Builder(CodePoint(0x2260)); +} + +Layout TexParser::popequivCommand() { + return CodePointLayout::Builder(CodePoint(0x2261)); +} + +Layout TexParser::popleftarrowCommand() { + return CodePointLayout::Builder(CodePoint(0x2190)); +} + +Layout TexParser::popuparrowCommand() { + return CodePointLayout::Builder(CodePoint(0x2191)); +} + +Layout TexParser::poprightarrowCommand() { + return CodePointLayout::Builder(CodePoint(0x2192)); +} + +Layout TexParser::popdownarrowCommand() { + return CodePointLayout::Builder(CodePoint(0x2193)); +} + +Layout TexParser::popleftrightarrowCommand() { + return CodePointLayout::Builder(CodePoint(0x2194)); +} + +Layout TexParser::popupdownarrowCommand() { + return CodePointLayout::Builder(CodePoint(0x2195)); +} + +Layout TexParser::popLeftarrowCommand() { + return CodePointLayout::Builder(CodePoint(0x21d0)); +} + +Layout TexParser::popUparrowCommand() { + return CodePointLayout::Builder(CodePoint(0x21d1)); +} + +Layout TexParser::popRightarrowCommand() { + return CodePointLayout::Builder(CodePoint(0x21d2)); +} + +Layout TexParser::popDownarrowCommand() { + return CodePointLayout::Builder(CodePoint(0x21d3)); +} + // Greek Capital letters Layout TexParser::popAlphaCommand() { return CodePointLayout::Builder(CodePoint(0x391)); diff --git a/apps/reader/tex_parser.h b/apps/reader/tex_parser.h index e350358cd..0e27fe791 100644 --- a/apps/reader/tex_parser.h +++ b/apps/reader/tex_parser.h @@ -30,6 +30,22 @@ private: Layout poppartialCommand(); Layout popexistsCommand(); Layout poppmCommand(); + Layout popinftyCommand(); + Layout popapproxCommand(); + Layout popneqCommand(); + Layout popequivCommand(); + + // Arrows + Layout popleftarrowCommand(); + Layout popuparrowCommand(); + Layout poprightarrowCommand(); + Layout popdownarrowCommand(); + Layout popleftrightarrowCommand(); + Layout popupdownarrowCommand(); + Layout popLeftarrowCommand(); + Layout popUparrowCommand(); + Layout popRightarrowCommand(); + Layout popDownarrowCommand(); // Greek capital letters @@ -98,6 +114,22 @@ private: static constexpr char const * k_partialCommand = "partial"; static constexpr char const * k_existsCommand = "exists"; static constexpr char const * k_pmCommand = "pm"; + static constexpr char const * k_inftyCommand = "infty"; + static constexpr char const * k_approxCommand = "approx"; + static constexpr char const * k_neqCommand = "neq"; + static constexpr char const * k_equivCommand = "equiv"; + + // Arrows + static constexpr char const * k_leftarrowCommand = "leftarrow"; + static constexpr char const * k_uparrowCommand = "uparrow"; + static constexpr char const * k_rightarrowCommand = "rightarrow"; + static constexpr char const * k_downarrowCommand = "downarrow"; + static constexpr char const * k_leftrightarrowCommand = "leftrightarrow"; + static constexpr char const * k_updownarrowCommand = "updownarrow"; + static constexpr char const * k_LeftarrowCommand = "Leftarrow"; + static constexpr char const * k_UparrowCommand = "Uparrow"; + static constexpr char const * k_RightarrowCommand = "Rightarrow"; + static constexpr char const * k_DownarrowCommand = "Downarrow"; // Greek capital letters static constexpr char const * k_AlphaCommand = "Alpha";