JKQTPlotter trunk/v5.0.0
an extensive Qt5+Qt6 Plotter framework (including a feature-richt plotter widget, a speed-optimized, but limited variant and a LaTeX equation renderer!), written fully in C/C++ and without external dependencies
|
These LaTeX-instructions allow to switch between math and text-mode:
$
...$ , \ensuremath{
...} , \equation{
...} : inside is math-mode\text{
...} , \mbox{
...} , \ensuretext{
...} : switches from math back to text-mode (or stays in text-mode)The following image shows the difference between text- and math-mode:
In text mode the text is rendered normally. In math mode the rendering is changed:
The supported LaTeX subset for formatting text is listed in this section.
JKQTMathText supports these instructions for font properties:
\textbf{
...} \mathbf{
...} {\bf
...} {\bfseries
...}: draw the contained text in bold face\textit{
...} \mathit{
...} {\it
...} {\itshape
...} : draw the contained text in italic face\emph{
...} : emphasize text\textsc{
...} \mathsc{
...} {\sc
...} {\scshape
...} : draw the text in small caps\uppercase{
...} : draw the text in all uppercase\lowercase{
...} : draw the text in all uppercaseThese instructions are supported to select a font:
\textrm{
...} \mathrm{
...} {\rm
...} {\rmfamily
...} \mbox{
...} : draw the contained text in normal upright roman font face\textsf{
...} \mathsf{
...} {\sf
...} {\sffamily
...} : draw the contained text in normal upright sans-serif font face\textcal{
...} \mathcal{
...} {\cal
...} : draw the contained text in caligraphic font face\textfrak{
...} \mathfrak{
...} {\frak
...} : draw the contained text in fraktur font face\textscript{
...} \mathscript{
...} {\script
...} : draw the contained text in script font face\texttt{
...} \mathtt{
...} {\tt
...} {\ttshape
...} : draw text in typewriter font\userfont{font}{
...} : draw text in a user-specific font, available on the system\textbb{
...} \mathbb{
...} : draw the contained text in blackboard font face"Double Stroke", "CloisterOpenFace BT", "GoudyHandtooled BT", "Castellar", "MathJax_AMS", "Castellar Standard", "MathJax_AMS Standard", "Colonna MT"
). But the most important blackboard characters are usually available in the higher unicode codepoints of Fonts specialized for math (e.g. XIST, STIX, ASANA). Therefore JKQTMathText supports using these characters, or simulating a blackboard font in addition to using one of the fonts above. You can set that by setting JKQTMathText::setFontBlackboradMode() with one of the options from JKQTMathTextBlackboradDrawingMode:\textscript{
...} \mathscript{
...} {\script
...} : draw the contained text in a script font faceJKQTMathText supports these instructions for font size:
{\tiny
...}{\ssmall
...}{\scriptsize
...}{\footnotesize
...}{\small
...}{\normalsize
...} switches back to the default font size{\large
...}{\Large
...}{\LARGE
...}{\huge
...}{\Huge
...}{\userfontsize{pointsize}
...}JKQTMathText supports these instructions for font size in math mode:
$\displaystyle
...$ switches back to the default font size$\textstyle
...$ switches back to the default font size$\scriptstyle
...$$\scriptscriptstyle
...$JKQTMathText supports several LaTeX instruction to decorate the text with underlines, overlines, etc:
\ul{
...} , \underline{
...} , \uline{
...} \underlined{
...} : draw the text with underlining\uul{
...} : draw the text with double-underlining\dashuline{
...} : draw the text with dashed underlining\dotuline{
...} : draw the text with dotted underlining\ol{
...} \overline{
...} \overlined{
...} : draw the text with overlining\ool{
...} : draw the text with double-overlining\sout{
...} : strike out the text\cancel{
...} : slanted strike out the text\bcancel{
...} : back-strike out the text\xcancel{
...} : x-strike out the text\vec{x} \dot{x} \ddot{x} \overline{x} \underline{x} \hat{x} \tilde{x} \uul{x} \ool{x} \bar{x} \arrow{x} \widehat{x} \widetilde{x} ...
: Decorations over/under symbolsJKQTMathText supports several standard commands to set the text color:
\textcolor{color}{
...} \mathcolor{color}{
...} : draw colored text{\color{color}
...} : same as aboveYou can use all color names like (black
, blue
, yellow
, transparent
, ... see e.g. https://www.w3.org/TR/SVG11/types.html#ColorKeywords or https://en.wikipedia.org/wiki/Web_colors) or a color defined via #RGB
#RRGGBB
#AARRGGBB
#RRRGGGBBB
#RRRRGGGGBBBB
(where R,G,B are HEX-digits)
These instructions draw boxes in various ways:
\boxed{
...} : draw text with a box around it\snugbox{
...} : draw text with a snug box around it\doublebox{
...} : draw text with a rounded box around it\ovalbox{
...} : draw text with a rounded box around it\Ovalbox{
...} : draw a thick oval box\dashbox{
...} , \dbox{
...} : draw a dashed box\dottedbox{
...} : draw a dottted box\ovaldoublebox{
...} : draw a double oval box\colorbox{bordercolor}{
...} : draw a colored box (see Text Color for accepted colors)\shaded{backgroundcolor}{
...} : draw a filled box (see Text Color for accepted colors)\snugshade{
...} : draw text with a snug shade around it (see Text Color for accepted colors)\fcolorbox{bordercolor}{backgroundcolor}{
...} : draw a colored, filled box (see Text Color for accepted colors)\colorbox{color}{
...} : draw a colored box around text (see Text Color for accepted colors)Sometimes it is necessary to typeset text withou interpreting it as LaTeX markup. These instructions are implemented for that:
\verb!...!
: interpret enclosed text between !
as verbose. Instead of \ ! you can choose ANY character!\begin{verbatim}...\end{verbatim}
: interpret enclosed multi-line text as verbatim.\begin{lstlisting}...\end{lstlisting}
: actually menat for highlighted code, for now this is the same as \begin{verbatim}
...\end{verbatim}.\begin{verbatim*}...\end{verbatim*}
: interpret enclosed multi-line text as verbatim. Print with visible whitespace and tab charactersThese instructions draw different types of characters and symbols:
\alpha
... : display the according greek letter in italic style (see Supported LaTeX-Symbols )\upalpha
... : display the according upright greek letter. This letter is always upright, independent of the surrounding environment (see Supported LaTeX-Symbols )\textalpha
... : display the according greek letter with italic style defined by the current environment (i.e. italic in mathmode or inside \textit{\alpha}
and upright in text mode). (see Supported LaTeX-Symbols )\charDECIMAL
and \char"HEX
and \char\'OCTAL
: draws a unicode character from its 32-bit codepoint \unicode{HEX}
and \usym{HEX}
: draws a unicode character from its 32-bit codepoint\utfeight{HEX}
: draws a unicode character from its UTF-8 encoding\{
/ \} : display opening/closing brace\_
: display underscore\sum
\prod
\int
... : plot special symbol (see Supported LaTeX-Symbols ). Note that depending on the fontEncoding the available symbols may differ (there are not all symbols defined in the MS Windows Symbol font!). Best coverage should be given by Unicode font encoding with a good unicode font installed!-
: draw a hyphen--
: draw an en-dash---
: draw an em-dashNONE | ||
\ (backslash+whitespace) | thicker whitespace (1/3em) | |
\enspace | 1en whitespace | |
\emspace / \quad | quad (1em) whitespace | |
\qquad | qquad (2em) whitespace | |
\ , / \thinspace | thin whitespace | |
\ : / \medspace | medium whitespace | |
\ ; / \thickspace | thick whitespace | |
\! / \negthinspace | negative thin whitespace | |
\negmedspace | negative medium whitespace | |
\negthickspace | negative thick whitespace | |
\phantom{XXX} | whitespace with the width and height of XXX (may contain LaTeX instructions) | |
\vphantom{XXX} | whitespace with the height of XXX (may contain LaTeX instructions) and width 0 | |
\hphantom{XXX} | whitespace with the width of XXX (may contain LaTeX instructions) and height 0 |
Several environments are supported that allow to layout text with linebreaks and different alignemnts:
$\begin{document} ... \\ ... \end{document}$
$\begin{flushleft} ... \\ ... \end{flushleft}$
$\begin{flushright} ... \\ ... \end{flushright}$
$\begin{center} ... \\ ... \end{center}$
$\begin{framed} ... \\ ... \end{framed}$
$\begin{shaded} ... \\ ... \end{shaded}$
$\begin{snugshade} ... \\ ... \end{snugshade}$
For text-mode tables, the tabular
-environment is supported:
$\begin{tabular}{COLSPEC} a & b & ...\\ c & d & ...\end{tabular}$
COLSPEC
is a LaTeX column specifier, i.e. a sequence composed of these parts:l
: left-aligned columnc
: centered columnr
: right-aligned column
| : single line||
: double line
: : single dashed line::
: double dashed lineIn all these environments, you can use the following instructions to draw lines above/below a row in the matrix:
\hline
or \midrule:
a single line \hline\hline
: a double line \toprule
or \bottomrule
: a heavy line\hdashline
: a single dashed line\hdashline\hdashline
: a double dashed lineHere is an example:
The standard LaTeX sub-/superscript instructions (i.e. text_{sub}
or text^{super}
) are supported:
^{
...} _{
...} : display the contents of braces in superscript/subscript\sum
\Prod
...:\limits
, \nolimits
: Several special symbols, like \sum
, \lim
, ... cause sub-/superscripts to be positioned below/above the symbol, not besides it. This behaviour can be altered by using \limits
and \nolimits
:$\substack[lrc]{...\\...}$
allows to e.g. subset several lines below a \sum
using \sum\limits_\substack{a<5\\b<100}
:$\lsubstack{...\\...}$
$\rsubstack{...\\...}$
Braces in math mode are adjusted in size, so they are a small bit (factor brace_factor
) larger than the contents. To enable this you have to write braces with \left
and \right
. These types of braces are defined (slight differences to LaTeX standard):
\left
( \right
) : default meaning (),\left
[ \right
] : default meaning [],\left\{
\right\}
: default meaning {},\left\langle
\right\rangle
: "averaging" braces ,\left\lfloor
\right\rfloor
: floor braces ,\left\lceil
\right\rceil
: ceil braces ,\left|
\right|
: absolute value braces | |,\left\
| \right\
| : norm braces || ||,\left\llcorner
\right\lrcorner
: lower corner braces ,\left\ulcorner
\right\urcorner
: upper corner braces ,\left
. or \right
. to have only right or only left brace ,In additional fixed-size parantheses are available with the following family of instructions:
\bigl
([\{\langle... , \big
([\{\langle... and \bigr
)]\}\rangle...\Bigl
([\{\langle... , \Big
([\{\langle... and \Bigr
)]\}\rangle...\biggl
([\{\langle... , \bigg
([\{\langle... and \biggr
)]\}\rangle...\Biggl
([\{\langle... , \Bigg
([\{\langle... and \Biggr
)]\}\rangle...They use the same rendering code as the standard \left
and \right
instructions. Here is an example:
code $\Biggl\langle\biggl\{\Bigl[\bigl( r^{123}\bigr)\Bigr]\biggr\}\Biggr\rangle$
There are also instructions that allow to write roots:
$\sqrt{1+\sqrt{1+x}}$
$\sqrt[3]{1+\sqrt[3]{1+x}}$
There are also instructions that allow to under/overset braces, arrows, ...:
$\underbrace{x+x+...+x}{k\ \mathrm{times}}$
$\overbrace{x+x+...+x}{k\ \mathrm{times}}$
$\underbracket{x+x+...+x}{k\ \mathrm{times}}$
$\overbracket{x+x+...+x}{k\ \mathrm{times}}$
$\overset{main}{over}$
$\underset{main}{under}$
Several fraction-typed LaTeX instructions are supported:
$\frac{...}{...}$
$\tfrac{...}{...}$
(70% smaller font)$\dfrac{...}{...}$
$\sfrac{...}{...}$
$\stfrac{...}{...}$
(70% smaller font)$\stackrel{...}{...}$ $\binom{...}{...}$
Simple instructions are:
$\stackrel{...}{...}$ $\binom{...}{...}$
Several Matrix/Array-typed LaTeX instructions are supported:
$\begin{cases} ... & ... \\ ... & ... \end{cases}$
$\begin{matrix} a & b & ...\\ c & d & ...\end{matrix}$
$\begin{pmatrix} a & b & ...\\ c & d & ...\end{pmatrix}$
$\begin{bmatrix} a & b & ...\\ c & d & ...\end{bmatrix}$
$\begin{Bmatrix} a & b & ...\\ c & d & ...\end{Bmatrix}$
$\begin{vmatrix} a & b & ...\\ c & d & ...\end{vmatrix}$
$\begin{Vmatrix} a & b & ...\\ c & d & ...\end{Vmatrix}$
$\begin{array}{COLSPEC} a & b & ...\\ c & d & ...\end{array}$
COLSPEC
is a LaTeX column specifier, i.e. a sequence composed of these parts: l
: left-aligned column c
: centered column r
: right-aligned column
| : single line ||
: double line
: : single dashed line ::
: double dashed line In all these environments, you can use the following instructions to draw lines above/below a row in the matrix:
\hline
or \midrule:
a single line \hline\hline
: a double line \toprule
or \bottomrule
: a heavy line\hdashline
: a single dashed line\hdashline\hdashline
: a double dashed line