⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fm_laprint.m

📁 基于PSAT 软件的多目标最优潮流计算用于中小型电力系统的分析和管理
💻 M
📖 第 1 页 / 共 5 页
字号:
      unitlength(i)=pos(3)*epswidth;      ybound(i)=(pos(4)*epsheight)/(pos(3)*epswidth);    else      if directcall	disp('LaPrint warning: Option ''extrapicture'' for 3D axes not supported.')      end      end  end end  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PART 3 of advanced usage:%%%% save eps and tex files%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% save eps file%if ~loose  cmd=[ 'print(''-deps'',''-f' int2str(figno) ''',''' epsfullnameext ''')' ];else  cmd=[ 'print(''-deps'',''-loose'',''-f' int2str(figno) ...	''',''' epsfullnameext ''')' ];end  if verbose  disp([ 'executing: '' ' cmd ' ''' ]);endeval(cmd);%% create latex file%if verbose  disp([ 'writing to: '' ' texfullnameext ' ''' ])endfid=fopen(texfullnameext,'w');% headif ~nohead  fprintf(fid,[ '%% This file is generated by the MATLAB m-file fm_laprint.m.' ...                ' It can be included\n']);  fprintf(fid,[ '%% into LaTeX documents using the packages epsfig and ' ...                'psfrag. It is accompanied\n' ]);  fprintf(fid,  '%% by a postscript file. A sample LaTeX file is:\n');  fprintf(fid, '%%    \\documentclass{article} \\usepackage{epsfig,psfrag}\n');  fprintf(fid,[ '%%    \\begin{document}\\begin{figure}\\input{' ...                texbasename '}\\end{figure}\\end{document}\n' ]);  fprintf(fid, [ '%% See http://www.uni-kassel.de/~linne/ for recent ' ...                 'versions of fm_laprint.m.\n' ]);  fprintf(fid,  '%%\n');  fprintf(fid,[ '%% created by:           ' 'LaPrint version ' ...                laprintident '\n' ]);  fprintf(fid,[ '%% created on:           ' datestr(now) '\n' ]);  fprintf(fid,[ '%% options used:        ' furtheroptions '\n' ]);  fprintf(fid,[ '%% latex width:          ' num2str(latexwidth) ' cm\n' ]);  fprintf(fid,[ '%% factor:               ' num2str(factor) '\n' ]);  fprintf(fid,[ '%% eps file name:        ' epsbasenameext '\n' ]);  fprintf(fid,[ '%% eps bounding box:     ' num2str(epswidth) ...                ' cm x ' num2str(epsheight) ' cm\n' ]);  fprintf(fid,[ '%% comment:              ' commenttext '\n' ]);  fprintf(fid,'%%\n');else   fprintf(fid,[ '%% generated by fm_laprint.m\n' ]);  fprintf(fid,'%%\n');end% go onfprintf(fid,'\\begin{psfrags}%%\n');%fprintf(fid,'\\fontsize{10}{12}\\selectfont%%\n');fprintf(fid,'\\psfragscanon%%\n');% text stringsnumbertext=0;for i=1:nt  numbertext=numbertext+length(newstr{i});endif numbertext>0,  fprintf(fid,'%%\n');  fprintf(fid,'%% text strings:\n');  for i=1:nt    if length(newstr{i})      alig=strrep(align{i},'c','');      fprintf(fid,[ '\\psfrag{' newstr{i} '}[' alig '][' alig ']{' ...                    fontsizecmd{i} fontweightcmd{i} fontanglecmd{i} selectfontcmd ...                    oldstr{i} '}%%\n' ]);    end  endend% labelsif ~keepticklabels  if keepfontprops    fprintf(fid,'%%\n');    fprintf(fid,'%% axes font properties:\n');    fprintf(fid,[ afsizecmd afweightcmd '%%\n' ]);    fprintf(fid,[ afanglecmd '\\selectfont%%\n' ]);  end    nxlabel=zeros(1,na);  nylabel=zeros(1,na);  nzlabel=zeros(1,na);  for i=1:na    nxlabel(i)=length(newxtl{i});    nylabel(i)=length(newytl{i});    nzlabel(i)=length(newztl{i});  end        allxyz={ 'x', 'y', 'z' };  for ixyz=1:3    xyz=allxyz{ixyz};    eval([ 'oldtl=old' xyz 'tl;' ]);    eval([ 'newtl=new' xyz 'tl;' ]);    eval([ 'nlabel=n' xyz 'label;' ]);    if sum(nlabel) > 0      fprintf(fid,'%%\n');      fprintf(fid,[ '%% ' xyz 'ticklabels:\n']);      if xyz=='x'        poss='[t][t]';      else        poss='[r][r]';      end        for i=1:na        if nlabel(i)          if strcmp(get(hax(i),[ xyz 'scale']),'linear')	    % lin scale	    % all but last            for j=1:nlabel(i)-1              fprintf(fid,[ '\\psfrag{' newtl{i}{j} '}' poss '{' ...                            Do oldtl{i}{j} Do '}%%\n' ]);            end             % last            rexpon=powers(i,ixyz);	    if rexpon	      if xyz=='x'	        fprintf(fid,[ '\\psfrag{' newtl{i}{nlabel(i)} ...                              '}' poss '{\\shortstack{' ...                               Do oldtl{i}{nlabel(i)} Do '\\\\$\\times 10^{'...                              int2str(rexpon) '}\\ $}}%%\n' ]);              else                fprintf(fid,[ '\\psfrag{' newtl{i}{nlabel(i)} ...                              '}' poss '{' Do oldtl{i}{nlabel(i)} Do ...                              '\\setlength{\\unitlength}{1ex}%%\n' ...                              '\\begin{picture}(0,0)\\put(0.5,1.5){$\\times 10^{' ...                              int2str(rexpon) '}$}\\end{picture}}%%\n' ]);              end            else	      fprintf(fid,[ '\\psfrag{' newtl{i}{nlabel(i)} '}' poss '{' ...                            Do oldtl{i}{nlabel(i)} Do '}%%\n' ]);            end          else            % log scale            for j=1:nlabel              fprintf(fid,[ '\\psfrag{' newtl{i}{j} '}' poss '{$10^{' ...                            oldtl{i}{j} '}$}%%\n' ]);            end          end        end         end    end  endend  % extra pictureif extrapicture  fprintf(fid,'%%\n');  fprintf(fid,'%% extra picture(s):\n');  for i=1:na    fprintf(fid,[ '\\psfrag{origin' int2str(i) '}[lb][lb]{' ...                  '\\setlength{\\unitlength}{' ...		  num2str(unitlength(i),'%5.5f') 'cm}%%\n' ]);    fprintf(fid,[ '\\begin{picture}(1,' ...		  num2str(ybound(i),'%5.5f') ')%%\n' ]);    %fprintf(fid,'\\put(0,0){}%% lower left corner\n');    %fprintf(fid,[ '\\put(1,' num2str(ybound(i),'%5.5f') ...    %	          '){}%% upper right corner\n' ]);    fprintf(fid,'\\end{picture}%%\n');    fprintf(fid,'}%%\n');  endend  % figurefprintf(fid,'%%\n');fprintf(fid,'%% Figure:\n');if caption  fprintf(fid,[ '\\parbox{' num2str(latexwidth) 'cm}{\\centering%%\n' ]);end  if noscalefonts  fprintf(fid,[ '\\epsfig{file=' epsbasenameext ',width=' ...                num2str(latexwidth) 'cm}}%%\n' ]);else    fprintf(fid,[ '\\resizebox{' num2str(latexwidth) 'cm}{!}' ...                '{\\epsfig{file=' epsbasenameext '}}%%\n' ]);endif caption  if isempty(captiontext)    captiontext=[ texbasenameext ', ' epsbasenameext ];  end    fprintf(fid,[ '\\caption{' captiontext '}%%\n' ]);  fprintf(fid,[ '\\label{fig:' texbasename '}%%\n' ]);  fprintf(fid,[ '}%%\n' ]);end  fprintf(fid,'\\end{psfrags}%%\n');fprintf(fid,'%%\n');fprintf(fid,[ '%% End ' texbasenameext '\n' ]);fclose(fid);set(figno,'Name','Printed by LaPrint')if ~nofigcopy  if verbose    disp('Strike any key to continue.');    pause  end    close(figno)end%% create view file%if viewfile  if verbose    disp([ 'writing to: '' ' viewfullnameext ' ''' ])  end  fid=fopen(viewfullnameext,'w');  if ~nohead    fprintf(fid,[ '%% This file is generated by fm_laprint.m.\n' ]);    fprintf(fid,[ '%% It calls ' texbasenameext ...		  ', which in turn  calls ' epsbasenameext '.\n' ]);    fprintf(fid,[ '%% Process this file using\n' ]);    fprintf(fid,[ '%%   latex ' viewbasenameext '\n' ]);    fprintf(fid,[ '%%   dvips -o' viewbasename '.ps ' viewbasename '.dvi' ...                  '\n']);    fprintf(fid,[ '%%   ghostview ' viewbasename '.ps&\n' ]);  else     fprintf(fid,[ '%% generated by fm_laprint.m\n' ]);  end  fprintf(fid,[ '\\documentclass{article}\n' ]);  fprintf(fid,[ '\\usepackage{epsfig,psfrag,a4}\n' ]);  fprintf(fid,[ '\\usepackage[latin1]{inputenc}\n' ]);  if ~strcmp(epsdirname,viewdirname)    %disp([ 'warning: The view-file has to be supplemented by '...    %	   'path information.' ])    fprintf(fid,[ '\\graphicspath{{' epsdirname '}}\n' ]);  end    fprintf(fid,[ '\\begin{document}\n' ]);  fprintf(fid,[ '\\pagestyle{empty}\n' ]);  fprintf(fid,[ '\\begin{figure}[ht]\n' ]);  fprintf(fid,[ '  \\begin{center}\n' ]);  if strcmp(texdirname,viewdirname)     %fprintf(fid,[ '    \\fbox{\\input{' texbasenameext '}}\n' ]);    fprintf(fid,[ '    \\input{' texbasenameext '}\n' ]);  else    %fprintf(fid,[ '    \\fbox{\\input{' texdirname texbasenameext '}}\n' ]);    fprintf(fid,[ '    \\input{' texdirname texbasenameext '}\n' ]);  end  fprintf(fid,[ '    %% \\caption{A LaPrint figure}\n' ]);  fprintf(fid,[ '    %% \\label{fig:' texbasename '}\n' ]);  fprintf(fid,[ '  \\end{center}\n' ]);  fprintf(fid,[ '\\end{figure}\n' ]);  fprintf(fid,[ '\\vfill\n' ]);  fprintf(fid,[ '\\begin{flushright}\n' ]);  fprintf(fid,[ '\\tiny printed with LaPrint on ' ...		datestr(now) '\\\\\n' ]);  fprintf(fid,[ '\\verb+' viewdirname viewbasenameext '+\\\\\n' ]);  fprintf(fid,[ '\\verb+( ' texdirname texbasenameext ' )+\\\\\n' ]);  fprintf(fid,[ '\\verb+( ' epsdirname epsbasenameext ' )+\n' ]);  fprintf(fid,[ '\\end{flushright}\n' ]);  fprintf(fid,[ '\\end{document}\n' ]);  fclose(fid);  if verbose    yn=input([ 'Perform LaTeX run on ' viewbasenameext '? (y/n) '],'s');    if strcmp(yn,'y')       cmd=[ '!latex ' viewbasenameext ];      disp([ 'executing: '' ' cmd ' ''' ]);      eval(cmd);      yn=input([ 'Perform dvips run on ' viewbasename '.dvi? (y/n) '],'s');      if strcmp(yn,'y')         cmd=[ '!dvips -o' viewbasename '.ps ' viewbasename '.dvi' ];        disp([ 'executing: '' ' cmd ' ''' ]);        eval(cmd);        yn=input([ 'Call ghostview on ' viewbasename '.ps? (y/n) '],'s');        if strcmp(yn,'y')           cmd=[ '!ghostview ' viewbasename '.ps&' ];          disp([ 'executing: '' ' cmd ' ''' ]);          eval(cmd);        end      end    end  endendif ~directcall & iswarning  showtext({'Watch the LaPrint messages in the command window!'},'add')end%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% functions used%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%function showtext(txt,add)global LAPRINTHANtxt=textwrap(LAPRINTHAN.helptext,txt);if nargin==1  set(LAPRINTHAN.helptext,'string','')  set(LAPRINTHAN.helptext,'string',txt)else  txt0=get(LAPRINTHAN.helptext,'string');  set(LAPRINTHAN.helptext,'string','')  set(LAPRINTHAN.helptext,'string',{txt0{:},txt{:}})end%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%function showsizes()global LAPRINTOPTglobal LAPRINTHANfigpos=get(LAPRINTOPT.figno,'position');latexwidth=LAPRINTOPT.width;latexheight=latexwidth*figpos(4)/figpos(3);epswidth=latexwidth/LAPRINTOPT.factor;epsheight=latexheight/LAPRINTOPT.factor;set(LAPRINTHAN.texsize,'string',[ 'latex figure size: ' num2str(latexwidth) ...                    'cm x ' num2str(latexheight) 'cm' ])set(LAPRINTHAN.epssize,'string',[ 'postscript figure size: ' ...                    num2str(epswidth) ...                    'cm x ' num2str(epsheight) 'cm' ])% some warningstxt1=' ';txt2=' ';txt3=' ';if (epswidth<13) | (epsheight<13*0.75)  txt1=['Warning: The size of the eps-figure is quite small. '...        'Text objects might not be properly set. '];  showtext({txt1},'add')endif LAPRINTOPT.factor<0.5  txt2=['Warning: The ''factor'' is quite small. ' ...	'The text size might be too small.'];  showtext({txt2},'add')end  if ((figpos(3)-epswidth)/figpos(3)>0.1) & ~LAPRINTOPT.asonscreen  txt3=['Warning: The size of the eps-figure is much smaller '...        'than the figure on screen. '...        'Consider using option ''as on sceen''.' ];  showtext({txt3},'add')end%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%function [fullnameext,basenameext,basename,dirname]= getfilenames(...    filename,extension,verbose);% appends an extension to a filename (as '/home/tom/tt') and determines  %   fullnameext: filename with extension with dirname, as '/home/tom/tt.tex'%   basenameext: filename with extension without dirname, as 'tt.tex'%   basename   : filename without extension without dirname, as 'tt'%   dirname    : dirname without filename, as '/home/tom/'% In verbose mode, it asks if to overwrite or to modify.%[dirname, basename] = splitfilename(filename);fullnameext = [ dirname basename '.' extension ];basenameext = [ basename '.' extension ];if verbose  quest = (exist(fullnameext)==2);  while quest    yn=input([ fullnameext ' exists. Overwrite? (y/n) '],'s');    if strcmp(yn,'y')       quest=0;    else      filename=input( ...	  [ 'Please enter new filename (without extension .' ...            extension '): ' ],'s');      [dirname, basename] = splitfilename(filename);      fullnameext = [ dirname basename '.' extension ];      basenameext = [ basename '.' extension ];      quest = (exist(fullnameext)==2);    end  endendif ( exist(dirname)~=7 & ~strcmp(dirname,[ '.' filesep ]) ...     & ~strcmp(dirname,filesep) )  fm_disp(['La

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -