JustToThePoint English Website Version
JustToThePoint en español
JustToThePoint in Thai

LibreOffice Math and LaTeX

LibreOffice Math

LibreOffice Math is the LibreOffice suite’s formula editor, in other words, it is designed for creating and editing mathematical formulae and can be invoked in your text documents, spreadsheets, presentations, and drawings.

To insert a formula into a LibreOffice document, open your document in Writer, Calc, Draw, or Impress. If you want to insert a formula in LibreOffice Writer, go to Insert, Object, and Formula. Let’s insert the quadratic formula for the roots of the general quadratic equation.

In the Elements Dock (it is on the left of the Formula Editor), select the category (e.g. Unary/Binary Operators) you want to use in your formula from the drop-down list at the top of the Elements Dock, then the symbol (e.g. Division (Fraction)). LibreOffice Math is the LibreOffice suite's formula editor

LibreOffice Math is the LibreOffice suite's formula editor

The Formula Editor in LibreOffice Math uses a markup language to represent formulas. For example, a over b produces the fraction ab and a_n, 3 times 5, and sqrt {3}, an, 3x5 and √3 respectively when used in a formula. As you enter your formula using the markup language in the Formula Editor, it will appear in the Preview Window or update automatically (View, AutoUpdate display).

Our Formula Editor contains: {} over {}. Select the first placeholder , type -b, and right-click in the Formula Editor to open the context menu. Select a category (Unary/Binary Operators) and then select the markup example (+-a) that you want to use from the sub-context menu. Your Formula Editor should contain this: {-b + - {}} over {} LibreOffice Math is the LibreOffice suite's formula editor

LibreOffice Math is the LibreOffice suite's formula editor

You should go ahead and select from the category Functions, the sub-context menu sqrt x: {-b + - sqrt {}} over {}. Right-click again in the Formula Editor and select Functions, x^y and replace {}^{} for b^2, and so on.

LibreOffice Math is the LibreOffice suite's formula editor

LibreOffice Math is the LibreOffice suite's formula editor

Obviously, you could also enter expressions written in markup language directly in the Formula Editor: {-b +- sqrt{ b^2 -4ac}} over {2a}.

Another example would be: A=%pi*r^2. It produces π*r2. Observe that Greek characters (%alfa, %beta, %gamma… α, β, γ) can also be entered into a formula using the Symbols dialog. You just need to select Tools, Symbols on the main menu. LibreOfficeMath is a formula editor you can use to create or edit formulas

LibreOfficeMath is a formula editor you can use to create or edit formulas


LaTeX is a high-quality typesetting system; it includes features designed for the production of technical and scientific documentation.

The LaTeX source files are plain text. The default extension of LATEX source file is .tex.


% It declares the type of document, in this case is an article. The three most commonly used standard document-classes in LaTeX include: article, report, and book. Then, you will write the text of your document between the \\begin{document} and \\end{document} tags.

\title{Learning LaTeX} % It tittle is Learning LaTeX
\author{Máximo Núñez Alarcón, @Anawim, #justtothepoint} % Its author is Máximo Núñez Alarcón.
\date{August, 2021} % It was written in August 2021

% The text of your document should be written after the \begin{document} command. The part of your .tex file before this point is called the preamble. The point of the preamble is to define the type of document you are writing and the language, load extra packages you may need and set some parameters.

The amsmath is an extension package for LaTeX that provides various features to facilitate writing math formulas and to improve the typographical quality of their output.

If you are a non-English speaker, let’s say you want to write a LaTeX document in Spanish, you may use: \usepackage[utf8]{inputenc} and \usepackage[spanish]{babel}. The package babel makes possible to display special characters, e.g., “moño” and “canción”. The recommended input encoding is utf8.

Pythagorean theorem: \(x^2 + y^2 = z^2\)

% LaTeX allows two writing modes for mathematical expressions. The inline math mode is used to write formulas that are part of a paragraph and we use \(…\) as delimiters. x^2 is the LaTeX code that produces x2.

In mathematics, the binomial coefficients are the positive integers that occur as coefficients in the binomial theorem. 

% The display math mode is used to write expressions that are not part of a paragraph (they will be placed on separate lines). You can display math expressions using the following methods: \\[…\], \\begin{displaymath} … \\end{displaymath}, and \\begin{equation} … \\end{equation}

   \binom{n}{k} = \frac{n!}{k!(n-k)!} 
When fractions have the same denominators, we simply add or subtract the numerators as indicated and place the result over the common denominator, e.g., \(\frac{3}{2}+\frac{5}{2}=\frac{8}{2}=4\)

The quadratic formula is: \(x = \frac{{- b \pm \sqrt {b^2 - 4ac}}}{{2a}}\)

The \sqrt{arg} command produces the square root symbol with the argument as radicand, e.g., sqrt {b^2 - 4ac}. Besides, fractions are written using the code: \frac{numerator}{denominator}, e.g., frac{3}{2}, frac{5}{2}, and frac{8}{2}.

Overleaf is a collaborative cloud-based LaTeX editor. It is a user-friendly LaTeX tool which makes online document editing and collaboration seamless and hassle free. Papeeira is another online laTeX editor. Overleaf is an online LATeX editor

Overleaf is an online LATeX editor

TeXworks is a free, multi-platform (it is available for Windows, Linux, and macOS), and open-source LaTeX editor.

We are adding three mathematical expressions to show you how to write integrals, limits, and series in LaTeX.

      \int_0^1 x^3dx = \frac{1}{4} = 0.25  
      \lim_{n\to \infty}\frac{1}{n} = 0
\[   \sum_{i=1}^{n}i=\frac{n(n+1)}{2}
TeXworks is a free open-source LaTeX editor

TeXworks is a free open-source LaTeX editor

If you want to learn more about other LaTeX editors, read our article LaTeX and Markdown editors.

Python and LaTeX

user@pc:~$ python
Python 3.9.5 (default, May 11 2021, 08:20:37) 
[GCC 10.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from sympy import *
>>> pprint(latex(x**2+sin(1/x))) # We use latex() to get the LaTeX form of an expression.
x^{2} + \sin{\left(\frac{1}{x} \right)}
>>> pprint(x**2+sin(1/x), use_unicode=True) # The Unicode pretty printer is accessed from pprint(). It tries to figure out the best of Unicode and ASCII-art for generating output.
 2      1 
x  + sin⎜─⎟
>>> pprint(latex(diff(x**2+sin(1/x))))
2 x - \frac{\cos{\left(\frac{1}{x} \right)}}{x^{2}}
>>> pprint(diff(x**2+sin(1/x)), use_unicode=True)
2x - ──────

Render LaTeX math expressions in Hugo

MathJax is a open-source cross-browser JavaScript library that displays mathematical notation in web browsers, using MathML, LaTeX and ASCIIMathML markup. KaTeX is a faster alternative.

Let’s render LaText math expression in Hugo with MathJax3 or KaTeX (Math Typesetting in Hugo.)

	MathJax = {
	  tex: {
		inlineMath: [['$', '$'], ['\\(', '\\)']],
		displayMath: [['$$','$$'], ['\\[', '\\]']],
		processEscapes: true,
		processEnvironments: true
	  options: {
		skipHtmlTags: ['script', 'noscript', 'style', 'textarea', 'pre']
	window.addEventListener('load', (event) => {
		  x.parentElement.classList += 'has-jax'})
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
<script type="text/javascript" id="MathJax-script" async

Or, alternatively, /layouts/partials/katex.html,

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.css">
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.js"></script>

<script defer src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/contrib/auto-render.min.js" onload="renderMathInElement(document.body);"></script>
    document.addEventListener("DOMContentLoaded", function() {
        renderMathInElement(document.body, {
            delimiters: [
                {left: "$$", right: "$$", display: true},
                {left: "$", right: "$", display: false}
{{ if .Params.mathjax }}{{ partial "mathjax.html" . }}{{ end }}

Or, alternatively,

{{ if .Params.math }}{{ partial "katex.html" . }}{{ end }}
mathjax:true // math: true

Of course, you could omit the outer {{ if .Params.mathjax }}{{ partial “mathjax.html” . }}{{ end }} conditional above to load the library automatically on all pages, but this is not a good idea because these libraries are quite heavy.

      $x = {-b \pm \sqrt{b^2-4ac} \over 2a}$

$x = {-b \pm \sqrt{b^2-4ac} \over 2a}$

Bitcoin donation

JustToThePoint Copyright © 2011 - 2023 Anawim. ALL RIGHTS RESERVED. Bilingual e-books, articles, and videos to help your child and your entire family succeed, develop a healthy lifestyle, and have a lot of fun.

This website uses cookies to improve your navigation experience.
By continuing, you are consenting to our use of cookies, in accordance with our Cookies Policy and Website Terms and Conditions of use.