pablgonz has asked for the wisdom of the Perl Monks concerning the following question:
example test-pdf.tex (before run script)#!/usr/bin/perl -w use strict; use Tie::File; #open my $archivo = 'test-pdf.tex'; my @coment=split(/\\begin{document}/, $archivo,2); #Usamos tie tie @coment, 'Tie::File', $archivo or die "No coment lines: $!"; #search foreach my $line (@coment) { # Coment $line =~ s/(\\usepackage){pst/\%\\usepackage{pst/i; } #close untie @coment;
this is output test-pdf.tex (after run script)\RequirePackage{graphicx} \let\IncludeGraphics\includegraphics \graphicspath{{images/}} \documentclass[10pt]{article} \usepackage[T1]{fontenc} \usepackage{lmodern} \usepackage{pstricks} \usepackage{pstricks-add} \usepackage[spanish]{babel} \usepackage{microtype}% sólo pdftex \begin{document} Example code \begin{verbatim} \documentclass[10pt]{article} \usepackage[T1]{fontenc} \usepackage{lmodern} \usepackage{pstricks} \usepackage{pstricks-add} \usepackage[spanish]{babel} \usepackage{microtype}% sólo pdflatex \begin{document} \begin{pspicture}[showgrid=true](4,2) \psscaleboxto(8,2){Hola} \end{pspicture} \begin{pspicture}[showgrid=true](4,2) \psscaleboxto(4,2){foo bar} \end{pspicture} \end{document} \end{verbatim} Obtain \IncludeGraphics[scale=1]{test-tmp-0.pdf} and \IncludeGraphics[scale=1]{test-tmp-1.pdf} \end{document}
Thank for comments, (i think the problem its in open or split file)...\RequirePackage{graphicx} \let\IncludeGraphics\includegraphics \graphicspath{{images/}} \documentclass[10pt]{article} \usepackage[T1]{fontenc} \usepackage{lmodern} %\usepackage{pstricks} this is ok %\usepackage{pstricks-add} this is ok \usepackage[spanish]{babel} \usepackage{microtype}% sólo pdftex \begin{document} Example code \begin{verbatim} \documentclass[10pt]{article} \usepackage[T1]{fontenc} \usepackage{lmodern} %\usepackage{pstricks} %%%%this is wrong %\usepackage{pstricks-add} %%%%this is wrong \usepackage[spanish]{babel} \usepackage{microtype}% sólo pdflatex \begin{document} \begin{pspicture}[showgrid=true](4,2) \psscaleboxto(8,2){Hola} \end{pspicture} \begin{pspicture}[showgrid=true](4,2) \psscaleboxto(4,2){foo bar} \end{pspicture} \end{document} \end{verbatim} Obtain \IncludeGraphics[scale=1]{test-tmp-0.pdf} and \IncludeGraphics[scale=1]{test-tmp-1.pdf} \end{document}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: split and tie::file
by davido (Cardinal) on May 30, 2011 at 04:44 UTC | |
by pablgonz (Initiate) on May 30, 2011 at 11:20 UTC | |
by pablgonz (Initiate) on May 31, 2011 at 04:03 UTC | |
|
Re: split and tie::file
by Khen1950fx (Canon) on May 30, 2011 at 05:53 UTC | |
|
Re: split and tie::file
by Anonymous Monk on May 30, 2011 at 02:44 UTC | |
by Anonymous Monk on May 30, 2011 at 11:02 UTC | |
by Anonymous Monk on May 30, 2011 at 11:10 UTC | |
by pablgonz (Initiate) on May 30, 2011 at 11:07 UTC | |
by Anonymous Monk on May 31, 2011 at 22:08 UTC |