‘Freeze’ math formulas and graphics

‘Freeze’ equations and included graphics as raster images in LaTeX output

 

LaTeX finds extensive application as a typesetting system for the mathematical equations, formulas, and symbols composition. Here is what would make it your preferred choice for equation creation:

  • LaTeX employs a specific syntax for mathematical equations.
  • It offers a wide range of mathematical symbols, operators, and structures suitable for expressing equations.
  • LaTeX provides specialized packages for mathematical typesetting, enhancing the default LaTeX functionality by introducing additional features, symbols, and environments to facilitate the creation of complex equations.
  • It allows you to align equations, automatically number equations, control the formatting of mathematical expressions, etc.
  • LaTeX effortlessly incorporates mathematical equations within text paragraphs, as part of mathematical proofs or explanations, or in dedicated equation blocks. It automatically adjusts spacing and formatting for seamless integration.
  • LaTeX also features the inclusion of graphic files like PDF, PS/EPS, JPEG, or PNG. On the other hand, Aspose.TeX restricts PDF inclusion but supports the inclusion of XPS instead.

The code presented here demonstrates how you can get the result of TeX/LaTeX conversion with math formulas and/or included graphics saved as fixed raster images. So if you decide to convert the output file to some other format, such as HTML, formulas, and graphics will remain intact without any distortion.

To run the examples we need:

  • The Aspose.TeX for C++ API, - a feature-rich, powerful, and easy-to-use document processing and conversion API for the C++ platform.
  • Open the NuGet package manager, search for Aspose.TeX.Cpp and install it. You may also use the following command from the Package Manager Console:

Package Manager Console Command

PM> Install-Package Aspose.TeX.Cpp

How to 'freeze' math formulas and included graphics as raster images using Aspose.TeX for C++

Here are two examples illustrating how to turn certain elements of TeX output into raster images. The first one is for math formulas and the second is for included graphics. Both options are properties of the SaveOptions class.

C++ code example: 'Freeze' math formulas as raster images

    // Create conversion options instance.
    ...
    // Create and assign saving options instance if needed.
    ...
    // Set to true if you want math formulas to be converted to raster images.
    options->get_SaveOptions()->set_RasterizeFormulas(true);

C++ code example: 'Freeze' included graphics as raster images

    // Create conversion options instance.
    ...
    // Create and assign saving options instance if needed.
    ...
    // Set to true if you want included graphics (if it contains vector elements) to be converted to raster images.
    options->get_SaveOptions()->set_RasterizeIncludedGraphics(true);



FAQ

1. What does it mean to freeze math formulas and graphics in LaTeX?

Freezing math formulas and graphics in LaTeX refers to the process of converting them into static elements that remain unchanged, even if the document is edited or recompiled. This ensures that the appearance of the formulas and graphics remains consistent and does not vary with subsequent compilations or modifications to the document.

2. How can I freeze math formulas and graphics in LaTeX documents?

In LaTeX, you can freeze math formulas and graphics by converting them into images or other static formats and then including them in the LaTeX document.

3. What are the advantages of freezing math formulas and graphics in LaTeX?

Freezing math formulas and graphics in LaTeX offers several advantages. It ensures consistency in the appearance of formulas and graphics across different document compilations and environments. Additionally, it reduces the computational overhead associated with rendering complex formulas and graphics, leading to faster document compilation times.

LaTeX What is LaTeX File Format

LaTeX is a TeX format if said briefly. LaTeX files are plain text files written in their own markup language. They may require the inclusion of other data like images and/or other LaTeX files. LaTeX provides you with plenty of advanced features to create tables, include graphics, write math equations and formulas, etc. All these features are available in so-called packages.