PDF output

Messages in english

Modérateur : xcasadmin

Messages : 52
Inscription : jeu. juil. 27, 2017 3:26 pm

PDF output

Message par belanger » dim. sept. 13, 2020 8:26 pm

I just got back my first Xcas homework from my students.
To my surprise, some of them put it in Python mode even though
I never mentioned it to them. (Maybe not that surprising; Python
is the introductory computer language here.) Some of them didn't
know what the ps output was, though. Is there a straightforward
way to get a copy of a session in pdf?


Messages : 5346
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: PDF output

Message par parisse » lun. sept. 14, 2020 9:57 am

PS support under Windows requires two additional software Ghostscript and GSView http://www.cs.wisc.edu/~ghost/. Under linux and MacOS convert session.ps session.pdf will do the job.
Alternatively, you can clone the session in Xcas for Firefox, then the browser is certainly able to export to PDF.

Messages : 78
Inscription : mer. janv. 13, 2010 3:20 pm

Re: PDF output

Message par XcasEngGuy » jeu. sept. 17, 2020 6:09 pm

If you have Cygwin installed (Windows computer) the following script will produce a nice landscape PDF. Save tex file from File>LaTex>Latex preview in the Xcas menu. Then run the script.

if [ $# -eq 0 ]
echo 'Convert tex file to PDF'
echo 'Usage: latex_pdf <tex file> [<zoom option>]'
echo 'optional <zoom option> from 10 to 10000 - 1000 is 1:1 zoom'
sed -i 's/\\documentclass{article}/\\documentclass[landscape]{article}\n\\usepackage{fullpage}/' $1
fn=`cygpath -u $1 | sed -e 's?.*/??g' -e 's/.[Tt][Ee][Xx]$//'`
latex $fn.tex
if [ $# -lt 2 ]
dvips $fn.dvi # -t letter -t landscape -Ppdf $fn.dvi
dvips -x $2 $fn.dvi # -t letter -t landscape -Ppdf -x $2 $fn.dvi
ps2pdf $fn.ps $fn.pdf
rm $fn.aux
rm $fn.dvi
# rm $fn.log
# rm $fn.ps
cygstart $fn.pdf