Tikz images for PreTeXt #570
Replies: 4 comments 1 reply
-
The filename returned by I am not sure that you could make TikZImage produce multiple images on one run. At least not without massive restructuring of the entire setup. Currently the |
Beta Was this translation helpful? Give feedback.
-
I believe I have something working such that in addition to the current supported file extensions, you can have 'tgz' as a file extension. This makes the link from insertGraph be a tgz file containing the thing PreTeXt wants: tex, pdf, svg, png. I have some cleaning up to do before I post it for review. Does it raise any flags to treat tgz as an image format? This would only be used for PTX support. Similarly to when the display mode is hardcopy and 'pdf' is forced as the extension, when the display mode is PTX, 'tgz' would be forced as the extension. |
Beta Was this translation helpful? Give feedback.
-
There is no need for the data that is returned by the draw subroutine to represent an image. Whatever it returns, the insertGraph subroutine will write to disk. In fact the answerDiscussion.pl macro uses this to write its data in text format to disk. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
The "PTX" display mode is only used when someone is doing a one-time processing of their PreTeXt book project. Whereas the HTML output might print
<img src="aliased.svg"/>
, the PTX output would be<image source="aliased.svg"/>
and part of the PreTeXt WeBWorK processing script would (a) store all that output in a local file and (b) download and storealiased.svg
from the server'swebwork_files
folder.When the display mode is "PTX", it would be ideal if multiple image file formats would be created and stored with the same alias prefix. The PTX output could perhaps just be
<img src="aliased"/>
and then the PreTeXt script would locally store several files:aliased.svg
,aliased.png
,aliased.pdf
, and evenaliased.tex
.I have a few questions. (1) For anyone familiar with how the aliasing works: will it be easy to store the various image files to have the same aliased prefix even with different extensions? So if I produce
image.png
andimage.svg
, andimage.png
gets aliased asfoo_bar.png
; will I have a tough time gettingimage.svg
to alias asfoo_bar.svg
?My other question might be moot if the answer to (1) is discouraging.
(2) The code in
TikzImage.pm
assumes that there is only one final image file. For PTX output I would like there to be several. I can think of two general outlines for how I would modify that code. One would be like:Pro: that would make the code easy to review. Con: that is not a good approach if there is any reason to believe that producing multiple image formats might be useful for something other than PreTeXt. The alternative is more like visiting each possible image output type one at a time and asking if we need to make it.
The conditional tests might be like
if ($ext eq 'png' || $ext eq 'PTX')
.The only pro would be it sets the code up for other display modes that might want multiple image formats. Con: the current code will need significant restructuring.
Asssuming I can get past issue (1), I'm on the fence with (2) and I would go in whatever direction anyone has a preference for.
Beta Was this translation helpful? Give feedback.
All reactions