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
Loading...
Searching...
No Matches
Collaboration diagram for Supported LaTeX-Subset:

Switch between Math- and Text-Mode

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:

  • normal text is typeset in an italic font
  • numbers, parantheses ... are typeset in an upright font
  • operators are typeset with additional space around them

Formatting

The supported LaTeX subset for formatting text is listed in this section.

Font Properties

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 uppercase

Font Selection

These 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
    (generated by
    default, \userfont{Arial}{Arial}, \userfont{Comic Sans MS}{Comic Sans MS} )
  • \textbb{...} \mathbb{...} : draw the contained text in blackboard font face
    Blackboard fonts are not widely available on target systems (viable fonts are e.g. "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:
    • MTBBDMfontDirectly: use a blackboard font specified by JKQTMathText::setFontBlackboard()
      using JKQTMathText::setFontBlackboard("Castellar")
    • MTBBDMsimulate:
      using JKQTMathText::setFontBlackboard("Arial")
    • MTBBDMunicodeCharactersOrFontDirectly:
      using JKQTMathText::setFontBlackboard("Castellar")
    • MTBBDMunicodeCharactersOrSimulate:
      using JKQTMathText::setFontBlackboard("Arial")
  • \textscript{...} \mathscript{...} {\script...} : draw the contained text in a script font face

Font Sizes

JKQTMathText 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...$

Text Decoration: Underline, Overlines, Strikeout, ...

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 symbols

Text Color

JKQTMathText supports several standard commands to set the text color:

  • \textcolor{color}{...} \mathcolor{color}{...} : draw colored text
  • {\color{color}...} : same as above

You 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)

See also
jkqtp_String2QColor()

Boxes

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)

Verbatim Text

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!
    generated by <code>\verb!\LaTeX{} is not pares inside \verb~..~! outside {\backslash}verb</code>
  • \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 characters

Symbols and special characters

These 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
    (generated by <code>A: \char65, circonflex: \char"109 accent: \char\'351</code>)
  • \unicode{HEX} and \usym{HEX} : draws a unicode character from its 32-bit codepoint
    (generated by <code>star: \unicode{2605}, circonflex: \unicode{109} emoticons: \usym{1F440} \usym{1F929}</code>)
  • \utfeight{HEX} : draws a unicode character from its UTF-8 encoding
    (generated by <code>star: \utfeight{e29885} emoticons \utfeight{F09F9881} \utfeight{f09f98bb}</code>)
  • The usual LaTeX-accent commands are also implemented here and work as expected in text-mode, provided the matching unicode characters are available in the current font.
  • In math-mode the text-accent commands do not work. here you have to use the math-mode commands:
  • \{ / \} : 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-dash

Explicit Whitespaces

NONE
\ (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

Environments for Multi-line text

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}$

Tabular Environments

See also
Additional matrix-environments are listed in Matrix/Array Type Instructions

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 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

Here is an example:

\begin{tabular}{:l|cr||}
\hdashline
a1--- & b1--- & c1---\\
a2- & b2- & c2-\\
\hline
a3 & b3 & c3\\
\hline\hline
a4 & b4 & c4\\
\bottomrule
\end{tabular}

Supported Mathematical Constructs

Sub- and Superscript

The standard LaTeX sub-/superscript instructions (i.e. text_{sub} or text^{super} ) are supported:

  • ^{...} _{...} : display the contents of braces in superscript/subscript

    Special subscript/superscript typesetting applies, when the sub/super follows \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/Parantheses ...

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 ,
  • You can use \left. or \right. to have only right or only left brace ,
    generated by
    {\backslash}left.: $\left. a\cdot x^2\right)$\ \ \ \ \ {\backslash}right.: $\left( a\cdot x^2\right.$

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:

generated by

$\Biggl\langle\biggl\{\Bigl[\bigl( r^{123}\bigr)\Bigr]\biggr\}\Biggr\rangle$

Roots

There are also instructions that allow to write roots:

  • $\sqrt{1+\sqrt{1+x}}$
  • $\sqrt[3]{1+\sqrt[3]{1+x}}$

Undersetting, Oversetting, Underbraces, Overbraces ...

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}$

Fraction Type Instructions

Several fraction-typed LaTeX instructions are supported:

  • $\frac{...}{...}$
  • $\tfrac{...}{...}$ (70% smaller font)
  • $\dfrac{...}{...}$
  • $\sfrac{...}{...}$
  • $\stfrac{...}{...}$ (70% smaller font)
  • $\stackrel{...}{...}$ $\binom{...}{...}$

Matrix/Array Type Instructions

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