mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
Ajout de \binom pour afficher les coefficients binomiaux (#250)
This commit is contained in:
@@ -190,7 +190,12 @@ Layout TexParser::popCommand() {
|
||||
return popOverrightarrowCommand();
|
||||
}
|
||||
}
|
||||
|
||||
if (strncmp(k_binomCommand, m_text, strlen(k_binomCommand)) == 0) {
|
||||
if (isCommandEnded(*(m_text + strlen(k_binomCommand)))) {
|
||||
m_text += strlen(k_binomCommand);
|
||||
return popBinomCommand();
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < k_NumberOfSymbols; i++) {
|
||||
if (strncmp(k_SymbolsCommands[i], m_text, strlen(k_SymbolsCommands[i])) == 0) {
|
||||
if (isCommandEnded(*(m_text + strlen(k_SymbolsCommands[i])))) {
|
||||
@@ -264,6 +269,13 @@ Layout TexParser::popOverrightarrowCommand() {
|
||||
return VectorLayout::Builder(popBlock());
|
||||
}
|
||||
|
||||
Layout TexParser::popBinomCommand() {
|
||||
Layout numerator = popBlock();
|
||||
Layout denominator = popBlock();
|
||||
BinomialCoefficientLayout b = BinomialCoefficientLayout::Builder(numerator, denominator);
|
||||
return b;
|
||||
}
|
||||
|
||||
Layout TexParser::popSymbolCommand(int SymbolIndex) {
|
||||
uint32_t codePoint = k_SymbolsCodePoints[SymbolIndex];
|
||||
return CodePointLayout::Builder(codePoint);
|
||||
@@ -273,4 +285,4 @@ inline bool TexParser::isCommandEnded(char c) const {
|
||||
return !(c >= 'a' && c <= 'z') && !(c >= 'A' && c <= 'Z');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ private:
|
||||
Layout popSqrtCommand();
|
||||
Layout popSpaceCommand();
|
||||
Layout popOverrightarrowCommand();
|
||||
Layout popBinomCommand();
|
||||
|
||||
//Symbols
|
||||
Layout popSymbolCommand(int SymbolIndex);
|
||||
@@ -47,6 +48,7 @@ private:
|
||||
static constexpr char const * k_sqrtCommand = "sqrt";
|
||||
static constexpr char const * k_spaceCommand = "space";
|
||||
static constexpr char const * k_overrightArrowCommand = "overrightarrow";
|
||||
static constexpr char const * k_binomCommand = "binom";
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user