mirror of
https://github.com/jkriege2/JKQtPlotter.git
synced 2024-12-25 01:51:49 +08:00
JKQTMathText: added support for framed/shaded/snugshade-environments with linebreaks and framed
This commit is contained in:
parent
816a97f88f
commit
22c45bcdea
@ -71,6 +71,7 @@ Changes, compared to \ref page_whatsnew_V4_0_0 "v4.0.0" include:
|
||||
<li>NEW: JKQTMathTextVerticalListNode allows to typeset a vertical list of lines</li>
|
||||
<li>NEW: added \c \\substack[lcr]{...\\\\...} , \c \\lsubstack{...\\\\...} , \c \\rsubstack{...\\\\...} instructions</li>
|
||||
<li>NEW: added support for flushleft/flushright/center-environments with linebreaks</li>
|
||||
<li>NEW: added support for framed/shaded/snugshade-environments with linebreaks and framed</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
|
||||
|
BIN
doc/images/jkqtmathtext/jkqtmathtext_beginframed.png
Normal file
BIN
doc/images/jkqtmathtext/jkqtmathtext_beginframed.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
BIN
doc/images/jkqtmathtext/jkqtmathtext_beginshaded.png
Normal file
BIN
doc/images/jkqtmathtext/jkqtmathtext_beginshaded.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
BIN
doc/images/jkqtmathtext/jkqtmathtext_beginsnugshade.png
Normal file
BIN
doc/images/jkqtmathtext/jkqtmathtext_beginsnugshade.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
@ -75,6 +75,9 @@ TestForm::TestForm(QWidget *parent) :
|
||||
ui->cmbTestset->addItem("text: flushleft", "\\begin{flushleft}text\\\\\\textbf{2^{nd} line of text}\\\\last \\textit{line!} $\\frac{1}{2}$\\end{flushleft}");
|
||||
ui->cmbTestset->addItem("text: flushright", "\\begin{flushright}text\\\\\\textbf{2^{nd} line of text}\\\\last \\textit{line!} $\\frac{1}{2}$\\end{flushright}");
|
||||
ui->cmbTestset->addItem("text: center", "\\begin{center}text\\\\\\textbf{2^{nd} line of text}\\\\last \\textit{line!} $\\frac{1}{2}$\\end{center}");
|
||||
ui->cmbTestset->addItem("text: framed", "\\begin{framed}text\\\\\\textbf{2^{nd} line of text}\\\\last \\textit{line!} $\\frac{1}{2}$\\end{framed}");
|
||||
ui->cmbTestset->addItem("text: shaded", "\\begin{shaded}text\\\\\\textbf{2^{nd} line of text}\\\\last \\textit{line!} $\\frac{1}{2}$\\end{shaded}");
|
||||
ui->cmbTestset->addItem("text: snugshade", "\\begin{snugshade}text\\\\\\textbf{2^{nd} line of text}\\\\last \\textit{line!} $\\frac{1}{2}$\\end{snugshade}");
|
||||
ui->cmbTestset->addItem("mathtest", "This is normal text: $this is math:\\langle r^2(\\tau)\\rangle=\\left\\langle (\\vec{r}(t)-\\vec{r}(t+\\tau) )^2\\right\\rangle\\ \\ \\ g(\\tau)=\\frac{1}{N}\\cdot\\left(1+\\frac{2}{3}\\frac{\\langle r^2(\\tau)\\rangle}{w_{xy}^2}\\right)^{-1} \\lfloor\\rfloor\\lceil\\rceil\\langle\\rangle\\left\\{\\vec{a}\\left|\\|\\vec{a}\\|_2\\geq2\\right.\\right\\} \\vec{r}\\vec{R}\\frac{\\sqrt{\\sqrt{\\sqrt{\\sum_{i=0}^\\infty \\hat{i}^2}+y^\\alpha}+1}}{\\dot{v}\\equiv\\ddot{r}}\\argmin_{\\vec{k}}\\sum_{\\sqrt{i}=0}^{N}\\int_{x_0}^{x_1}\\left(\\left(\\left(x\\right)\\right)\\right)\\underbrace{\\left[\\left\\{\\frac{\\partial f}{\\partial x}\\right\\}\\cdot\\frac{1}{2}\\right]}{\\text{underbraced text \\hbar}}\\cdots\\frac{\\sqrt{\\sum_{i=0}^2 \\hat{i}^2}+y^\\alpha}{\\dot{v}\\equiv\\ddot{r}}, \\hat{t}\\hat{T} \\overbrace{\\left|\\sqrt{x\\cdot Y}\\right|}{\\propto\\bbN\\circ\\bbZ} \\left<\\arrow{x(\\tau)}\\cdot\\vec{R}(t+\\bar{\\tau})\\right> \\alpha\\beta\\gamma\\delta\\epsilon\\Gamma\\Delta\\Theta\\Omega \\left\\_\\left~\\cbrt{\\hbar\\omega}\\right~\\right\\_$");
|
||||
ui->cmbTestset->addItem("math: upper/lower parantheses test:", "$\\text{bblabla} \\frac{1}{2}\\cdot\\left(\\frac{1}{\\mathrm{e}^x+\\mathrm{e}^{-x}}\\right)\\cdot\\left(\\frac{1}{\\frac{1+2}{5+x}}\\right)\\cdot\\left(\\frac{1}{\\exp\\left[-\\frac{y^2}{\\sqrt{x}}\\right]\\cdot\\exp\\left[-\\frac{1}{\\frac{1}{2}}\\right]}\\right) $");
|
||||
ui->cmbTestset->addItem("math: ACF test", "$g_{rg}^{ab}(\\tau)=\\frac{1}{N}\\cdot\\left(1+\\frac{2}{3}\\frac{\\langle r^2(\\tau)\\rangle}{w_{xy}^2}\\right)^{-1}\\cdot\\left(1+\\frac{2}{3}\\frac{\\langle r^2(\\tau)\\rangle}{w_{xy}^2}\\right)^{-\\frac{1}{2}}$");
|
||||
|
@ -1534,6 +1534,17 @@ JKQTMathTextNode* JKQTMathText::parseLatexString(bool get, JKQTMathTextBraceType
|
||||
vlist->addChild(parseLatexString(true, MTBTAny, envname));
|
||||
first=false;
|
||||
}
|
||||
} else if (envname=="framed" || envname=="shaded" || envname=="snugshade") {
|
||||
JKQTMathTextHorizontalAlignment alignment=MTHALeft;
|
||||
JKQTMathTextVerticalListNode* vlist = new JKQTMathTextVerticalListNode(this, alignment, 1.0, JKQTMathTextVerticalListNode::SMDefault, MTVOFirstLine );
|
||||
QStringList color;
|
||||
color<<jkqtp_QColor2String(Qt::lightGray);
|
||||
nl->addChild(new JKQTMathTextBoxInstructionNode(this, envname, vlist, color));
|
||||
bool first=true;
|
||||
while (first || currentToken==MTTinstructionNewline) {
|
||||
vlist->addChild(parseLatexString(true, MTBTAny, envname));
|
||||
first=false;
|
||||
}
|
||||
} else {
|
||||
error_list.append(tr("error @ ch. %1: unknown environment '%2'").arg(currentTokenID).arg(envname));
|
||||
}
|
||||
|
@ -202,12 +202,15 @@ class JKQTMathTextNode; // forward
|
||||
- <code>$\\rsubstack{...\\\\...}$</code> \image html jkqtmathtext/jkqtmathtext_rsubstack.png
|
||||
.
|
||||
|
||||
\subsection JKQTMathTextSuppoertedLaTeXTextAlignment Environments with Multi-line text
|
||||
\subsection JKQTMathTextSuppoertedLaTeXTextAlignment Environments for Multi-line text
|
||||
Several environments are supported that allow to layout text with linebreaks and different alignemnts:
|
||||
- <code>$\\begin{document} ... \\\\ ... \\end{document}$</code> \image html jkqtmathtext/jkqtmathtext_beginflushleft.png
|
||||
- <code>$\\begin{flushleft} ... \\\\ ... \\end{flushleft}$</code> \image html jkqtmathtext/jkqtmathtext_beginflushleft.png
|
||||
- <code>$\\begin{flushright} ... \\\\ ... \\end{flushright}$</code> \image html jkqtmathtext/jkqtmathtext_beginflushright.png
|
||||
- <code>$\\begin{center} ... \\\\ ... \\end{center}$</code> \image html jkqtmathtext/jkqtmathtext_begincenter.png
|
||||
- <code>$\\begin{framed} ... \\\\ ... \\end{framed}$</code> \image html jkqtmathtext/jkqtmathtext_beginframed.png
|
||||
- <code>$\\begin{shaded} ... \\\\ ... \\end{shaded}$</code> \image html jkqtmathtext/jkqtmathtext_beginshaded.png
|
||||
- <code>$\\begin{snugshade} ... \\\\ ... \\end{snugshade}$</code> \image html jkqtmathtext/jkqtmathtext_beginsnugshade.png
|
||||
.
|
||||
|
||||
\section JKQTMathTextSuppoertedFonts Font Handling
|
||||
|
@ -798,6 +798,16 @@ void JKQTMathTextBoxInstructionNode::fillInstructions()
|
||||
/*Nparams=*/1);
|
||||
instructions["shaded"] = i;
|
||||
}
|
||||
{
|
||||
InstructionProperties i(InstructionProperties::NoModification,
|
||||
InstructionProperties::NoPen,
|
||||
[](JKQTMathTextEnvironment& /*ev*/, const QStringList& parameters, JKQTMathText* /*parent*/){
|
||||
return QBrush(jkqtp_String2QColor(parameters.value(0, QColor(Qt::transparent).name())), Qt::SolidPattern);
|
||||
},
|
||||
0,
|
||||
/*Nparams=*/1);
|
||||
instructions["snugshade"] = i;
|
||||
}
|
||||
{
|
||||
InstructionProperties i(InstructionProperties::NoModification,
|
||||
[](JKQTMathTextEnvironment& ev, const QStringList& parameters, JKQTMathText* parent){
|
||||
|
Loading…
Reference in New Issue
Block a user