APEXCalculus / APEXCalculusPTX

In-progress conversion of APEX Calculus to PreTeXt
6 stars 20 forks source link

Asymptote background #302

Closed sean-fitzpatrick closed 3 months ago

sean-fitzpatrick commented 4 months ago

Just a caution: I added a setting to the asymptote preamble that produces better results for the HMTL version. But it is not good for PDF: the transparent background becomes black in the PDF version.

I will see if I can come up with a solution that is better than adding further clutter to the docinfo.

(One option: right now we use two "components", one for colour, and one for black and white, with different colour settings, for both TikZ and Asymptote. I could move to using three compoents: HTML, colour print, and BW print. But that will add a third copy of the asymptote-preamable and require an additional publisher file.

sean-fitzpatrick commented 4 months ago

Of course John Bowman knew how to fix it:

currentlight.background=opacity(settings.outformat == "html" ? 0.0 : 1.0);

I'll make this change the next time I have enough for a pull request.

APEXCalculus commented 4 months ago

Of course he did. Somehow I'm often surprised at the usage of Asymptote syntax. I tend to forget it's a programming language and one can build switches/if-then statements right inside.

On Thu, Jun 6, 2024 at 3:23 PM Sean Fitzpatrick @.***> wrote:

Of course John Bowman knew how to fix it:

currentlight.background=opacity(settings.outformat == "html" ? 0.0 : 1.0);

I'll make this change the next time I have enough for a pull request.

— Reply to this email directly, view it on GitHub https://github.com/APEXCalculus/APEXCalculusPTX/issues/302#issuecomment-2153251532, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABT5OF7XPA6WTRVFDQAN2O3ZGCZKZAVCNFSM6AAAAABI4265S2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNJTGI2TCNJTGI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

sean-fitzpatrick commented 4 months ago

That said, when I try this it does not seem to work. I still get a dark background for PDF output with this line added.

If I remove it completely, I get white background.

sean-fitzpatrick commented 3 months ago

This seems to work: if(settings.outformat == "html") currentlight.background=opacity(0.0);

I'll test a bit more...

sean-fitzpatrick commented 3 months ago

This is settled with #303