mirror of
https://github.com/jkriege2/JKQtPlotter.git
synced 2024-12-25 01:51:49 +08:00
corrected documentation
This commit is contained in:
parent
bf30964f0f
commit
306436f770
1
.gitignore
vendored
1
.gitignore
vendored
@ -89,3 +89,4 @@ Thumbs.db
|
||||
moc_predefs.h
|
||||
/lib/jkqtplotter/*.TMP
|
||||
/doc/doxygen_log.txt
|
||||
/doc/*.tmp
|
||||
|
@ -122,7 +122,7 @@ All test-projects are Qt-projects that use qmake to build. You can load them int
|
||||
<tr><th> Screenshot <th> Description <th> Notes
|
||||
<tr><td> \image html jkqtmathtext_simpletest_small.png
|
||||
<td> \subpage JKQTmathTextSimpleExample
|
||||
<td> JKQTMathText<br>render LaTeX markup (Schrödinger's equation)
|
||||
<td> JKQTmathText<br>render LaTeX markup (Schrödinger's equation)
|
||||
</table>
|
||||
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
/*!
|
||||
|
||||
\defgroup jkqtmathtext JKQtMathText LaTeX-Renderer for Qt
|
||||
\defgroup jkqtmathtext JKQTmathText LaTeX-Renderer for Qt
|
||||
|
||||
This group contains JKQtMathText, a self-contained LaTeX-renderer for Qt. It is used to renderer
|
||||
This group contains JKQTmathText, a self-contained LaTeX-renderer for Qt. It is used to renderer
|
||||
labels in JKQtPlotter, but can be used independently. The class does not depend on any library,
|
||||
except Qt. In particular it actually parses a LaTeX string and draws it in pure C++. It does NOT rely
|
||||
on an installed LaTeX for the rendering!
|
||||
|
@ -13,7 +13,7 @@ This software is licensed under the term of the GNU Lesser General Public Licens
|
||||
- high-quality plotting
|
||||
- no other dependencies than Qt >=4.7 (compatible with Qt 5.xx)
|
||||
- highly customizable axes/grids (linear/log, date/time, custom ticks ...)
|
||||
- integrated LaTeX parser/renderer JKQtMathText for axis labels, ticks, notes ...
|
||||
- integrated LaTeX parser/renderer JKQTmathText for axis labels, ticks, notes ...
|
||||
- extensive user-interactions pre-programmed (several zooming modes, selecting regions, custom context menus, switch graph visibility, ...)
|
||||
- full print and export (PDF,PNG,...) support with preview and parametrization out-the-box
|
||||
- highly customizable look and feel
|
||||
@ -39,7 +39,7 @@ This software is licensed under the term of the GNU Lesser General Public Licens
|
||||
- geometric forms/annotations, see: \ref jkqtplotter_geoplots
|
||||
- can be easily extended by deriving a new graph from JKQTPplotElement or JKQTPplotObject
|
||||
- optional: OpenCV interface, see: \ref jkqtpopencvinterface
|
||||
- integrated LaTeX parser/renderer JKQtMathText:
|
||||
- integrated LaTeX parser/renderer JKQTmathText:
|
||||
- pure C++
|
||||
- no dependencies in particular no installed LaTeX required
|
||||
- can be used independently of JKQtPlotter
|
||||
|
@ -54,6 +54,6 @@ All test-projects are Qt-projects that use qmake to build. You can load them int
|
||||
|
||||
| Screenshot | Description | Notes |
|
||||
|:-------------:| ------------- | ------------- |
|
||||
| [![](../screenshots/jkqtmathtext_simpletest_small.png)](./jkqtmathtext_simpletest) | [JKQTMathText: LaTeX Renderer](./jkqtmathtext_simpletest) | |
|
||||
| [![](../screenshots/jkqtmathtext_simpletest_small.png)](./jkqtmathtext_simpletest) | [JKQTmathText: LaTeX Renderer](./jkqtmathtext_simpletest) | |
|
||||
|
||||
|
||||
|
@ -193,7 +193,7 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item row="15" column="0" colspan="2">
|
||||
<widget class="JKQTMathTextLabel" name="labMath">
|
||||
<widget class="JKQTmathTextLabel" name="labMath">
|
||||
<property name="text">
|
||||
<string>left(left[sqrt{2picdotint_{-infty}^infty f(x);mathrm{d}x}right]right) </string>
|
||||
</property>
|
||||
@ -418,7 +418,7 @@
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>JKQTMathTextLabel</class>
|
||||
<class>JKQTmathTextLabel</class>
|
||||
<extends>QLabel</extends>
|
||||
<header>jkqtmathtext/jkqtmathtext.h</header>
|
||||
</customwidget>
|
||||
|
@ -4,9 +4,9 @@ This directory contains all files that belong to the JKQtPlotter library (includ
|
||||
|
||||
### simply include all necessary files
|
||||
If you use QMake and simply want to include all necessary files into your project, include one of these `PRI`-files into your QMake Project:
|
||||
- `jkqtplotter.pri` contains all files in this library, including `JKQtFastPlotter` and `JKQtMathText`
|
||||
- `jkqtplotter.pri` contains all files in this library, including `JKQtFastPlotter` and `JKQTmathText`
|
||||
- `jkqtfastplotter.pri` contains only those files from this directory which are necessary to build `JKQtFastPlotter`
|
||||
- `jkqtmathtext.pri` contains only those files from this directory which are necessary to build `JKQtMathText`
|
||||
- `jkqtmathtext.pri` contains only those files from this directory which are necessary to build `JKQTmathText`
|
||||
|
||||
### Build static libraries
|
||||
In the directory [`../staticlib`](../staticlib) you will find several Project files that build a static library of the full JKQtPlotter (including JKQtFastPlotter and JKMathText), or of subsets of this library. You can then link against these libs in your project.
|
||||
|
@ -4208,7 +4208,7 @@ QString JKQTmathText::decorationToString(JKQTmathText::MTdecoration mode)
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
JKQTMathTextLabel::JKQTMathTextLabel(QWidget *parent):
|
||||
JKQTmathTextLabel::JKQTmathTextLabel(QWidget *parent):
|
||||
QLabel(parent)
|
||||
{
|
||||
m_mathText=new JKQTmathText(this);
|
||||
@ -4219,16 +4219,16 @@ JKQTMathTextLabel::JKQTMathTextLabel(QWidget *parent):
|
||||
buffer=QPixmap();
|
||||
}
|
||||
|
||||
JKQTMathTextLabel::~JKQTMathTextLabel()
|
||||
JKQTmathTextLabel::~JKQTmathTextLabel()
|
||||
{
|
||||
}
|
||||
|
||||
JKQTmathText *JKQTMathTextLabel::getMathText() const
|
||||
JKQTmathText *JKQTmathTextLabel::getMathText() const
|
||||
{
|
||||
return m_mathText;
|
||||
}
|
||||
|
||||
void JKQTMathTextLabel::setMath(const QString &text, bool doRepaint)
|
||||
void JKQTmathTextLabel::setMath(const QString &text, bool doRepaint)
|
||||
{
|
||||
if (text!=lastText || doRepaint){
|
||||
lastText=text;
|
||||
@ -4239,7 +4239,7 @@ void JKQTMathTextLabel::setMath(const QString &text, bool doRepaint)
|
||||
}
|
||||
|
||||
|
||||
void JKQTMathTextLabel::internalPaint()
|
||||
void JKQTmathTextLabel::internalPaint()
|
||||
{
|
||||
//return;
|
||||
//qDebug()<<"internalPaint "<<lastText<<repaintDo;
|
||||
@ -4249,7 +4249,7 @@ void JKQTMathTextLabel::internalPaint()
|
||||
repaintDo=false;
|
||||
//qDebug()<<"internalPaint(): parse "<<m_mathText->parse(lastText)<<"\n "<<m_mathText->get_error_list().join("\n")<<"\n\n";
|
||||
if (!m_mathText->parse(lastText)) {
|
||||
qDebug()<<"JKQTMathTextLabel::internalPaint(): parse '"<<lastText<<"': "<<m_mathText->parse(lastText)<<"\n "<<m_mathText->get_error_list().join("\n")<<"\n\n";
|
||||
qDebug()<<"JKQTmathTextLabel::internalPaint(): parse '"<<lastText<<"': "<<m_mathText->parse(lastText)<<"\n "<<m_mathText->get_error_list().join("\n")<<"\n\n";
|
||||
}
|
||||
|
||||
if (buffer.width()<=0 || buffer.height()<=0) buffer=QPixmap(1000,100);
|
||||
@ -4283,7 +4283,7 @@ void JKQTMathTextLabel::internalPaint()
|
||||
//qDebug()<<"internalPaint(): DONE";
|
||||
}
|
||||
|
||||
void JKQTMathTextLabel::paintEvent(QPaintEvent *event)
|
||||
void JKQTmathTextLabel::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
//QLabel::paintEvent(event);
|
||||
//return;
|
||||
@ -4364,7 +4364,7 @@ QString JKQTmathText::MTplainTextNode::textTransform(const QString &text, JKQTma
|
||||
return text;
|
||||
}
|
||||
|
||||
void initJKQtMathTextResources()
|
||||
void initJKQTmathTextResources()
|
||||
{
|
||||
Q_INIT_RESOURCE(xits);
|
||||
}
|
||||
|
@ -50,23 +50,23 @@
|
||||
|
||||
|
||||
|
||||
/** \brief initialized Qt-ressources necessary for JKQtMathText
|
||||
/** \brief initialized Qt-ressources necessary for JKQTmathText
|
||||
* \ingroup jkqtmathtext
|
||||
*/
|
||||
LIB_EXPORT void initJKQtMathTextResources();
|
||||
LIB_EXPORT void initJKQTmathTextResources();
|
||||
|
||||
/*! \brief this class parses a LaTeX string and can then draw the contained text/equation onto a QPainter
|
||||
\ingroup jkqtmathtext
|
||||
|
||||
|
||||
JKQtMathText is a self-contained LaTeX-renderer for Qt. It is used to renderer
|
||||
JKQTmathText is a self-contained LaTeX-renderer for Qt. It is used to renderer
|
||||
labels in JKQtPlotter/JKQtBasePlotter, but can be used independently.
|
||||
The class does not depend on any library, except Qt.
|
||||
In particular it actually parses a LaTeX string and draws it in pure C++. It does NOT rely
|
||||
on an installed LaTeX for the rendering!
|
||||
|
||||
\section JKQtMathTextUsage Usage
|
||||
\subsection JKQtMathTextUsageDirect Direct Usage
|
||||
\section JKQTmathTextUsage Usage
|
||||
\subsection JKQTmathTextUsageDirect Direct Usage
|
||||
This small piece of C++ code may serve as an example of the usage and capabilities of the class:
|
||||
\code
|
||||
// create a JKQTmathText object.
|
||||
@ -87,7 +87,7 @@ LIB_EXPORT void initJKQtMathTextResources();
|
||||
painter.end();
|
||||
\endcode
|
||||
|
||||
\subsection JKQtMathTextSizing Determining the size of an equation
|
||||
\subsection JKQTmathTextSizing Determining the size of an equation
|
||||
|
||||
In addition there are also functions that allow to calculate the size of the equation, before drawing it (just like the functions in <a href="http://doc.qt.io/qt-5/qfontmetrics.html">QFontMetrics</a> and <a href="http://doc.qt.io/qt-5/qfontmetricsf.html">QFontMetricsF</a>):
|
||||
- getSizeDetail()
|
||||
@ -95,28 +95,28 @@ LIB_EXPORT void initJKQtMathTextResources();
|
||||
- getAscent(), getDescent()
|
||||
.
|
||||
|
||||
\subsection JKQtMathTextErrorHandling Error Handling
|
||||
\subsection JKQTmathTextErrorHandling Error Handling
|
||||
|
||||
The class is designed to be as robust as possible and will still return some output, even if the equation contains some errors.
|
||||
Nevertheless, several errors are detected while parsing. You can get a list of error messages using get_error_list() after calling parse().
|
||||
Also parse() will return \c false if an error occured while parsing.
|
||||
|
||||
|
||||
\subsection JKQtMathTextUsageQLabel Usage within a QLabel class JKQTMathTextLabel
|
||||
\subsection JKQTmathTextUsageQLabel Usage within a QLabel class JKQTmathTextLabel
|
||||
|
||||
Finally, there is also a QLabel-derived class JKQTMathTextLabel which can be used for drawing a LaTeX string onto a Qt form.
|
||||
Finally, there is also a QLabel-derived class JKQTmathTextLabel which can be used for drawing a LaTeX string onto a Qt form.
|
||||
|
||||
\see JKQTMathTextLabel
|
||||
\see JKQTmathTextLabel
|
||||
|
||||
|
||||
\section JKQtMathTextExamples Examples
|
||||
\section JKQTmathTextExamples Examples
|
||||
|
||||
Examples for the usage of this class can be found here:
|
||||
- \ref JKQTmathTextSimpleExample
|
||||
.
|
||||
|
||||
|
||||
\section JKQtMathTextSuppoertedLaTeX Supported LaTeX Subset
|
||||
\section JKQTmathTextSuppoertedLaTeX Supported LaTeX Subset
|
||||
|
||||
The supported LaTeX subset is listes below. Please note that some commands are used differently than in actual LaTeX.
|
||||
For example \c \\bf is just a renamed form of \c \\textbf and used as \c \\bf{...} and NOT as \c {\\bf...} .
|
||||
@ -152,7 +152,7 @@ LIB_EXPORT void initJKQtMathTextResources();
|
||||
- \c \\left~ \c \\right~ : ceil braces |~ ~|
|
||||
.
|
||||
|
||||
\section JKQtMathTextSuppoertedFonts Font Handling
|
||||
\section JKQTmathTextSuppoertedFonts Font Handling
|
||||
|
||||
Several fonts are defined as properties to the class:
|
||||
- A "roman" font used as the standard font ( set_fontRoman() in math-mode set_fontMathRoman() )
|
||||
@ -167,24 +167,24 @@ LIB_EXPORT void initJKQtMathTextResources();
|
||||
- A "caligraphic" font used to display caligraphic characters ( set_fontCaligraphic() )
|
||||
.
|
||||
|
||||
These fonts are generic font classes, which font is actually used can be configured in JKQtMathText class with the \c set_...() functions mentioned above. You can also use these functions to set the fonts used for math rendering in math-mode:
|
||||
These fonts are generic font classes, which font is actually used can be configured in JKQTmathText class with the \c set_...() functions mentioned above. You can also use these functions to set the fonts used for math rendering in math-mode:
|
||||
- useSTIX() use the STIX fonts from <a href="https://www.stixfonts.org/">https://www.stixfonts.org/</a> in math-mode<br>\image html jkqtmathparser_stix.png
|
||||
- useXITS() use the XITS fonts from <a href="https://github.com/alif-type/xits">https://github.com/alif-type/xits</a> in math-mode. These are included by default in this library and also activated by default.<br>\image html jkqtmathparser_xits.png
|
||||
- useASANA() use the ASANA fonts from <a href="https://ctan.org/tex-archive/fonts/Asana-Math/">https://ctan.org/tex-archive/fonts/Asana-Math/</a> in math-mode<br>\image html jkqtmathparser_asana.png
|
||||
- useAnyUnicode() use generic Unicode fonts, e.g. "Arial" and "Times New Roman" in math-mode. You should use fonts that contain as many of the mathematical symbols as possible to ensure good rendering results.<br>using "Times New Roman": \image html jkqtmathparser_timesnewroman.png
|
||||
<br>using "Arial": \image html jkqtmathparser_arial.png
|
||||
<br>using "Courier New": \image html \image html jkqtmathparser_couriernew.png
|
||||
<br>using "Comic Sans MS": \image html \image html jkqtmathparser_comicsans.png
|
||||
<br>using "Courier New": \image html jkqtmathparser_couriernew.png
|
||||
<br>using "Comic Sans MS": \image html jkqtmathparser_comicsans.png
|
||||
.
|
||||
|
||||
|
||||
Math-mode is activated by enclosing your equation in \c $...$ or \c \\[...\\] . This mode is optimized for mathematical equations. Here is an example of the difference:
|
||||
- <b>math-mode (XITS is used)</b> \c $...$: <br>\image html jkqtmathparser_schreq_mathmode.png
|
||||
- <b>normal mode (Times new Roman is used)</b>: <br>\image html jkqtmathparser_schreq_normalmode.png
|
||||
- <b>math-mode (XITS fonts are used, whitespaces are mostly not drawn directly, symbol spacing is different)</b> \c $...$: <br>\image html jkqtmathparser_schreq_mathmode.png
|
||||
- <b>normal mode (Times new Roman is used, whitespaces are evaluated directly)</b>: <br>\image html jkqtmathparser_schreq_normalmode.png
|
||||
.
|
||||
|
||||
|
||||
\section JKQtMathTextToHTML Convert to HTML
|
||||
\section JKQTmathTextToHTML Convert to HTML
|
||||
|
||||
The method toHtml() may be used to get a HTML representation of the LaTeX string, if possible (only for simple LaTeX equations!). Whether
|
||||
the transformation was possible is returned as a call by value argument!
|
||||
@ -1467,11 +1467,11 @@ inline uint qHash(const JKQTmathText::tbrDataH& data) {
|
||||
|
||||
\see JKQTmathText
|
||||
*/
|
||||
class LIB_EXPORT JKQTMathTextLabel: public QLabel {
|
||||
class LIB_EXPORT JKQTmathTextLabel: public QLabel {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit JKQTMathTextLabel(QWidget* parent=nullptr);
|
||||
virtual ~JKQTMathTextLabel();
|
||||
explicit JKQTmathTextLabel(QWidget* parent=nullptr);
|
||||
virtual ~JKQTmathTextLabel();
|
||||
|
||||
/** \brief returns the internal JKQTmathText instance used for drawing
|
||||
*
|
||||
|
@ -67,7 +67,7 @@ static QList<JKQtBasePlotter::JKQTPSaveDataAdapter*> jkqtpSaveDataAdapters;
|
||||
void initJKQtBasePlotterResources()
|
||||
{
|
||||
Q_INIT_RESOURCE(jkqtpbaseplotter);
|
||||
initJKQtMathTextResources();
|
||||
initJKQTmathTextResources();
|
||||
}
|
||||
|
||||
JKQtBasePlotter::JKQtBasePlotter()
|
||||
|
@ -379,7 +379,7 @@ class LIB_EXPORT JKQTPgeoSymbol: public JKQTPplotObject {
|
||||
};
|
||||
|
||||
|
||||
/*! \brief This JKQTPplotObject is used to display text. It uses the JKQTMathText
|
||||
/*! \brief This JKQTPplotObject is used to display text. It uses the JKQTmathText
|
||||
class in order to display LaTeX formulas.
|
||||
\ingroup jkqtplotter_geoplots
|
||||
|
||||
|
@ -70,6 +70,8 @@
|
||||
/*! \brief A simple function parser to parse (build memory tree representation) and
|
||||
evaluate simple mathematical expressions
|
||||
\ingroup jkmp
|
||||
|
||||
|
||||
This class implements a simple function parser which can parse
|
||||
mathematical expressions like <code> z=a*3+2.34^2*sin(pi*sqrt(x))</code> .
|
||||
More than one expression can be separated by semicolon ';'. The result of
|
||||
|
@ -46,7 +46,7 @@ Scatter Plots can have symbols where the shape/color/size is parametrized by a d
|
||||
|
||||
|
||||
## QuickFit 3.0 Screenshots
|
||||
The library JKQtPlotter was developed initially as a central part of the data evaluation software for biophysics [QuickFit 3.0](https://github.com/jkriege2/QuickFit3). The latter makes heavy use of `JKQtPlotter`, `JKQtMathText` and `JKQtFastPlotter`:
|
||||
The library JKQtPlotter was developed initially as a central part of the data evaluation software for biophysics [QuickFit 3.0](https://github.com/jkriege2/QuickFit3). The latter makes heavy use of `JKQtPlotter`, `JKQTmathText` and `JKQtFastPlotter`:
|
||||
|
||||
![QuickFit 3.0 Screenshot](./QF3_screen_dcalc.png)
|
||||
![QuickFit 3.0 Screenshot](./QF3_screen_fccsfit.png)
|
||||
|
Loading…
Reference in New Issue
Block a user