#166 asymptote.sty wrongly patch \Ginclude@eps

Default
closed-invalid
nobody
None
5
2016-02-24
2014-02-08
Leo Liu
No

In the current version of asymptote.sty (asy-latex.dtx) patches \Ginclude@eps to allow spaces in file names. But this patch works only for Dvips, which breaks dvipdfmx and XeTeX.

We should not patch \Ginclude@eps like that. It is better to use grffile package instead.

Minimal working example (as attached):

% Compile with XeLaTeX / latex+dvipdfmx V.S. Dvips
% Obtained by:
%     fill(box((10,10), (50,40)), gray);
\begin{filecontents*}{1.eps}
%!PS-Adobe-3.0 EPSF-3.0
%%BoundingBox: 285 380 326 411
%%HiResBoundingBox: 285.5 380.5 325.5 410.5
%%Creator: Asymptote 2.23
%%CreationDate: 2014.02.09 03:01:46
%%Pages: 1
%%Page: 1 1
/Setlinewidth {0 exch dtransform dup abs 1 lt {pop 0}{round} ifelse
idtransform setlinewidth pop} bind def
gsave
 275.5 370.5 translate
newpath 10 10 moveto
 50 10 lineto
 50 40 lineto
 10 40 lineto
 10 10 lineto
closepath
0.5 setgray
0.5 Setlinewidth
1 setlinecap
1 setlinejoin
10 setmiterlimit
fill
grestore
showpage
%%EOF
\end{filecontents*}

\documentclass{article}

\usepackage{graphicx}
\usepackage{asymptote}

\begin{document}

\fbox{\includegraphics{1.eps}}

\end{document}
1 Attachments

Discussion

  • John Bowman

    John Bowman - 2014-04-17

    Your minimal example doesn't deal with spaces in file names, which is what the dvips fix is all about.

    You mentioned grffile as the preferred solution but you forgot to use it in your minimal example. It doesn't help anyway (at least with latex+dvips). The documentation of grffile says:

    "In general it is not possible to use space inside file names, because TEX considers
    the space character as termination in its syntax for commands that expect a file
    name."

    A proper minimal example is below. Rename the file "1.eps" from your example to "a 1.eps" (without the quotes). The following example fails with latex+dvips unless the dvips fix is enabled by uncommenting

    %\usepackage{asymptote}

    By the way this fix is also in texfile.h of the Asymptote source code. If you come up with a similar workaround that works with xelatex, I will be happy to include it in a future release. It would be better, though, to get both dvips and xelatex/dvipdfmx officially patched to handle spaces within quoted file names.

    \documentclass{article}
    
    \usepackage{graphicx}
    %\usepackage{asymptote}
    
    \begin{document}
    
    \includegraphics{"a 1.eps"}
    
    \end{document}
    
     
  • John Bowman

    John Bowman - 2014-04-17
    • status: open --> closed-invalid
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks