# Examples of interactive computations inside a LATEX file compiled to HTML.

### B. Parisse
Institut Fourier
UMR 5582 du CNRS
Université de Grenoble

### 2015

## Contents

## Index

- giaccmd, 3
- giaccmdbigmath, 3
- giaccmdmath, 3
- giacinput, 3
- giacinputbig, 3
- giacinputbigmath, 3
- giacinputmath, 3
- giacjs, 3
- giacjshere, 3

- giacjsonline, 3
- giaclink, 3
- giacprog, 3
- giacslider, 3
- index, 3
- table, 3

## 1 Description

This LATEX source will output an interactive HTML file if you compile with hevea (tested with `hevea 2.23`), where interactive computations are done with the computer algebra system Giac.

## 2 Install

Please install hevea. Copy giac.tex and hevea.sty in the same folder as your source file. You can also get a copy of the source test.tex for this file and check your installation by compiling it
`hevea test`

## 3 Commands

You must first enter the command `\input{giac.tex}` in the preamble of your LATEX source file and add one of the commands `\begin{giacjshere}` `\begin{giacjs}` or `\begin{giacjshere}` just after `\begin{document}`: the difference is that the javascript kernel `giac.js` will either be found from the same place where the file was downloaded or on the hard disk (assuming that Giac/Xcas is installed on the target computer) or downloaded from Giac Internet website. You must also add the corresponding command `\end{giacjs}` or `\end{giacjshere}` just before `\end{document}`. You should add the command `\tableofcontents` then `\printindex` just after `\begin{giacjshere}` (and add `\makeindex` somewhere).

Inline command with Mathml or 2d graph output `\giacinputmath{}` or `\giaccmdmath{}{}` :
`\giacinputmath{factor(x^10-1)}`
factor(x^10-1)
With an optional style argument
`\giacinputmath[style="width:200px;height:20px;font-size:large"]{factor(x^10-1)}`
factor(x^10-1)
`\giaccmdmath{factor}{x^4-1}`
x^4-1
`\giaccmdmath[style="width:200px;height:20px;font-size:large"]{factor}{x^4-1}`
x^4-1

Outline command with mathml output `\giacinputbigmath{}` or `\giaccmdbigmath{}{}` :
`\giacinputbigmath{factor(x^100-1)}`

factor(x^100-1)
`\giacinputbigmath[style="width:600px;height:20px;font-size:large"]{factor(x^100-1)}`
factor(x^100-1)
`\giaccmdbigmath{factor}{x^100-1}`
x^100-1
`\giaccmdbigmath[style="width:600px;height:20px;font-size:large"]{factor}{x^100-1}`
x^100-1

Inline command example with text or plot output `\giacinput` and `\giacinputbig`, example:
`\giacinput{factor(x^4-1)}` :
factor(x^4-1)
Same command with optional style argument
`\giacinput[style="width:200px;height:20px;font-size:large"]{plot(sin(x))}`
plot(sin(x))

A button with a command applied on the field entry with `\giaccmd`, example
`\giaccmd{factor}{x^4-1}` :
x^4-1
with optional style argument
`\giaccmd[style="width:200px;height:20px;font-size:large"]{factor}{x^4-1}`
x^4-1

Warning, you must replace `<` by `&lt;` and `>` by `&gt;`, otherwise they will be interpreted as HTML delimiters.

For a program or multi-line commands
`\begin{giacprog}...\end{giacprog}`, example homemade absolute value

    f(x):={
      local y;
      if x<0 then y:=-x; else y=x; fi;
      return y;
    }

Inside this environment, you can keep `<` and `>`. Do not use this environment in another environment (like itemize or enumerate).

A link to Xcas offline with a few commands
`\giaclink{http://www-fourier.univ-grenoble-alpes.fr/\%7eparisse/xcasen.html#+factor(x^4-1)&+a:=idn(3)&}`
Test online

A slider
`\giacslider{a}{-5}{5}{0.1}{0}{plot(sin(a*x))}`

= plot(sin(a*x)) Not evaled

## 4 Logo turtle

efface; avance 30;