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: Mon, 01 Dec 2008 21:57:55 +0100

Excuse me, I didn't mean to be impolite by rewriting the same post.
I thought my first posts weren't sent because I couldn't see them in the archive so I decided to write with a different email address.

Thank you for your answer.

Emmanuël

Joris van der Hoeven a écrit :
Hi Emmanuel,

Sorry for my late reply and thanks for your work.
I am a bit busy, but will try your plug-in as soon as possible,
and hopefully include it in the next version of TeXmacs.
Please keep in touch with us if you make further enhancements.

Best wishes, Joris

On Mon, Dec 01, 2008 at 08:58:22PM +0100, Corcelle wrote:
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, if you don't know it yet you really should have a look).
I followed the documentation 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.

I have tested it under Ubuntu 8.10, TeXmacs 1.0.7 and TeXgraph 1.94 beta 7-2. Everything seems to work fine and is a really good complement to Eukleides for plotting, 3d...
But, as it is my first attempt to do something like this, there may be errors and everythings probably not very clean. So your comments would be very welcome.

And as it is my first post on this forum, I would like to thank you for this great software. Learning it, I had the same feeling as I had learning gnu-linux. A little time to get in and then the efficiency of a really powerful and easy to use software.

Bye.

Emmanuël Corcelle

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"))









Archive powered by MHonArc 2.6.19.

Top of page