Closed sean-fitzpatrick closed 3 years ago
Note that (I'm pretty sure) we can't just write what we need into the <macros>
section, since we need to use Asymptote syntax and not LaTeX. But maybe @mdoob knows how to do this?
I had this idea, but had not caught up with list traffic enough to think carefully before proposing it. Your Asymptote source is part of your overall source. So asymptote-preamble
makes good sense to me.
Let's not get too fancy - whatever is in the element, it gets dropped into the asy code at the right place. So no extra style file to be managed? Or, said differently, the preamble element is the style file.
Ok. I'll give that a try. Should be able to modify extract-asymptote.xsl for this.
I think just dropping in something like <xsl:value-of select="$asymptote-preamble">
should work?
That variable needs to be defined somewhere, I think? I'll look at existing examples for clues
<xsl:value-of select="$docinfo/asymptote-preamble"/>
which assumes the content is one giant text node.
There is a utility template to left-justify (strip excessive leading space, preserve indentation), but that may not be necessary here, unless folks want to the source code and want it pretty.
A PR would be great, as I won't have much time for this until the end of the month.
Got it. I'll get on it tonight. Should be much easier than reconciling all 309 examples of Greg's Asymptote code.
Bonjour a tous: hello from Quebec. I'm not quite in full contact.
Of course asymptote can read files and use conditionals based on the content. Nonetheless, it seems to me that adding a asymptote-preamble construction that parallels the one used for tikz makes more sense.
Cheers, Michael
From: Rob Beezer notifications@github.com Sent: 02 September 2020 14:06 To: rbeezer/mathbook Cc: Michael Doob; Mention Subject: Re: [rbeezer/mathbook] Custom parameters for Asymptote (feature request) (#1363)
Caution: This message was sent from outside the University of Manitoba.
I had this idea, but had not caught up with list traffic enough to think carefully before proposing it. Your Asymptote source is part of your overall source. So asymptote-preamble makes good sense to me.
Let's not get too fancy - whatever is in the element, it gets dropped into the asy code at the right place. So no extra style file to be managed? Or, said differently, the preamble element is the style file.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/rbeezer/mathbook/issues/1363#issuecomment-685905713, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAVJL7XSMNG754WDL3EH3KDSD2CSZANCNFSM4QTMCWLQ.
I am now chuckling at my "I'll get on it tonight" claim. Still trying to get a reasonable (colour) PDF out the door, and classes start tomorrow (so I should do something about my unfinished syllabus). But this is still on my list. I'll get on it once Greg finishes updating the asymptote code.
I think this is resolved by #1385 and can be closed.
Currently we have a
<latex-image-preamble>
but no<asymptote-preamble>
. Would it be possible to create something like this? Theextract-asymptote.xsl
template writes the contents of the<macros>
section to each.asy
file, which ensures that any LaTeX macros used in an Asymptote label get read correctly.But it would be useful to be able to author Asymptote diagrams using globally defined parameters for settings like pen colour. These could be imported in a style file. Possible solution: in
we add a line (or lines) after
<xsl:text>");

</xsl:text>
that writesimport (style file name).asy
. That style file could be specified using a string parameter or in the publisher file.Maybe that is easier than adding a new element (
asymptote-preamble
) to the schema.