LaTeX - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


LaTeX

• 

The latex command has been rewritten for Maple 2021, and it can now translate to LaTeX everything that can be displayed on a Maple worksheet or document (not embedded components) . The File > Export As > LaTeX related functionality has also been rewritten, now resulting in a LaTeX file that contains equation labels, hyperlinked in the input and text when they appear as such in the worksheet being exported, and where the input and output in the LaTeX file are formatted using automatic line breaking.

• 

There are now three main ways of using latex.

– 

Entering latexexpression followed by pressing Enter produces the display on the screen of the LaTeX form of expression, that you can copy and paste into a .tex file, to be used with any LaTeX application (not provided with the Maple system).

– 

Any Maple expression being displayed, input or output, or a subexpression of it, can be highlighted with the mouse, then translated to LaTeX and copied in one go through right-click and using the menu Edit > Copy As > Copy as LaTeX.

– 

Any Maple worksheet, say filename.mw, can be translated to LaTeX as a whole using the menu File > Export As > LaTeX. The resulting file, filename.tex, can be processed with any LaTeX application to produce a PDF file that looks as the worksheet. For tips to improve the LaTeX translation see LaTeX:-Tips.

• 

You can now use File > Export As > LaTeX to produce LaTeX versions of course lessons or entire scientific papers directly in the Maple worksheet, that combines what-you-see-is-what-you-get editing capabilities, including equation labels and all the sophisticated Maple Typesetting available, with the Maple computational engine to produce mathematical results.

 

 

The latex:-Settings

Tips for File > Export As > LaTeX

Examples

The latex:-Settings

• 

Several settings of the translation to LaTeX can now be adjusted according to preference, using the latex:-Settings command or its synonym LaTeX:-Settings. These settings and the corresponding default values can be seen entering the command with no arguments or using the keyword query

latex:-Settings

cacheresults=true,commabetweentensorindices=false,invisibletimes= ,leavespaceafterfunctionname=false,linelength=66,powersoftrigonometricfunctions=mixed,spaceaftersqrt=true,usecolor=true,usedisplaystyleinput=true,useimaginaryunit=I,useinputlineprompt=true,userestrictedtypesetting=false,usespecialfunctionrules=true,usetypesettingcurrentsettings=false

(1.1)
• 

The possible values of the right-hand sides and their meaning is as follows

– 

cacheresults : all results by the internal latex subroutines are cached, for performance, so the translations are computed only once. However, if you are changing things in your worksheet that affect the way things are displayed, previously cached results may prevent you to get different LaTeX translations for the same input. To avoid caching results pass cacheresults=false. Alternatively, use the latex option forget, or the command latex:−Forget.

– 

commabetweentensorindices : default value is false; if set to true, a comma between tensor indices is placed also in the LaTeX translation, so that they are displayed the same way they are on a Maple sheet.

– 

invisibletimes : sets the string used to represent the product operator, by default " ". That matches the default of the LaTeX typesetting system where no spacing is placed between the operands of a product, so a*b is displayed ab. To have a small space between the operands of a product you can use invisibletimes=\\,

– 

leavespaceafterfunctionname : default value is false; if set to true no \! LaTeX negative spacing command will be placed between a function name, say F and the large parenthesis \left( \right) surrounding the function's arguments.

– 

linelength : default value is 66; it indicates the approximate length at which a line-break \\ should be introduced when using the option breaklines.

– 

powersoftrigonometricfunctions : default value is mixed; other possible values are textbooknotation and computernotation. With the value mixed, sinx+y2 is translated to LaTeX as \sin^2 (x + y), and upon compilation will look like sin2x+y. With the value textbook, in addition, inverse trigonometric functions are translated to LaTeX with the notation that uses the name of the corresponding trigonometric function power -1, so arcsinx+y is translated as \sin^{-1} (x + y). With the value computer the translation is an exact replica of what you see displayed on the Maple sheet.

– 

spaceaftersqrt : default value is true; to insert or not a LaTeX small spacing command after a square root when it is an operand of a product.

– 

usecolor : default value is true, so that colors in the worksheet are translated as such to LaTeX.

– 

usedisplaystyleinput : default value is true, so that when using File > Export As > LaTeX all the input lines appears preceded by \displaystyle, i.e.: when compiling the .tex file, these lines are displayed with LaTeX math display style (the size of the fonts won't depend on the context).

– 

useimaginaryunit : default value is the one shown by interfaceimaginaryunit, that in Maple is the capital letter I. This setting can be used to indicate the use of a different symbol when translating to LaTeX.

– 

useinputlineprompt : can be true or false, to put or not a prompt at the beginning of Maple input lines when using File > Export As > LaTeX. When the Maple sheet was created as a worksheet, interfaceformat=worksheet and so the default value of useinputlineprompt is true. Otherwise, when it started as a document, interfaceformat=document and the value of useinputlineprompt is by default false. You can use useinputlineprompt to override these default values.

– 

userestrictedtypesetting : default value is false; if set to true, only a restricted form of typesetting, like the one used in the input lines of the Maple help pages, is used when translating to LaTeX.

– 

usespecialfunctionrules : default value is true; if set to false, no typesetting for the notation of mathematical functions is used.

– 

usetypesettingcurrentsettings : default is false; if set to true the Typesetting rules set in the Maple worksheet are not overridden by latex.

Tips for File > Export As > LaTeX

• 

The section latex:-Tips present several recommendations to get an optimal translation when exporting Maple sheets using File > Export As > LaTeX. Among the most relevant ones:

– 

In the worksheet, before exporting, remove all or selectively some of Maple's input, while keeping all of Maple's output and corresponding equation labels, by respectively using the menus View > Show/Hide Contents > Input or Edit > Delete Element. This is particularly useful to produce LaTeX mathematical documents that entirely or partially hide their computer algebra origin.

– 

In the worksheet, select any mathematical expression written using Maple syntax that appears within the text (e.g. Int(f(x), x)), or as Maple input and use Format > Convert To > 2-D Math Nonexecutable (or, alternatively, right-click (Command-click, on Mac) and select Convert To > 2-D Math Nonexecutable) to produce a textbook mathematical display of that expression, that will then appear as such in the LaTeX exported document.

– 

In the resulting filename.tex file, adjust the new automatic line-breaking of math formulas by placing \\ wherever you want an additional line-break, or enclosing a formula's subexpression between  to avoid its automatic line-breaking.

– 

Set several preferences regarding how to perform the LaTeX translation using the latex:-Settings command. To see the different settings and their current value enter latex:−Settings.

Examples

Fractions are translated using the \frac LaTeX command, not elevating the denominator to the power -1

eeax+y3

eeax+y3

(3.1)

latexee

\frac{a}{x +\frac{y}{3}}

You can use latex or LaTeX indistinctly; these two commands are synonyms of each other.

LaTeXee

\frac{a}{x +\frac{y}{3}}

The LaTeX translation is displayed on the screen; that is useful for copy & paste, but the actual return value of latex(ee) is NULL. If you need a non-NULL return value use output = string

latexee,output=string

\frac{a}{x +\frac{y}{3}}

(3.2)

Color is translated the same way you see it on the screen (blue and black are ignored)

eeInt=int1x2+1,x

ee1x2+1ⅆx=arctanx

(3.3)

latexee

\textcolor{gray}{\int}\frac{1}{x^{2}+1}\textcolor{gray}{d}x =
\arctan \! \left(x \right)

Translating color is a setting. You can change any of the latex:-Settings using latex:-Settings(keyword = value) or using its synonym LaTeX:-Settings. To query about these settings use the keyword query or enter the command without arguments

latex:-Settings

cacheresults=true,commabetweentensorindices=false,invisibletimes= ,leavespaceafterfunctionname=false,linelength=66,powersoftrigonometricfunctions=mixed,spaceaftersqrt=true,usecolor=true,usedisplaystyleinput=true,useimaginaryunit=I,useinputlineprompt=true,userestrictedtypesetting=false,usespecialfunctionrules=true,usetypesettingcurrentsettings=false

(3.4)

So, for example, to avoid color being translated, you can enter

latex:-Settingsusecolor=false

usecolor=false

(3.5)

latexee

\int \frac{1}{x^{2}+1}d x = \arctan \! \left(x \right)

 

More varied examples of the interactive use of latex are presented in the Examples section of the latex help page.

 

Regarding File > Export As > LaTeX, as an illustration of the new exporting capabilities, you can open the worksheet Physics,Examples, use the menu View > Expand All Sections, then the menu File > Export As > LaTeX, and compile the resulting .tex file with any LaTeX app. The resulting PDF file has 86 pages long of LaTeX translated plots, text, input and output with equation labels and sophisticated mathematical notation, showcasing also the new automatic line-breaking of long input and output expressions.