I want to use Maxima as a backend to solve some of the calculations used in my LaTeX input file. I have taken the following steps.
Step 1
Download and install Maxima.
Step 2
Create a batch file with a name cas.bat
(for example) as follows.
rem cas.bat
echo off
set PATH=%PATH%;"C:\Program Files (x86)\Maxima-5.31.2\bin"
maxima --very-quiet -r %1 > solution.tex
Save the package in the same directory as your input file below. It is just for simplicity.
Step 3
Create an input file with a name main.tex
(for example) as follows.
% main.tex
\documentclass[preview,border=12pt,12pt]{standalone}
\usepackage{amsmath}
\def\f(
\begin{document}
\section{Problem}
Evaluate $\f(x)$ for $x=\frac 1 2$.
\section{Solution}
\immediate\write18{cas "x: 1/2;tex(\f(x));"}
\input{solution}
\end{document}
Step 4
Compile the input file with pdflatex -shell-escape main
, and you will get a good output as follows.
! 
Step 5
Done.
Questions
Apparently, Maxima's output is as follows. I do not know how to make it cleaner.
solution.tex
1
-
2
$${{15}\over{4}}$$
false
Now, my question is:
- How to delete such texts?
\frac{15}{4}
$$...$$
?