mailing-list for TeXmacs Users

Text archives Help


Re: [TeXmacs] Nouveau plugin TeXgraph.


Chronological Thread 
  • From: Corcelle <address@hidden>
  • To: address@hidden
  • Subject: Re: [TeXmacs] Nouveau plugin TeXgraph.
  • Date: Sun, 30 Nov 2008 00:31:14 +0100

Hello me,

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.
A new version of the TeXgraph plugin is attached.

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.

With a little help by the developer of Texgraph, P. Fradin, I have succeeded in correcting this little problem and I added a test which let you know if you have done a syntax error and what kind of error has been done (missing bracket or coma...).

Everything works fine now and the whole thing is really worth trying. It is a really good complement to Eukleides, easy to use and efficient for plotting, 3D...

Last thing. In the session heading, I would like to know if it is possible to add :
1. a link to a documentation for TeXgraph commands which could be placed in the /plugins/texgraph folder
2. a folded environnement where I could place a few TeXgraph commands.

Let me know if you need more information or if there are things to correct.


Bye.
Bye.

Emmanuël Corcelle
Emmanuël Corcelle again

((((( 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.02
# 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 verbatim:TeXmacs interface to TeXgraph.
echo For LaTeX code, use \\\\ instead of \\ \for example, $\\\\pi$ instead of $\\pi$
echo Rappels \: Fenetre\(-4+3*i,4-3*i,1+i\), Marges\(0.25,0.25,0.25,0.25\), size\(5\)
echo -n $DATA_END

# 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{texgraph}" >> $TEMP_FILE.tex
echo -E "\pagestyle{empty}" >> $TEMP_FILE.tex
echo -E "\begin{document}" >> $TEMP_FILE.tex
echo -E "\begin{texgraph}[export=epsc]" >> $TEMP_FILE.tex
echo -E "Marges(0.25,0.25,0.25,0.25)," >> $TEMP_FILE.tex
#echo -E "Fenetre(-4+4*i,4-4*i,1+i)," >> $TEMP_FILE.tex
# other commands to initialize the graph can be included here

# 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 --draftmode $TEMP_FILE.tex 1> /dev/null 2> tmp_log
if [ -s texgraphtmp1.eps ]
then
echo -n $DATA_BEGIN
echo -n verbatim:
echo -n $DATA_BEGIN
echo -n ps:
cat texgraphtmp1.eps
echo -n $DATA_END
echo -ne "\n"
rm $TEMP_FILE.* texgraphtmp1.* tmp*
else
echo -n $DATA_BEGIN
echo -n verbatim:
cat texgraphtmp1.log
echo -n $DATA_BEGIN
echo -n ps:
echo -n $DATA_END
echo -ne "\n"
rm $TEMP_FILE.* texgraphtmp1.* tmp*
fi
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