diff --git a/apps/reader/tex_parser.cpp b/apps/reader/tex_parser.cpp index 77245f617..2d12ae40f 100644 --- a/apps/reader/tex_parser.cpp +++ b/apps/reader/tex_parser.cpp @@ -113,8 +113,21 @@ Layout TexParser::popCommand() { return popSqrtCommand(); } } + else if (strncmp(k_thetaCommand, m_text, strlen(k_thetaCommand)) == 0) { + m_text += strlen(k_thetaCommand); + if (*m_text == ' ') { + return popThetaCommand(); + } + } + else if (strncmp(k_piCommand, m_text, strlen(k_piCommand)) == 0) { + m_text += strlen(k_piCommand); + if (*m_text == ' ') { + return popPiCommand(); + } + } + m_hasError = true; - return popFracCommand(); + return LayoutHelper::String(m_text, strlen(m_text)); } Layout TexParser::popFracCommand() { @@ -127,12 +140,19 @@ Layout TexParser::popSqrtCommand() { } m_text++; if (*m_text == '[') { - return NthRootLayout::Builder(popText(']'),popBlock()); + return NthRootLayout::Builder(popText(']'), popBlock()); } else { return NthRootLayout::Builder(popBlock()); } } +Layout TexParser::popThetaCommand() { + return CodePointLayout::Builder(UCodePointGreekSmallLetterTheta); +} + +Layout TexParser::popPiCommand() { + return CodePointLayout::Builder(UCodePointGreekSmallLetterPi); +} } diff --git a/apps/reader/tex_parser.h b/apps/reader/tex_parser.h index 5ae470eba..f1097c854 100644 --- a/apps/reader/tex_parser.h +++ b/apps/reader/tex_parser.h @@ -20,12 +20,16 @@ private: Layout popCommand(); Layout popFracCommand(); Layout popSqrtCommand(); + Layout popPiCommand(); + Layout popThetaCommand(); const char * m_text; const char * m_endOfText; bool m_hasError; static constexpr char const * k_fracCommand = "frac"; static constexpr char const * k_sqrtCommand = "sqrt"; + static constexpr char const * k_thetaCommand = "theta"; + static constexpr char const * k_piCommand = "pi"; }; }