mailing-list for TeXmacs Users

Text archives Help


[TeXmacs] Nouveau plugin TeXgraph.


Chronological Thread 
  • From: Corcelle <address@hidden>
  • To: address@hidden
  • Subject: [TeXmacs] Nouveau plugin TeXgraph.
  • Date: Thu, 27 Nov 2008 23:50:32 +0100

Hello everybody,

I just wrote a plugin for TeXgraph. This software makes it possible to create graphs which will be used inside LaTeX (you can find this really good software in French at http://texgraph.tuxfamily.org/index.html).
I followed the help files to create two files :
- tm_texgraph based on tm_pstricks by Nicolas Ratier
- init-texgraph.scm based on init-eukleides.scm by Joris van der Hoeven.
To use it, you have to extract texgraph.tar.gz in the "~/.TeXmacs/plugin" directory under linux and to install TeXgraph of course.

As it is my first attempt to do something like this, it is not clean and seems buggy.
There are a few things I can't correct. For example, in the following TeXgraph session in TeXmacs, I can't remove the red <\errput> just below the graph.

<\output>
<with|mode|math|T<rsub|E>X*g*r*a*p*h>
TeXmacs interface to TeXgraph.
Defaut : Fenetre(-4+3*i,4-3*i,1+i), Marges(0.25,0.25,0.25,0.25)
</output>
<\input|TeXgraph] >
Marges(0.25,0.25,0.25,0.25),size(7.5),\
NewMac("f", "x^3/27-1",x), NewMac("g","3*sin(x)",x),\
LineStyle:=noline, FillStyle:=bdiag, FillColor:=blue , domaine3(f(t),g(t)),
LineStyle:=solid, FillStyle:=none, Width:=8, Color:=red, Courbe(t+i*f(t)),\
Color:=blue,Courbe(t+i*g(t)),Color:=black, Arrows:=1
Axes(0,1+i)
</input>
<\output>
<postscript|<tuple|<#25226........................................................2525454F460A>|ps>||||||>
<\errput>
This is dvips(k) 5.96.1 Copyright 2007 Radical Eye Software
(www.radicaleye.com)
' TeX output 2008.11.27:2003' -\<gtr\>
/home/famille/.TeXmacs/system/tmp/texgraphtmp1.eps
\<less\>/usr/share/texmf-texlive/dvips/base/tex.pro\<gtr\>
\<less\>/usr/share/texmf-texlive/dvips/pstricks/pstricks.pro\<gtr\>
\<less\>/usr/share/texmf-texlive/dvips/pstricks/pst-dots.pro\<gtr\>
\<less\>/usr/share/texmf-texlive/dvips/pstricks/pst-node.pro\<gtr\>
\<less\>/usr/share/texmf-texlive/dvips/pstricks-add/pstricks-add.pro\<gtr\>
\<less\>/usr/share/texmf/fonts/enc/dvips/lm/lm-rm.enc\<gtr\>
\<less\>/usr/share/texmf/fonts/enc/dvips/lm/lm-mathsy.enc\<gtr\>
\<less\>/usr/share/texmf-texlive/dvips/base/texps.pro\<gtr\>
\<less\>/usr/share/texmf-texlive/dvips/base/special.pro\<gtr\>
\<less\>/usr/share/texmf-texlive/dvips/base/color.pro\<gtr\>.\
\<less\>/usr/share/texmf/fonts/type1/public/lm/lmsy10.pfb\<gtr\>
\<less\>/usr/share/texmf/fonts/type1/public/lm/lmr10.pfb\<gtr\>[1]\
</errput>
</output>
<\input|TeXgraph] >
\;
</input>

So your comments would be very welcome.
And as it is my first post on this forum, thank you for this great software that I discovered 2 years ago.


Bye.

Emmanuël Corcelle

((((( TeXmacs 1.0.7 and TeXgraph 1.94 beta on Ubuntu Intrepid (8.10) )))))

The 2 files :

########### tm_texgraph ###########
#!/bin/bash
#==============================================================================
# MODULE : tm_texgraph
# VERSION : 0.01
# DESCRIPTION: A simple TeXgraph interface for TeXmacs (Emmanuel Corcelle : corcelle at gmail dot com)
#------------------------------------------------------------------------------
# Based on : A simple PSTricks interface for TeXmacs
# COPYRIGHT : (C) 2004 Nicolas Ratier (nicolas DOT ratier AT lpmo DOT edu))
#------------------------------------------------------------------------------
# COPYRIGHT : (C) TeXgraph by Patrick Fradin (pfradin at tuxfamily point org) (http://texgraph.tuxfamily.org/)
#------------------------------------------------------------------------------
# tm_texgraph
# ==========
# bash script for interfacing TeXgraph from TeXmacs
# needs option --texmacs for compatibility with TeXmacs interface convention and user information
#
# usage within TeXmacs:
# =====================
# write texgraph-commands within the input line, use as many commands as necessary,
# divide them by the "," chararacter, because the ENTER key terminates the input and sends it to TeXgraph.
# output is the graph made via TeXgraphCmd, latex, and dvips -E mode.
#
# Temporary file are made in ~/.TeXmacs/system/tmp
#------------------------------------------------------------------------------
# This software falls under the GNU general public license and comes WITHOUT
# ANY WARRANTY WHATSOEVER. See the file $TEXMACS_PATH/LICENSE for more details.
# If you don't have this file, write to the Free Software Foundation, Inc.,
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#==============================================================================

if [ "$1" != "--texmacs" ]
then
echo tm_texgraph. This script should be started only from TeXmacs.
exit
fi
# control characters
tmp=`echo DATA_BEGIN=X DATA_END=Y DATA_ESCAPE=Z | tr "XYZ" "\002\005\027" `
eval $tmp

# defining temporary files directory and make it if it doesn't exist
TEMP_DIR=~/.TeXmacs/system/tmp
if [ -d $TEMP_DIR ]
then
cd $TEMP_DIR
else mkdir -p $TEMP_DIR
cd $TEMP_DIR
fi

# defining primary temp file name
TEMP_FILE=texgraphtmp
# startup banner
echo -n $DATA_BEGIN
echo -n latex:'$T_{E}Xgraph$'
echo -n $DATA_END
echo -n $DATA_BEGIN
echo verbatim:TeXmacs interface to TeXgraph.
echo Defaut \: Fenetre\(-4+3*i,4-3*i,1+i\), Marges\(0.25,0.25,0.25,0.25\)

# prompt-input-texgraph-output loop
while [ 1 ]; do
# prompt
echo -n $DATA_BEGIN
echo -n channel:prompt
echo -n $DATA_END
echo -n TeXgraph'] '
echo -n $DATA_END
# read a line from stdin
read input

# begin creation of TeX file
echo -E "\documentclass{article}" > $TEMP_FILE.tex
echo -E "\usepackage[export=epsc]{texgraph}" >> $TEMP_FILE.tex
echo -E "\pagestyle{empty}" >> $TEMP_FILE.tex
echo -E "\begin{document}" >> $TEMP_FILE.tex
echo -E "\begin{texgraph}" >> $TEMP_FILE.tex
echo -E "Fenetre(-3+3*i,3-3*i,1+i)," >> $TEMP_FILE.tex
echo -E "Marges(0.25,0.25,0.25,0.25)," >> $TEMP_FILE.tex

# copy TeXgraph in latex file
echo -E $input | tr "~" "\n" | cat >> $TEMP_FILE.tex

# finish TeX file
echo -E "\end{texgraph}" >> $TEMP_FILE.tex
echo -E "\end{document}" >> $TEMP_FILE.tex

# compile with latex, transform to .eps and cat .eps to TeXmacs.
latex --shell-escape --interaction=nonstopmode $TEMP_FILE.tex > /dev/null
cp texgraphtmp1.eps $TEMP_FILE.eps # rewrite this ? how ?
#echo -n $DATA_BEGIN
#echo -n verbatim:
echo -n $DATA_BEGIN
echo -n ps:
cat $TEMP_FILE.eps
echo -n $DATA_END
echo -ne "\n"
rm $TEMP_FILE.* texgraphtmp1.* tmp_*
done

############# init-texgraph.scm ################

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; MODULE : init-texgraph.scm
;; DESCRIPTION : Initialize TeXgraph plugin (Emmanuel Corcelle : corcelle at gmail dot com)
;;-----------------------------------------------------------------------------
;; Based on : Initialize Eukleides plugin
;; COPYRIGHT : (C) 2003 Joris van der Hoeven (vdhoeven at texmacs dot org)
;;------------------------------------------------------------------------------
;;
;; This software falls under the GNU general public license and comes WITHOUT
;; ANY WARRANTY WHATSOEVER. See the file $TEXMACS_PATH/LICENSE for details.
;; If you don't have this file, write to the Free Software Foundation, Inc.,
;; 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(plugin-configure texgraph
(:require (url-exists-in-path? "latex"))
(:launch "tm_texgraph --texmacs")
(:session "TeXgraph"))

Attachment: texgraph.tar.gz
Description: GNU Zip compressed data




Archive powered by MHonArc 2.6.19.

Top of page