25#ifndef JKQTMATHTEXTLATEXPARSER_H
26#define JKQTMATHTEXTLATEXPARSER_H
28#include "jkqtmathtext/parsers/jkqtmathtextparser.h"
29#include "jkqtmathtext/jkqtmathtext.h"
30#include "jkqtmathtext/jkqtmathtext_imexport.h"
142 QString
readUntil(
bool get,
const QString& endsequence,
bool removeFirstlineWhitespace=
false);
this class parses a mathematical markup string and can then draw the contained text/equation onto a Q...
Definition jkqtmathtext.h:192
QFlags< ParseOption > ParseOptions
Definition jkqtmathtext.h:217
@ DefaultParseOptions
Definition jkqtmathtext.h:215
a LaTeX parser for JKQTMathText
Definition jkqtmathtextlatexparser.h:59
JKQTMathTextNode * parseLatexString(bool get, JKQTMathTextBraceType quitOnClosingBrace=JKQTMathTextBraceType::MTBTAny, const QString &quitOnEnvironmentEnd=QString(""), bool quitOnClosingBracket=false)
parse a LaTeX string
int currentTokenID
used by the tokenizer. Points to the currently read character in parseString
Definition jkqtmathtextlatexparser.h:163
JKQTMathTextBraceType lastRightBraceType
the JKQTMathTextBraceType associated with the last \right command the parser encountered
Definition jkqtmathtextlatexparser.h:157
void giveBackToTokenizer(size_t count)
returns some characters to the Tokenizer
static QSet< int > accentLetters_LenCurly
lists all lengths of keys in accentLetters that start with a curly brace
Definition jkqtmathtextlatexparser.h:184
tokenType
the token types that may arrise in the string
Definition jkqtmathtextlatexparser.h:74
@ MTTendash
the en-dash character sequence "--" in text-mode
Definition jkqtmathtextlatexparser.h:93
@ MTTtext
a piece of general text
Definition jkqtmathtextlatexparser.h:76
@ MTTinstructionVerbatim
a verbatim instruction, e.g. \verb!verbatimtext! was found: currentTokenName will contain the text en...
Definition jkqtmathtextlatexparser.h:79
@ MTTinstructionBegin
a '\begin{...}' instruction, currentTokenName is the name of the environment
Definition jkqtmathtextlatexparser.h:81
@ MTThyphen
the single hyphen character "-" in text-mode
Definition jkqtmathtextlatexparser.h:92
@ MTTopenbracket
the character "["
Definition jkqtmathtextlatexparser.h:88
@ MTTdollar
the character "$"
Definition jkqtmathtextlatexparser.h:85
@ MTTinstructionVerbatimVisibleSpace
a verbatim instruction that generates visible whitespaces, e.g. \begin{verbatim}.....
Definition jkqtmathtextlatexparser.h:80
@ MTTclosebracket
the character "]"
Definition jkqtmathtextlatexparser.h:89
@ MTThat
the character "^"
Definition jkqtmathtextlatexparser.h:84
@ MTTopenbrace
the character "{"
Definition jkqtmathtextlatexparser.h:86
@ MTTinstruction
an instruction, started by "\", e.g. \c "\textbf", ...
Definition jkqtmathtextlatexparser.h:77
@ MTTampersand
the character "&"
Definition jkqtmathtextlatexparser.h:91
@ MTTwhitespace
some whitespace
Definition jkqtmathtextlatexparser.h:90
@ MTTemdash
the em-dash character sequence "---" in text-mode
Definition jkqtmathtextlatexparser.h:94
@ MTTinstructionEnd
a '\end{...}' instruction, currentTokenName is the name of the environment
Definition jkqtmathtextlatexparser.h:82
@ MTTunderscore
the character "_"
Definition jkqtmathtextlatexparser.h:83
@ MTTinstructionNewline
a newline instruction "\\"
Definition jkqtmathtextlatexparser.h:78
@ MTTnone
no token
Definition jkqtmathtextlatexparser.h:75
@ MTTclosebrace
the character "}"
Definition jkqtmathtextlatexparser.h:87
@ MTTtilde
the tilde character "~"
Definition jkqtmathtextlatexparser.h:95
JKQTMathTextVerticalListNode * parseMultilineLatexString(bool get, const QString &quitOnEnvironmentEnd=QString(""), JKQTMathTextHorizontalAlignment _alignment=MTHALeft, double _linespacingFactor=1.0, JKQTMathTextLineSpacingMode spacingMode_=MTSMDefaultSpacing, JKQTMathTextVerticalOrientation _verticalOrientation=MTVOFirstLine)
parse a LaTeX string with linebreaks
QStringList parseStringParams(bool get, size_t Nparams, bool *foundError=nullptr)
parses a list of string-arguments, i.e. {p1}{p2}{...}
virtual JKQTMathTextNode * parse(const QString &text, JKQTMathText::ParseOptions options=JKQTMathText::DefaultParseOptions) override
parse the given mathematical markup string.
bool parsingMathEnvironment
used by the parser. indicates whether we are in a math environment
Definition jkqtmathtextlatexparser.h:167
static QSet< int > accentLetters_LenBackslash
lists all lengths of keys in accentLetters that start with a backslash
Definition jkqtmathtextlatexparser.h:182
~JKQTMathTextLatexParser()
class destructor
QString parseSingleString(bool get)
parses a string, i.e. a sequence of text and whitespaces. returns after any other token was found
static QHash< QString, double > big_instructions_family
maps instructions for braces with fixed size, e.g \bigl to the magnification factor of the brace vers...
Definition jkqtmathtextlatexparser.h:188
static QSet< QChar > SingleCharInstructions
single character instructions
Definition jkqtmathtextlatexparser.h:178
static QString tokenType2String(tokenType type)
convert a tokenType into a string, e.g. for debugging output
tokenType currentToken
used by the tokenizer. type of the current token
Definition jkqtmathtextlatexparser.h:155
QMap< QString, size_t > lastMatrixLineCommandCount
returns the number of \hline , \hdashline , ... commands in the last parseLatexString() call
Definition jkqtmathtextlatexparser.h:159
JKQTMathTextNode * parseInstruction(bool *_foundError=nullptr, bool *getNew=nullptr)
parses a single instruction (including it's parameters)
JKQTMathTextLatexParser(JKQTMathText *parent=nullptr)
class constructor
static QHash< QString, QChar > accentLetters
maps instructions for accents in text-mode (e.g. \'a or \ae ) to the corresponding unicode character
Definition jkqtmathtextlatexparser.h:180
tokenType getToken()
tokenizer for the LaTeX parser
QString readUntil(bool get, const QString &endsequence, bool removeFirstlineWhitespace=false)
read all text without tokenizing, until the sequence endsequence is found.
JKQTMathTextNode * parseMath(bool get)
parse a LaTeX math environment
static void initStaticStructures()
fills all static data structures, if they are still empty
static QSet< QChar > mathEnvironmentSpecialChars
characters that require special treatment in math mode
Definition jkqtmathtextlatexparser.h:174
static QSet< QChar > TokenCharacters
characters that initiate a new token
Definition jkqtmathtextlatexparser.h:172
bool parsinginMathTextStyle
used by the parser. indicates whether to use textstyle or displaystyle in math-mode
Definition jkqtmathtextlatexparser.h:169
static QSet< QChar > mathEnvironmentSpecialEndChars
characters that require special treatment in math mode
Definition jkqtmathtextlatexparser.h:176
QString parseString
used by the tokenizer. The string to be parsed
Definition jkqtmathtextlatexparser.h:165
QString currentTokenName
used by the tokenizer. Name of the current token, id applicable
Definition jkqtmathtextlatexparser.h:161
static QSet< QString > mathEnvironmentSpecialText
characters that have to be replaced by the correspcoting JKQTMathTextSymbolNode in math mode
Definition jkqtmathtextlatexparser.h:186
subclass representing one node in the syntax tree
Definition jkqtmathtextnode.h:37
base class for all math markup parsers used by JKQTMathText
Definition jkqtmathtextparser.h:43
subclass representing a list of nodes in the syntax tree, layed out vertically
Definition jkqtmathtextverticallistnode.h:50
#define JKQTMATHTEXT_LIB_EXPORT
Definition jkqtmathtext_imexport.h:108
JKQTMathTextVerticalOrientation
type of ffractions represented by JKQTMathTextFracNode
Definition jkqtmathtexttools.h:682
JKQTMathTextHorizontalAlignment
types of horizontal alignment
Definition jkqtmathtexttools.h:661
JKQTMathTextBraceType
types of available braces
Definition jkqtmathtexttools.h:222
@ MTVOFirstLine
baseline of the whole block is at the baseline of the first line
Definition jkqtmathtexttools.h:684
@ MTHALeft
align left
Definition jkqtmathtexttools.h:662
@ MTBTAny
any bracket, used by JKQTMathText::parseLatexString()
Definition jkqtmathtexttools.h:234