Fonts in Asymptote, and HTML

189 views
Skip to first unread message

Sean Fitzpatrick

unread,
Aug 15, 2019, 12:32:19 PM8/15/19
to PreTeXt support
In Asymptote code, it's possible to specify the fonts to be used for labels.
Useful, if you're writing a LaTeX book, and want the label font to match the rest of the book.

But what happens to this font specification when we want to generate SVG files for the HTML version of the book?

Say you decide your LaTeX should use the Carlito font, and build this into all your asymptote images.

On the PreTeXt side, font is a publisher option, not an author choice.
So maybe your Asymptote code should say nothing about fonts?

I don't think it's trivial to have MathJax switch to using the Carlito font in your HTML output.

Alex Jordan

unread,
Aug 15, 2019, 5:48:02 PM8/15/19
to pretext...@googlegroups.com
What does the code look like to set a font for an asymptote image?
If PTX had a "latex.typeface" publisher switch, could it double as a
way to set the font in asymptote images?

--
You received this message because you are subscribed to the Google Groups "PreTeXt support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pretext-suppo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pretext-support/48f4f16a-fbd3-40f1-91c9-df748f69b099%40googlegroups.com.

Michael Doob

unread,
Aug 15, 2019, 6:35:31 PM8/15/19
to PreTeXt support

Asymptote has the concept of a pen which may have many properties
including a font and a font size. You can switch pens at any time. For
example, the following at the top of your asymptote file will change
the default font to Palatino:

usepackage("mathptmx");
defaultpen(Palatino());


Cheers,
Michael
 

On Thursday, August 15, 2019 at 4:48:02 PM UTC-5, jordancanonical wrote:
What does the code look like to set a font for an asymptote image?
If PTX had a "latex.typeface" publisher switch, could it double as a
way to set the font in asymptote images?

On Thu, Aug 15, 2019 at 9:32 AM Sean Fitzpatrick <dsfitz...@gmail.com> wrote:
In Asymptote code, it's possible to specify the fonts to be used for labels.
Useful, if you're writing a LaTeX book, and want the label font to match the rest of the book.

But what happens to this font specification when we want to generate SVG files for the HTML version of the book?

Say you decide your LaTeX should use the Carlito font, and build this into all your asymptote images.

On the PreTeXt side, font is a publisher option, not an author choice.
So maybe your Asymptote code should say nothing about fonts?

I don't think it's trivial to have MathJax switch to using the Carlito font in your HTML output.

--
You received this message because you are subscribed to the Google Groups "PreTeXt support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pretext...@googlegroups.com.

Sean Fitzpatrick

unread,
Aug 15, 2019, 7:51:28 PM8/15/19
to PreTeXt support
The code for every Asymptote image in APEX includes usepackage(mathspec) and several texpreamble lines that specify options for the Calibri font used in APEX.

Unless you're on Windows asymptote will hang on this code, because Calibri is a Microsoft font.

So step 1 was to comment this out to have any hope of compiling.
But maybe there's a way to replace those lines with something using a parameter that's set in latex-preamble.

Reply all
Reply to author
Forward
0 new messages