Coder Social home page Coder Social logo

Comments (3)

user202729 avatar user202729 commented on July 2, 2024

Actually the point is that the jobname is customized to be the same of the main file...? But looks like the feature is somewhat broken anyway.

Try compiling the following file:

\documentclass{article}
\usepackage{asymptote}
\begin{document}
123
\begin{asy}
	label("[\jobname]");
\end{asy}

\end{document}

Expected behavior: the [ and the ] is visible.

Actual behavior: they're truncated.

Deleting the whole thing might be a reasonable option.

diff --git a/picture.cc b/picture.cc
index 65c72cbc..4ca86284 100644
--- a/picture.cc
+++ b/picture.cc
@@ -381,20 +381,6 @@ void texinit()
   } else {
     if(!dir.empty())
       cmd.push_back("-output-directory="+dir);
-    string jobname="texput";
-    if(getSetting<bool>("inlineimage") || getSetting<bool>("inlinetex")) {
-      string name=stripDir(stripExt((outname())));
-      size_t pos=name.rfind("-");
-      if(pos < string::npos) {
-        name=stripExt(name).substr(0,pos);
-        unlink((name+".aux").c_str());
-        jobname=name.substr(0,pos);
-        cmd.push_back("-jobname="+jobname);
-#ifdef __MSDOS__
-        cmd.push_back("NUL"); // For MikTeX
-#endif
-      }
-    }
     cmd.push_back("\\scrollmode");
   }

(This way if there happens to be a file named texput.aux then there's a problem. But we can just set the jobname to some uniquely-named file to avoid problems...?)

from asymptote.

johncbowman avatar johncbowman commented on July 2, 2024

Indeed, the commit message

In inlinetex mode, avoid interference from pre-existing aux file.

answers your question. We don't want to clutter up the working directory with other file prefixes.

Instead of accessing the volatile symbol \jobname, the user should do this to obtain the desired result:

\begin{asy}
	label("["+defaultfilename+"]");
\end{asy}

from asymptote.

user202729 avatar user202729 commented on July 2, 2024

Instead of accessing the volatile symbol \jobname, the user should do this to obtain the desired result:

I see. In that case my concern (that jobname must be changed in order to make the values in the measure phase be the same as the actual run) was not a problem

We don't want to clutter up the working directory with other file prefixes.

This is actually not a problem. Starting from a.tex contains

%! TEX program = pdflatex
\documentclass{article}
\usepackage{asymptote}
\begin{document}
123
\begin{asy}
	label("45");
\end{asy}

\end{document}

and type latexmk, the following files are generated, regardless whether the proposed changes are done:

$ ls
a-1.asy  a-1.pdf  a.aux  a.fdb_latexmk  a.fls  a.log  a.pdf  a.pre  a.tex

In other words, the clean-up appears to be done correctly. So it's not a problem.

Still, it feels like a good idea to randomize the jobname -- just in case there are multiple parallel runs of asy in the same directory.

An alternative is to specify -output-directory to be a temporarily-created directory. Then no clutter of current directory, and clean-up is easy.

I think implementing the proposed changes would be a good idea.

from asymptote.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.