vectorgraphics / asymptote

2D & 3D TeX-Aware Vector Graphics Language
https://asymptote.sourceforge.io/
GNU General Public License v3.0
547 stars 90 forks source link

Shifted pdf output #286

Closed asmwarrior closed 2 years ago

asmwarrior commented 2 years ago

Hi, I just try to run a simple code below:

import geometry;

size(10cm);

// currentcoordsys=cartesiansystem((2,1),i=(1,0.5),j=(-0.25,.75));
// show(currentcoordsys);

/* View the definition of triangle triangleabc(real,real,real,real,point) */
triangle t=triangleabc(3,4,5);
/* View the definition of void show(picture,Label,Label,Label,Label,Label,Label,triangle,pen,filltype) */
show(La="3", Lb="4", Lc="5",t);

Which is the first simple code in the page: https://web.archive.org/web/20180420081349/http://www.piprime.fr/developpement/triangle_asy/?posts_per_page=-1

And I got the shifted result, see below image

2021-12-28 20 59 43

I'm using the latest 2.73 version of Asymptote under Windows 64bit, and the latest gs Ghostscript AGPL Release

Any ideas which cause this error?

Thanks.

asmwarrior commented 2 years ago

OK, I try to run the code in the asymptote online editor: http://asymptote.ualberta.ca/

It looks like the online editor works OK.

So, is it possible this is a Windows OS only bug?

lemniscati commented 2 years ago

It might be useful to invoke asymptote with -keep option, and we/you might see what happens through intermediate files.

-k,-keep               Keep intermediate files [false]
johncbowman commented 2 years ago

I am closing this issue as I can't reproduce it on 64 bit Windows 10 with Asymptote 2.73, TeXLive 2021, and gs 9.55.0. Maybe you are using MikTeX or some other older TeX installation? It looks like the kind of problem caused by spurious spaces in some TeX package.

asmwarrior commented 2 years ago

I am closing this issue as I can't reproduce it on 64 bit Windows 10 with Asymptote 2.73, TeXLive 2021, and gs 9.55.0. Maybe you are using MikTeX or some other older TeX installation? It looks like the kind of problem caused by spurious spaces in some TeX package.

I am using TexLive 2021, Asymptote 2.73, gs 9.55.0 under Windows 7 64bit.

So, this is a bug from my side.

asmwarrior commented 2 years ago

It might be useful to invoke asymptote with -keep option, and we/you might see what happens through intermediate files.

-k,-keep               Keep intermediate files [false]

Thanks, I will check those files and report here.

asmwarrior commented 2 years ago

Hi, I have just add the --keep option, and here is the result files.

There are so many files, so I add them to the zip file as attachment, can you have a look, thanks.

texput.aux
texput.log
trianglexyz.asy
trianglexyz.pdf
trianglexyz_.aux
trianglexyz_.dvi
trianglexyz_.eps
trianglexyz_.log
trianglexyz_.ps
trianglexyz_.tex
trianglexyz_0.eps

The trianglexyz.asy is the input file, all other files are generated by Asymptote.

Thanks trianglexyz_draw.zip .

johncbowman commented 2 years ago

In order to get those output files, you must have specified other command line options or have other settings in your config.asy file, which we need to know about.

Please post your config.asy file and also the standard output and pdf file generated by

asy -vvv -k -f pdf -config "" trianglexyz.asy

johncbowman commented 2 years ago

I wonder if the difference to do with A4 vs. letter paper size in the TeXLive settings.

asmwarrior commented 2 years ago

In order to get those output files, you must have specified other command line options or have other settings in your config.asy file, which we need to know about.

Please post your config.asy file and also the standard output and pdf file generated by

asy -vvv -k -f pdf -config "" trianglexyz.asy

Hi, I have already upload the zip file, which contains all the generated files, see this comment:

https://github.com/vectorgraphics/asymptote/issues/286#issuecomment-1002355193

The trianglexyz_draw.zip contains all the files.

asmwarrior commented 2 years ago

Here is my config.asy file

    import settings;
    outformat="pdf";
    offline=true;
    papertype="a4";
    dvisvgm="E:\texlive\2021\bin\win32\dvisvgm.exe";
    gs = "C:\Program Files\gs\gs9.55.0\bin\gswin64c.exe";
    psviewer="D:\Program Files\Artifex Software\gsview6.0\bin\gsview.exe";
    htmlviewer="E:\download\FirefoxPortable\FirefoxPortable.exe";
    pdfviewer = "E:\download\office\SumatraPDF\SumatraPDF.exe";
    texpath = "E:\texlive\2021\bin\win32";
    dvips="E:\texlive\2021\bin\win32\dvips";
    //glOptions="-indirect";
    prc=false;
    //dir="";
    interactiveView=false;
    batchView=false;
    maxtile=(512,512);
    render=-4;
johncbowman commented 2 years ago

Please try the following test: Remove the line papertype="a4"; from your config.asy. Everything should be fine now. So we've tracked down the problem. Always remember to post your config.asy settings when reporting bugs.

johncbowman commented 2 years ago

Alternatively, you can specify -config "" on the command line to override your config file settings, as specified above.

asmwarrior commented 2 years ago

Please try the following test: Remove the line papertype="a4"; from your config.asy. Everything should be fine now. So we've tracked down the problem. Always remember to post your config.asy settings when reporting bugs.

Great! I just comment out the line from config.asy

    //papertype="a4";

Then, I got the correct result.

Thanks.

asmwarrior commented 2 years ago

Always remember to post your config.asy settings when reporting bugs.

OK, I will. Basically, we can have an option to "Skip" the config.asy.

In this command:

asy -vvv -k -f pdf -config "" trianglexyz.asy

Do you meant that the empty double quote string "" means we just skip the config.asy file in system folder(In my system: C:\Users\myusername\.asy), and use an empty config file? In this way, the default config setting is used.