help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

EPS-Files for LaTeX via the epslatexstandalone gnuplot export filter


From: Stefan Pofahl
Subject: EPS-Files for LaTeX via the epslatexstandalone gnuplot export filter
Date: Tue, 19 Feb 2008 14:29:23 +0100

Hello,

attached I send you my workaround to work with the epslatexstandalone
gnuplot export filter.
Perhaps someone knows a more clever way of dealing with the problem.

I hope it is of value for others.

Kind regards,

Stefan
-- 
## Copyright (C) 2008 Spofahl
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

## membrane_conductivity
## also
## example to produce EPS-files for Latex under octave 3.0 for MS-Windows
## with the gnuplot.v4.2 filter "epslatexstandalone"
##
## >>>>> caution: this example is written for MS-systems only !!!!!!!!!!!!!!!!!!

## Author: Spofahl <address@hidden>
##
## 2008-02-18 Spofahl <address@hidden>
## * Initial revision

#####################################################################################
##
## Values are taken from: Dawn M. Bernardi, Mark W. Verbrugge,
## Mathematical model of a gas diffusion electrode bonded to a polymer
electrolyte
## AIChE Journal, vol.37(8), 1151-1163, 1991
##
#####################################################################################

function [ plhandle ] = membrane_conductivity ()
## Constants:
  C_prot_N11X     = 1200.0;  # []= mol/m^3
  Faraday         = 96498.0; # []= A*s/mol
  R_gas           = 8.314;   # []= J/(mol*K)
  kDiff_Prot_N11X = 4.5E-9;  # []= m^2/s
  T_0             = 273.15;  # []= K

## Variables:
  T               = [T_0+40:0.1:T_0+100]';
  rows            = size(T)(1);
  Conductivity    = T;

## Calculations:
  for m=1:rows
    Conductivity(m) = Faraday^2.0 * kDiff_Prot_N11X * C_prot_N11X /
(R_gas * T(m));
  endfor
  ## or build an array with the reciprocals in each element:
"T_reciprocals= T.^-1;"
  Conductivity    = Faraday^2.0 * kDiff_Prot_N11X * C_prot_N11X / R_gas * T.^-1;

## Plot:
  clg();
  plhandle        = plot(T, Conductivity);
  legend(" Conductivity","location","northwest");
  ## avoid specials like "\fontname", gnuplot.v4.2 filter
"epslatexstandalone" can't deal with it
  hxl=xlabel('{[T]= K}');
  hyl=ylabel('{[Conductivity, $\kappa$]= S/m}');
  ## change directory, gnuplot.v4.2 filter "epslatexstandalone" can't handle
  ## MS-DOS directory strings correctly, so change first the directory manualy
  cd c:/tex
  print -depslatexstandalone conductivity.tex;
  ## It is necessary that miktex or something else is properly installed and
  ## texi2dvi.exe and dvips.exe is in the search path:
  command_strg = "texi2dvi -V conductivity.tex";
  system(command_strg);
  ## read dvips.pdf documentation file about more information about
the commandline
  ## options of "dvips", suggestions for improvements of the following
"dvips" command
  ## are welcome (stefan.at.pofahl.de)
  command_strg = "dvips -f -E -D 600 -M0 -R -V -o conductivity.eps
conductivity.dvi";
  system(command_strg);
  ## Call ghostview in the single instance, open eps in an existing
ghostview window, option: "-e"
  command_strg = "C:\\Programme\\Ghostgum\\gsview\\gsview32.exe -e
conductivity.eps";
  ## Don't wait for the end of gsview process, run in asynchronous
mode, third argument: "async"
  system(command_strg,1,"async");
  ## eps output done :-) ---------------------------------------------------- ##
  ## change \fontname and \fontsize for standard plot window
  hxl=xlabel('{\fontname{Times}\fontsize{18} [T]= K}');
  hyl=ylabel('{\fontname{Times}\fontsize{18} [Conductivity]= S/m}');
  replot;

endfunction


reply via email to

[Prev in Thread] Current Thread [Next in Thread]