为什么 psfrag 没有用 .eps 图形替换我的文本?

为什么 psfrag 没有用 .eps 图形替换我的文本?

我目前正在编写一个包含许多 .eps 文件的文档。不幸的是,它还包含许多 PNG。为了解决 Latex/pdfLatex 问题,我已将两个文档合并在一起。文档 1 是主文档,包含我的所有文本、文字、图像等。文档 1 仅包含 PNG,并在 pdfLatex 中编译。文档 2 本质上是一个艺术收藏,我在其中导入 .eps 文件,并将 .eps 文件中的文本替换为数学字体的文本。我生成文档的 pdf,并将图像截图成 PNG,然后最终将其放入文档 1 中。现在,它运行良好,或者直到 psfrag 停止工作之前都是这样。编译时没有错误,什么都没有,它只是没有替换文本。

原始图像:

在此处输入图片描述

替换图像:

在此处输入图片描述

所以,正如您所看到的,它以前可以工作,但现在它只是输出原始图像,没有任何变化。

这幅图像在 Latex 中的调用方式如下:

\begin{figure}[!ht]
    \centering
    \psfrag{DC}{$V_1$}
    \psfrag{SW1}{$SW_1$}
    \psfrag{i(t)}{$i(t)$}
    \psfrag{v(t)}{$v(t)$}
    \includegraphics[scale=1]{simple_switch_pulse.eps}
\end{figure}
\pagebreak

我的 TexStudio 设置:

在此处输入图片描述

构建设置:

在此处输入图片描述

最后是序言:

\documentclass[12pt]{report}
\usepackage{graphicx} % Required for inserting images
\usepackage{psfrag}

%\usepackage{scicite}
\usepackage{times}
\usepackage{titlesec}
\usepackage{lipsum}
\usepackage[section]{placeins}
\usepackage{pythontex} 
%\usepackage{minted}
%\usepackage{pdftex}
\usepackage[siunitx, americanvoltages,oldvoltagedirection]{circuitikz}
\usepackage[margin=4cm]{geometry}
\usepackage{mathtools}
\titleformat{\chapter}[display]     %removes chapter headings eg. Chapter 1
{\normalfont\bfseries}{}{0pt}{\Large}
\titleformat*{\subsection}{\normalfont\large}
\titleformat*{\section}{\normalfont\large}
\topmargin -2.54cm
%\oddsidemargin 0.2cm
\textwidth 15cm 
\textheight 23cm
\begin{document}

那么问题可能是什么?我没有遇到任何错误,我不知道是什么发生了变化导致它无法正常运行。

根据要求,这是 eps 的一部分。它肯定是文本(因为之前已经用过了)。

%!PS-Adobe-3.0 EPSF-3.0
%!PS-Adobe-3.0 EPSF-3.0
%%Title: simple_switch_pulse.eps
%%Creator: XCircuit v3.4 rev10
%%CreationDate: Sun Jul 09 16:15:13 2023
%%Pages: 1
%%BoundingBox: 68 68 271 155
%%DocumentNeededResources: font Times-Roman font Symbol 
%%EndComments
%%BeginProlog
%
%  PostScript prolog for output from xcircuit
%  Version: 3.3
%
%  Electrical circuit (and otherwise general) drawing program
%
%  Written by Tim Edwards 8/5/93--7/13/05  ([email protected])
%  The Johns Hopkins University (1993-2004)
%  MultiGiG, Inc. (2004-present)
%
%%BeginResource: procset XCIRCproc 3.3 0
%
% supporting definitions --- these are the primary xcircuit types.

/XCIRCsave save def
/topmat matrix currentmatrix def

/fontslant { /slant exch def [1 0 slant 1 0 0] 
    exch findfont exch makefont dup length dict /ndict exch def
    { 1 index /FID ne { ndict 3 1 roll put } { pop pop } ifelse } forall
    ndict definefont pop} def
/ul { dup type /stringtype eq showflag 1 eq and { gsave 
   currentpoint topmat setmatrix 0 0 moveto 2 index stringwidth pop (_)
   false charpath flattenpath pathbbox grestore exch pop 1 index
   sub setlinewidth exch pop currentpoint 3 -1 roll add moveto 0
   rlineto stroke moveto } if } def
/ol { dup type /stringtype eq showflag 1 eq and { gsave gsave
   currentpoint topmat setmatrix 2 index stringwidth pop 3 index
   true charpath flattenpath pathbbox grestore exch pop
   exch pop topmat setmatrix (_) true charpath pathbbox grestore
   exch pop 1 index sub setlinewidth exch pop currentpoint
   exch 4 1 roll exch sub add moveto pop 0 rlineto stroke
   moveto } if } def
/stW { gsave currentpoint newpath moveto true charpath flattenpath
    pathbbox pop exch pop sub grestore } def
/Ts {mark Tabs aload pop counttomark 1 add array astore /Tabs exch def Tabs
    0 currentpoint pop put} def
/Tbn {mark Tabs aload pop counttomark dup 2 add 1 roll cleartomark 1 sub} def
/Tb { 0 1 Tbn {Tabs exch get dup currentpoint pop lt
    {currentpoint exch pop moveto exit} {pop} ifelse } for } def
/Tf { Tbn -1 0 {Tabs exch get dup currentpoint pop gt
    {currentpoint exch pop moveto exit} {pop} ifelse } for } def
/qS { (aa) stW (a a) stW sub 4 div 0 Kn } def
/hS { qS qS } def
/pspc 0 def
/cf0 { scalefont setfont } bind def
/Kn { dup kY add /kY exch def rmoveto } bind def
/ss { /fscale fscale 0.67 mul def currentfont 0.67 cf0 0 fscale0 fscale mul
    0.33 mul neg Kn} def
/Ss { /fscale fscale 0.67 mul def currentfont 0.67 cf0 0 fscale0 fscale mul
    0.67 mul Kn } def
/ns { 0 kY neg Kn /kY 0 def /fscale 1.0 def xfont0 1.0 cf0 } def
/CR { ns 0 /Bline Bline fscale0 neg add def Bline moveto } def
/cf { dup type /realtype ne {1.0} if exch findfont exch kY 0 eq
    { 40 mul dup /fscale0 exch def cf0 /xfont0 currentfont def}
    {fscale0 mul fscale mul cf0} ifelse } def
/ctmk { counttomark dup 2 add -1 roll pop } bind def
/label { gsave translate 0 0 moveto dup scale neg /rotval exch def
    /just exch def just 384 and 0 gt {/mshow {pop} def} {/mshow {show}
    def} ifelse just 16 and 0 gt {gsave rotval rotate 0 1 dtransform
    gsave pagemat setmatrix idtransform exch grestore 1 0 dtransform
    gsave pagemat setmatrix idtransform exch grestore dup abs 1e-9 lt
    {pop mul 0 gt} {3 1 roll pop pop 0 lt} ifelse grestore {-1 /rotval
    rotval neg def /just just dup 3 and 1 ne {3 xor} if def} {1} ifelse
    exch -1e-9 lt {-1 /rotval rotval neg def /just just dup 12 and
    4 ne {12 xor} if def} {1} ifelse scale } if /showflag 0 def
    /fspc pspc def /Bline 0 def /Tabs 0 array def /fscale 1.0 def
    /kY 0 def gsave dup 1 add copy 0 exch 1 0 dtransform exch atan rotate
    {exch dup type /stringtype eq {true charpath flattenpath} {dup type
    /arraytype eq {exec} {12 string cvs true charpath flattenpath} ifelse}
    ifelse} repeat pop pathbbox grestore 3 -1 roll pop 3 1 roll just
    1 and 0 gt {just 2 and 0 gt {exch pop neg fspc sub} {exch sub 0.5
    mul neg} ifelse} {pop neg fspc add} ifelse exch Bline exch just 4
    and 0 gt {just 8 and 0 gt {exch pop neg fspc sub} {add 0.5 mul neg}
    ifelse} {pop neg fspc add} ifelse rotval rotate Kn currentpoint
    translate /showflag 1 def /Bline 0 def /Tabs 0 array def /fscale
    1.0 def /kY 0 def {dup type /stringtype eq {mshow} {dup type
    /arraytype eq {exec} {12 string cvs mshow} ifelse} ifelse} repeat
    grestore } def
/pinlabel { 4 index 32 and 0 ne hlevel 0 eq or { /pspc 10 def label
    /pspc 0 def } { pop pop pop pop pop {pop} repeat } ifelse } def
/pinglobal { pinlabel } def
/infolabel { pinlabel } def
/graphic { gsave 4 index cvx exec /DataSource get resetfile translate
    0 0 moveto neg rotate dup scale cvx exec image grestore } def

/scb { setrgbcolor } bind def  /sce { defColor aload pop scb } bind def
/cRedef {/defColor currentcolor 3 array astore def} def
/begingate {dup type /dicttype ne {1 dict} if begin % default params
    dup type /dicttype ne {1 dict} if begin     % instanced params
    /hlevel hlevel 1 add def /defColor currentcolor sce 3 array
    astore def gsave sce translate 0 0 moveto neg rotate dup abs scale
    } bind def
/endgate { /hlevel hlevel 1 sub def grestore defColor aload pop cRedef
    scb end end} bind def

/hlevel 0 def
/tmpa [1 0 0 1 0 0] def
/gar {8 8 true tmpa {<c0 c0 00 00 0c 0c 00 00>} imagemask} bind
{8 8 true tmpa {<30 70 60 02 03 07 06 20>} imagemask} bind
{8 8 true tmpa {<0c 1e 1e 0c c0 e1 e1 c0>} imagemask} bind
{8 8 true tmpa {<0f 0f 0f 0f f0 f0 f0 f0>} imagemask} bind
{8 8 true tmpa {<3f f3 e1 e1 f3 3f 1e 1e>} imagemask} bind
{8 8 true tmpa {<df cf 8f 9f fd fc f8 f9>} imagemask} bind
{8 8 true tmpa {<ff 3f 3f ff ff f3 f3 ff>} imagemask} bind 7 array astore def
/ppaint { gsave clip tmpa dup setmatrix pathbbox neg exch neg 4 2 roll
  neg 4 -1 roll 2 copy gt {exch} if 8 div ceiling 8 mul 4 2 roll neg 2 copy
  gt {exch} if 8 div ceiling 8 mul 3 -1 roll -8 5 -1 roll
  { 3 index exch 5 exch put dup -8 3 index { 3 index
  exch 4 exch put 3 index exec } for } for pop pop pop pop grestore } bind def
/setstyles {
  currentlinewidth mul setlinewidth /style exch def
  style 1 and 0 gt not {closepath} if
  style 2 and 0 gt {currentlinewidth 4 mul dup 2 array astore 0 setdash} if
  style 4 and 0 gt {0.5 currentlinewidth 4 mul 2 array astore 0 setdash} if
  gsave style 16 and 0 gt { style 224 and -5 bitshift style 256 and 0 gt {
  7 exch sub 8 div dup 1 exch sub currentrgbcolor 3 array astore
  {3 copy mul add 4 1 roll pop} forall pop pop setrgbcolor eofill}
  {dup 7 lt {gar exch get ppaint} {pop eofill} ifelse} ifelse}
  {style 256 and 0 gt {1 setgray eofill} if} ifelse grestore style 8 and 0 gt 
  style 512 eq or {newpath} {stroke} ifelse grestore} def     

/polygon { gsave /num exch def moveto num 1 sub {lineto} repeat setstyles } def
/xcarc   { gsave newpath arc setstyles } def
/elb { matrix currentmatrix 7 -1 roll 7 -1 roll translate 5 1 roll 4 -1 roll
    3 index div 1 scale } def
/ele { 0 4 1 roll 0 4 1 roll } bind def
/ellipse { gsave elb newpath ele arc setmatrix setstyles } def
/pellip  { elb ele arc setmatrix } def
/nellip  { elb ele arcn setmatrix } def
/spline  { gsave moveto curveto setstyles } def
/polyc   { {lineto} repeat } bind def
/beginpath { gsave moveto } bind def
/endpath { setstyles } bind def
/bop     { 1 setlinecap 0 setlinejoin 6 setmiterlimit 0 0 0 scb cRedef } def
/psinsertion {/PSobj save def /showpage {} def /setpagedevice {pop} def bop
    rotate translate dup scale} def
/end_insert {PSobj restore} def
/setpagemat {/pagemat matrix currentmatrix def} def
/inchscale  {setpagemat 0.375 mul dup scale} def
/cmscale    {setpagemat 0.35433071 mul dup scale} def

%%EndResource
%%EndProlog

% XCircuit output starts here.

%%BeginSetup

/source {
% hidden
begingate
1 1.00 0 0 32 0.00 360.00 xcarc
1 1.00 0 32 0 64 2 polygon
1 1.00 0 -32 0 -64 2 polygon
endgate
} def

/vsource {
begingate
1.00 0 0 0 source
(+) {/Symbol cf} 2 5 0 1.00 0 18 label
(-) {/Symbol cf} 2 5 0 1.00 0 -18 label
1.000 0.000 0.000 scb
(v.p) {/Times-Roman cf} 2 9 0 1.00 0 64 pinlabel
(v.m) {/Times-Roman cf} 2 13 0 1.00 0 -64 pinlabel
endgate
} def

/inductor {
begingate
1 1.00 20 -28 20 -44 0 -48 0 -24 spline
1 1.00 -20 -20 -20 -32 0 -28 0 -24 spline
1 1.00 20 32 20 16 0 12 0 36 spline
1 1.00 20 12 20 -4 0 -8 0 16 spline
1 1.00 20 -8 20 -24 0 -28 0 -4 spline
1 1.00 -20 20 -20 8 0 12 0 16 spline
1 1.00 -20 0 -20 -12 0 -8 0 -4 spline
1 1.00 0 -48 0 -64 2 polygon
1 1.00 0 36 0 48 2 polygon
1.000 0.000 0.000 scb
(l.1) {/Times-Roman cf} 2 9 0 1.00 0 48 pinlabel
(l.2) {/Times-Roman cf} 2 13 0 1.00 0 -64 pinlabel
0.180 0.545 0.341 scb
(spice:L%i %pl.1 %pl.2 1.0U) {/Times-Roman cf} 2 0 0 1.00 -208 -160 infolabel
(sim:l %pl.1 %pl.2) {/Times-Roman cf} 2 0 0 1.00 -208 -208 infolabel
endgate
} def

/circle {
% trivial
begingate
1 1.00 16 0 6 0.00 360.00 xcarc
1 1.00 0 0 10 0 2 polygon
1.000 0.000 0.000 scb
(out) {/Times-Roman cf} 2 4 0 1.00 16 0 pinlabel
(out) {/Times-Roman cf} 2 7 0 1.00 0 0 pinlabel
endgate
} def

/arrowhead {
% trivial
begingate
8 -28 beginpath
3 -18 3 -15 0 0 curveto
-3 -15 -3 -18 -8 -28 curveto
-2 -26 2 -26 8 -28 curveto
249 1.00 endpath
endgate
} def

/switch {
% trivial
begingate
1 1.30 32 32 2 -43 2 polygon
1 0.60 0 -48 57 49.00 90.00 xcarc
-1.00 90 0 -64 circle
0.60 270 -12 8 arrowhead
1.00 90 0 48 circle
1.000 0.000 0.000 scb
(sw.1) {/Times-Roman cf} 2 9 0 1.00 0 48 pinlabel
(sw.2) {/Times-Roman cf} 2 13 0 1.00 0 -64 pinlabel
endgate
} def

/arrow {
% trivial
begingate
1 0.80 0 -40 0 20 2 polygon
1.00 0 0 40 arrowhead
endgate
} def


%%EndSetup

%%Page: 1 1
%%PageOrientation: Portrait
/pgsave save def bop
1.0000 inchscale
2.6000 setlinewidth 624 288 translate

1.00 0 -400 0 vsource
1.00 0 -32 0 inductor
-1.00 90 -208 80 switch
1 1.00 -400 80 -400 64 2 polygon
1 1.00 -400 80 -272 80 2 polygon
1 1.00 -32 -64 -32 -80 2 polygon
1 1.00 -32 48 -32 64 2 polygon
1 1.00 -32 64 -32 80 -160 80 3 polygon
1 1.00 -32 -80 -32 -96 -400 -96 -400 -64 4 polygon
1.00 360 0 0 arrow
1.00 180 -62 -6 arrow
(DC) {/Times-Roman cf} 2 16 0 1.00 -352 -16 label
(SW1) {/Times-Roman cf} 2 16 0 1.00 -256 32 label
(i\(t\)) {/Times-Roman cf} 2 16 0 1.00 -128 0 label
(v\(t\)) {/Times-Roman cf} 2 16 0 1.00 32 0 label
pgsave restore showpage

%%Trailer
XCIRCsave restore
%%EOF

相关内容